• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Models.TAS2013Entities类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中WMS.Models.TAS2013Entities的典型用法代码示例。如果您正苦于以下问题:C# TAS2013Entities类的具体用法?C# TAS2013Entities怎么用?C# TAS2013Entities使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



TAS2013Entities类属于WMS.Models命名空间,在下文中一共展示了TAS2013Entities类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: Create

        //
        // GET: /AttProcessors/Create
        public ActionResult Create()
        {
            TAS2013Entities db = new TAS2013Entities();
            User LoggedInUser = Session["LoggedUser"] as User;
            QueryBuilder qb = new QueryBuilder();
            String query = qb.QueryForCompanyViewLinq(LoggedInUser);
            ViewBag.PeriodTag = new SelectList(new List<SelectListItem>
            {
                new SelectListItem { Selected = true, Text = "Daily", Value = "D"},
                new SelectListItem { Selected = false, Text = "Monthly", Value = "M"},
                new SelectListItem { Selected = false, Text = "Summary", Value = "S"},

            }, "Value" , "Text",1);
            ViewBag.CriteriaID = new SelectList(new List<SelectListItem>
            {
                new SelectListItem { Selected = true, Text = "Company", Value = "C"},
                new SelectListItem { Selected = false, Text = "Location", Value = "L"},

            }, "Value", "Text", 1);
            ViewBag.ProcessCats = new SelectList(new List<SelectListItem>
            {
                new SelectListItem { Selected = true, Text = "Yes", Value = "1"},
                new SelectListItem { Selected = false, Text = "No", Value = "0"},

            }, "Value", "Text", 1);
            ViewBag.CompanyID = new SelectList(db.Companies.Where(query).OrderBy(s=>s.CompName), "CompID", "CompName");
            query = qb.QueryForLocationTableSegerationForLinq(LoggedInUser);
            ViewBag.LocationID = new SelectList(db.Locations.Where(query).OrderBy(s=>s.LocName), "LocID", "LocName");

            ViewBag.CatID = new SelectList(db.Categories.OrderBy(s=>s.CatName), "CatID", "CatName");
             return View();
        }
开发者ID:engrawais,项目名称:AirBlue,代码行数:34,代码来源:AttProcessorsController.cs


示例2: CheckForUserRole

        public string CheckForUserRole(User user)
        {
            string val = "";
            using (var ctx = new TAS2013Entities())
            {
                string criteria = ctx.UserAccesses.Where(aa => aa.UserID == user.UserID).FirstOrDefault().Criteria;
                switch (criteria.Trim())
                {
                    case "Z":
                        val = "Zone";
                        break;

                    case "R":
                        val="Region";
                        break;
                    case "C":
                        val = "City";
                        break;
                    case "L":
                        val = "Location";
                        break;
                        case "S":
                        val = "SuperUser";
                        break;
                }
                ctx.Dispose();
            }
            return val;
        }
开发者ID:ahsinanwar,项目名称:WMSNHA2016,代码行数:29,代码来源:QueryBuilder.cs


示例3: Create

 public ActionResult Create()
 {
     var _wings = new List<Division>();
     using (TAS2013Entities context = new TAS2013Entities())
     {
         _wings = context.Divisions.ToList();
     }
     ViewBag.CompanyID = new SelectList(db.Companies.OrderBy(aa=>aa.CompName), "CompID", "CompName");
     ViewBag.CrewID = new SelectList(db.Crews.OrderBy(aa => aa.CrewName), "CrewID", "CrewName");
     ViewBag.DesigID = new SelectList(db.Designations.OrderBy(aa => aa.DesignationName), "DesignationID", "DesignationName");
     ViewBag.GradeID = new SelectList(db.Grades.OrderBy(aa => aa.GradeName), "GradeID", "GradeName");
     ViewBag.JobID = new SelectList(db.JobTitles.OrderBy(aa => aa.JobTitle1), "JobID", "JobTitle1");
     //ViewBag.LocID = new SelectList(db.Locations, "LocID", "LocName");
     ViewBag.SecID = new SelectList(db.Sections.OrderBy(aa => aa.SectionName), "SectionID", "SectionName");
     ViewBag.ShiftID = new SelectList(db.Shifts.OrderBy(aa => aa.ShiftName), "ShiftID", "ShiftName");
     ViewBag.TypeID = new SelectList(db.EmpTypes.OrderBy(aa => aa.TypeName), "TypeID", "TypeName");
     ViewBag.EmpID = new SelectList(db.EmpFaces, "EmpID", "Face1");
     ViewBag.EmpID = new SelectList(db.EmpFps.OrderBy(aa => aa.Fp1), "EmpID", "Fp1");
     ViewBag.CatID = new SelectList(db.Categories.OrderBy(aa => aa.CatName), "CatID", "CatName");
     ViewBag.DeptID = new SelectList(db.Departments.OrderBy(aa => aa.DeptName), "DeptID", "DeptName");
     ViewBag.CityID = new SelectList(db.Cities.OrderBy(aa => aa.CityName), "CityID", "CityName");
     ViewBag.ZoneID = new SelectList(db.Zones.OrderBy(aa => aa.ZoneName), "ZoneID", "ZoneName");
     ViewBag.RegionID = new SelectList(db.Regions.OrderBy(aa => aa.RegionName), "RegionID", "RegionName");
     ViewBag.PostedAsID = new SelectList(db.Designations.OrderBy(aa => aa.DesignationName), "DesignationID", "DesignationName");
     return View();
 }
开发者ID:ahsinanwar,项目名称:WMSNHA2016,代码行数:26,代码来源:EmpController.cs


示例4: AddHalfLeaveToLeaveData

        public void AddHalfLeaveToLeaveData(LvApplication lvappl)
        {
            DateTime datetime = new DateTime();
            datetime = lvappl.FromDate;
            string _EmpDate = lvappl.EmpID + datetime.Date.ToString("yyMMdd");
            LvData _LVData = new LvData();
            _LVData.EmpID = lvappl.EmpID;
            _LVData.EmpDate = _EmpDate;
            _LVData.Remarks = lvappl.LvReason;
            _LVData.HalfLeave = true;
            _LVData.LvID = lvappl.LvID;
            _LVData.AttDate = datetime.Date;
            _LVData.LvCode = lvappl.LvType;
            _LVData.FirstHalf = lvappl.FirstHalf;
            try
            {
                using (var db = new TAS2013Entities())
                {
                    db.LvDatas.Add(_LVData);
                    db.SaveChanges();
                }
            }
            catch (Exception ex)
            {

            }
            // Balance Leaves from Emp Table
            BalanceLeaves(lvappl);
        }
开发者ID:linkstatic12,项目名称:NHAWMS,代码行数:29,代码来源:LeaveController.cs


示例5: UploadImageInDataBase

 public int UploadImageInDataBase(HttpPostedFileBase file, string _empNo)
 {
     using (var context = new TAS2013Entities())
     {
         List<EmpPhoto> _empPhotoList = new List<EmpPhoto>();
         EmpPhoto _EmpPhoto = new EmpPhoto();
         Emp _Emp = new Emp();
         int empPhotoID = 0;
         _Emp = context.Emps.First(aa => aa.EmpNo == _empNo);
         _empPhotoList = context.EmpPhotoes.Where(aa => aa.EmpID == _Emp.EmpID).ToList();
         _EmpPhoto.EmpPic = ConvertToBytes(file);
         if (_empPhotoList.Count > 0)
         {
             //Update Existing Image
             _EmpPhoto.EmpID = _empPhotoList.FirstOrDefault().EmpID;
             _EmpPhoto.PhotoID = _empPhotoList.FirstOrDefault().PhotoID;
         }
         else
         {
             //Add New Image
             _EmpPhoto.EmpID = _Emp.EmpID;
             context.EmpPhotoes.Add(_EmpPhoto);
         }
         try
         {
             empPhotoID = _EmpPhoto.PhotoID;
             context.SaveChanges();
             return empPhotoID;
         }
         catch (Exception ex)
         {
             return empPhotoID;
         }
     }
 }
开发者ID:qq5013,项目名称:WMS-Fatima,代码行数:35,代码来源:ImageConversion.cs


示例6: GetBestCriteria

        public ActionResult GetBestCriteria(string CriteriaValue)
        {
            List<DailySummary> BestCriteria = new List<DailySummary>();
            using (TAS2013Entities dc = new TAS2013Entities())
            {
                DateTime To = (DateTime)dc.DailySummaries.Max(x => x.Date);
                DateTime From = To.AddDays(-20);
                var GetSummaries = dc.DailySummaries.Where(aa => aa.Criteria == CriteriaValue && (aa.Date >= From && aa.Date <= To)).ToList();
                var DistinctCriterias = GetSummaries.Select(aa => new { aa.CriteriaValue }).Distinct().ToList();
                foreach (var distinctcriteria in DistinctCriterias)
                {
                    DailySummary gatherinfo = new DailySummary();

                    List<DailySummary> intermediate = GetSummaries.Where(aa => aa.CriteriaValue == distinctcriteria.CriteriaValue).ToList();
                    gatherinfo = InitializeDailySummaryValues(intermediate);

                    foreach (DailySummary inter in intermediate)
                    {
                        gatherinfo = AddValues(gatherinfo, inter);

                    }
                    BestCriteria.Add(gatherinfo);

                }
            }
            Console.Write(CriteriaValue);
            return Json(BestCriteria, JsonRequestBehavior.AllowGet);
        }
开发者ID:qq5013,项目名称:WMS-Fatima,代码行数:28,代码来源:GraphController.cs


示例7: LoadSession

        private void LoadSession()
        {
            using (TAS2013Entities dc = new TAS2013Entities())
            {
               var v = dc.Users.Where(aa => aa.UserName == "wms.ffl").FirstOrDefault();
                if (v != null)
                {
                    Session["MDevice"] = "0";
                    Session["MHR"] = "0";
                    Session["MDevice"] = "0";
                    Session["MLeave"] = "0";
                    Session["MEditAtt"] = "0";
                    Session["MUser"] = "0";
                    Session["LogedUserFullname"] = "";
                    Session["UserCompany"] = "";
                    Session["MRDailyAtt"] = "0";
                    Session["MRLeave"] = "0";
                    Session["MRMonthly"] = "0";
                    Session["MRAudit"] = "0";
                    Session["MRManualEditAtt"] = "0";
                    Session["MREmployee"] = "0";
                    Session["MRDetail"] = "0";
                    Session["MRSummary"] = "0";
                    Session["LogedUserID"] = v.UserID.ToString();
                    Session["LogedUserFullname"] = v.UserName;
                    Session["LoggedUser"] = v;
                    Session["UserCompany"] = v.CompanyID.ToString();
                    if (v.MHR == true)
                        Session["MHR"] = "1";
                    if (v.MDevice == true)
                        Session["MDevice"] = "1";
                    if (v.MLeave == true)
                        Session["MLeave"] = "1";
                    if (v.MEditAtt == true)
                        Session["MEditAtt"] = "1";
                    if (v.MUser == true)
                        Session["MUser"] = "1";
                    if (v.MRDailyAtt == true)
                        Session["MRDailyAtt"] = "1";
                    if (v.MRLeave == true)
                        Session["MRLeave"] = "1";
                    if (v.MRMonthly == true)
                        Session["MRMonthly"] = "1";
                    if (v.MRAudit == true)
                        Session["MRAudit"] = "1";
                    if (v.MRManualEditAtt == true)
                        Session["MRManualEditAtt"] = "1";
                    if (v.MREmployee == true)
                        Session["MREmployee"] = "1";
                    if (v.MRDetail == true)
                        Session["MRDetail"] = "1";
                    if (v.MRSummary == true)
                        Session["MRSummary"] = "1";
                    if (v.MRoster == true)
                        Session["MRoster"] = "1";

                }
            }
        }
开发者ID:qq5013,项目名称:WMS-Fatima,代码行数:59,代码来源:Global.asax.cs


示例8: MakeCustomizeQuery

        public string MakeCustomizeQuery(User _user)
        {
            string query = " where ";
            string subQuery = "";
            string subQueryLoc = "";
            List<string> _Criteria = new List<string>();
            List<string> _CriteriaForOr = new List<string>();
            List<string> _CriteriaForOrLoc = new List<string>();
               TAS2013Entities db = new TAS2013Entities();
            List<UserAccess> ulocs = new List<UserAccess>();
            ulocs = db.UserAccesses.Where(aa => aa.UserID == _user.UserID).ToList();
            foreach (var uloc in ulocs)
            {
                if(uloc.Criteria.Trim() == "Z")
                _CriteriaForOrLoc.Add(" ZoneID = " + uloc.CriteriaData + " ");
                if (uloc.Criteria.Trim() == "R")
                    _CriteriaForOrLoc.Add(" RegionID = " + uloc.CriteriaData + " ");
                if (uloc.Criteria.Trim() == "C")
                    _CriteriaForOrLoc.Add(" CityID = " + uloc.CriteriaData + " ");
                if (uloc.Criteria.Trim() == "L")
                    _CriteriaForOrLoc.Add(" LocID = " + uloc.CriteriaData + " ");
                if (uloc.Criteria.Trim() == "S")
                    query = "";
                if (uloc.Criteria.Trim() == "")
                {

                    query = "";
                return query;

                }
            }

            for (int i = 0; i < _CriteriaForOrLoc.Count - 1; i++)
            {
                subQueryLoc = subQueryLoc + _CriteriaForOrLoc[i] + " or ";
            }
            if(_CriteriaForOrLoc.Count>0)
            subQueryLoc = " ( " + subQueryLoc + _CriteriaForOrLoc[_CriteriaForOrLoc.Count - 1] + " ) ";

            //subQuery = " ( ";
            //for (int i = 0; i < _CriteriaForOr.Count - 1; i++)
            //{
            //    subQuery = subQuery + _CriteriaForOr[i] + " or ";
            //} if (_CriteriaForOr.Count > 0)
            //subQuery = subQuery + _CriteriaForOr[_CriteriaForOr.Count - 1];
            //subQuery = subQuery + " ) ";
            query = query + subQueryLoc;
            return query;
        }
开发者ID:ahsinanwar,项目名称:WMSNHA2016,代码行数:49,代码来源:QueryBuilder.cs


示例9: btnlogin_Click

        protected void btnlogin_Click(object sender, EventArgs e)
        {
            TAS2013Entities context = new TAS2013Entities();
            //lbError.Text = "";
            List<User> _User = context.Users.ToList();

            //Request.Cookies[user]
            if (tbUserName.Text != "" && tbPassword.Text != "")
            {
             foreach (var item in _User)
                {
                    if (item.UserName.ToUpper() == tbUserName.Text.ToUpper())
                    {
                        if (item.Password.ToUpper() == tbPassword.Text.ToUpper())
                        {
                            if (item.RoleID == 2 || item.RoleID == 3)
                            {
                                Response.Redirect("/WMS/Reports/ReportHome.aspx");
                                Session["RoleID"] = "Rpt";
                                //SaveAuditLogEntry(item.UserID, item.UserName);
                            }
                            else
                            {
                                Response.Redirect("~/Home");
                                if (item.RoleID == 4)
                                {
                                    Session["RoleID"] = "Entry";
                                }
                                //SaveAuditLogEntry(item.UserID, item.UserName);
                            }
                            if (item.RoleID == 5)
                            {
                                Session["RoleID"] = "Admin";
                            }
                        }
                        else
                        {
                            //lbError.Text = "*Password doesnot match";
                        }
                    }
                    else
                    {
                        //lbError.Text = "*Username is not valid";
                    }
                }
            }
        }
开发者ID:qq5013,项目名称:WMS-Fatima,代码行数:47,代码来源:LogIn.aspx.cs


示例10: AddHalfLeaveToAttData

        public void AddHalfLeaveToAttData(LvApplication lvappl)
        {
            DateTime datetime = new DateTime();
            datetime = lvappl.FromDate;
            string _EmpDate = lvappl.EmpID + datetime.Date.ToString("yyMMdd");
            using (var db = new TAS2013Entities())
            {
                if (db.AttProcesses.Where(aa => aa.ProcessDate == datetime).Count() > 0)
                {
                    AttData _EmpAttData = new AttData();
                    _EmpAttData = db.AttDatas.First(aa => aa.EmpDate == _EmpDate);
                    if (lvappl.LvType == "A")//Casual Leave
                        _EmpAttData.Remarks = _EmpAttData.Remarks+"[H-CL]";
                    if (lvappl.LvType == "B")//Anual Leave
                        _EmpAttData.Remarks = _EmpAttData.Remarks+"[H-AL]";
                    if (lvappl.LvType == "C")//Sick Leave
                        _EmpAttData.Remarks = _EmpAttData.Remarks+"[H-SL]";

                    if (_EmpAttData.Remarks.Contains("[Absent]"))
                        _EmpAttData.Remarks.Replace("[Abesnt]", "");
                    if (_EmpAttData.Remarks.Contains("[EO]"))
                        _EmpAttData.Remarks.Replace("[EO]", "-");
                    if (_EmpAttData.Remarks.Contains("[LI]"))
                        _EmpAttData.Remarks.Replace("[LI]", "");
                    _EmpAttData.StatusLeave = true;
                    if (lvappl.FirstHalf == true)
                    {
                        _EmpAttData.LateIn = 0;
                        _EmpAttData.StatusLI = false;
                    }
                    else
                    {
                        _EmpAttData.StatusEO = false;
                        _EmpAttData.EarlyOut = 0;
                    }
                    //_EmpAttData.statushl

                    db.SaveChanges();
                }
            }
        }
开发者ID:linkstatic12,项目名称:NHAWMS,代码行数:41,代码来源:LeaveController.cs


示例11: Create

        public ActionResult Create()
        {
            var _wings = new List<Division>();
            using (TAS2013Entities context = new TAS2013Entities())
            {
                _wings = context.Divisions.ToList();
            }

            ViewBag.CrewID = new SelectList(db.Crews.OrderBy(s => s.CrewName), "CrewID", "CrewName");
            ViewBag.DesigID = new SelectList(db.Designations.OrderBy(s => s.DesignationName), "DesignationID", "DesignationName");
            ViewBag.GradeID = new SelectList(db.Grades.OrderBy(s=>s.GradeName), "GradeID", "GradeName");
            ViewBag.JobID = new SelectList(db.JobTitles.OrderBy(s=>s.JobTitle1), "JobID", "JobTitle1");
            ViewBag.LocID = new SelectList(db.Locations.OrderBy(s=>s.LocName), "LocID", "LocName");
            ViewBag.SecID = new SelectList(db.Sections.OrderBy(s=>s.SectionName), "SectionID", "SectionName");
            ViewBag.ShiftID = new SelectList(db.Shifts.OrderBy(s=>s.ShiftName), "ShiftID", "ShiftName");
            ViewBag.TypeID = new SelectList(db.EmpTypes.OrderBy(s=>s.TypeName), "TypeID", "TypeName");
            ViewBag.EmpID = new SelectList(db.EmpFaces.OrderBy(s=>s.Face1), "EmpID", "Face1");
            ViewBag.EmpID = new SelectList(db.EmpFps.OrderBy(s=>s.Fp1), "EmpID", "Fp1");
            ViewBag.CatID = new SelectList(db.Categories.OrderBy(s=>s.CatName), "CatID", "CatName");
            ViewBag.DeptID = new SelectList(db.Departments.OrderBy(s=>s.DeptName), "DeptID", "DeptName");
            return View();
        }
开发者ID:ahsinanwar,项目名称:SingleCompany,代码行数:22,代码来源:EmpController.cs


示例12: GetCriteriaNames

        public ActionResult GetCriteriaNames(string Criteria)
        {
            List<CriteriaFoAngular> GetValueNames = new List<CriteriaFoAngular>();
            using (TAS2013Entities dc = new TAS2013Entities())
            {
                FiltersModel fm = Session["FiltersModel"] as FiltersModel;
                if (Criteria == "C")
                {
                    foreach (var company in fm.CompanyFilter)
                        GetValueNames.Add(new CriteriaFoAngular("" + company.ID, company.FilterName));

                }
                if (Criteria == "L")
                {
                    foreach (var location in fm.LocationFilter)
                        GetValueNames.Add(new CriteriaFoAngular("" + location.ID, location.FilterName));
                }
                if (Criteria == "S")
                {
                    foreach (var shift in fm.ShiftFilter)
                        GetValueNames.Add(new CriteriaFoAngular("" + shift.ID, shift.FilterName));
                }
                if (Criteria == "E")
                {
                    foreach (var section in fm.SectionFilter)
                        GetValueNames.Add(new CriteriaFoAngular("" + section.ID, section.FilterName));
                }
                if (Criteria == "D")
                {
                    foreach (var department in fm.DepartmentFilter)
                        GetValueNames.Add(new CriteriaFoAngular("" + department.ID, department.FilterName));
                }
                //var getSummaries = dc.DailySummaries.Where(aa => aa.Criteria == Criteria).Select(aa => new { aa.CriteriaValue, aa.CriteriaName }).Distinct().ToList();
                return Json(
                              GetValueNames.ToArray()

                         , JsonRequestBehavior.AllowGet);
            }
        }
开发者ID:qq5013,项目名称:WMS-Fatima,代码行数:39,代码来源:GraphController.cs


示例13: UploadImageInDataBase

        public int UploadImageInDataBase(HttpPostedFileBase file, Emp _Emp)
        {
            using (var context = new TAS2013Entities())
            {
                List<EmpPhoto> _empPhotoList = new List<EmpPhoto>();
                EmpPhoto _EmpPhoto = new EmpPhoto();
                int empPhotoID = 0;

                _empPhotoList = context.EmpPhotoes.Where(aa => aa.EmpID == _Emp.EmpID).ToList();
                _EmpPhoto.EmpPic = ConvertToBytes(file);
                if (_empPhotoList.Count > 0)
                {
                    _EmpPhoto.PhotoID = _empPhotoList.FirstOrDefault().PhotoID;
                    _empPhotoList.FirstOrDefault().EmpPic = _EmpPhoto.EmpPic;
                    context.EmpPhotoes.Attach(_empPhotoList.FirstOrDefault());
                    context.Entry(_empPhotoList.FirstOrDefault()).State = EntityState.Modified;
                    context.SaveChanges();

                }
                else
                {
                    //Add New Image
                    _EmpPhoto.EmpID = _Emp.EmpID;
                    context.EmpPhotoes.Add(_EmpPhoto);
                }
                try
                {

                    empPhotoID = _EmpPhoto.PhotoID;
                    context.SaveChanges();
                    return empPhotoID;
                }
                catch (Exception ex)
                {
                    return empPhotoID;
                }
            }
        }
开发者ID:ahsinanwar,项目名称:WMSNHA2016,代码行数:38,代码来源:ImageConversion.cs


示例14: QueryForShiftForLinq

 internal string QueryForShiftForLinq(User LoggedInUser)
 {
     TAS2013Entities db = new TAS2013Entities();
     List<UserLocation> ulocs = new List<UserLocation>();
     List<string> _CriteriaForOrLoc = new List<string>();
     ulocs = db.UserLocations.Where(aa => aa.UserID == LoggedInUser.UserID).ToList();
     string query = "";
     foreach (var uloc in ulocs)
     {
         _CriteriaForOrLoc.Add(" LocationID = " + uloc.LocationID + " ");
     }
     for (int i = 0; i < _CriteriaForOrLoc.Count - 1; i++)
     {
         query = query + _CriteriaForOrLoc[i] + " or ";
     }
     query = query + _CriteriaForOrLoc[_CriteriaForOrLoc.Count - 1];
     return query;
 }
开发者ID:ahsinanwar,项目名称:WMSNHA2016,代码行数:18,代码来源:QueryBuilder.cs


示例15: GetListForAttDepartmentsSummary

        /// <summary>
        ///  This function takes FiltersModel and an empty list of AttDeptSummary as input and 
        ///  gives a populated AttDeptSummary as output. If there is any dept selected in the filter
        ///  it will iterate through all the departments if there is no dept selected it will try to
        ///  find all the depts of the company.
        /// </summary>
        /// <param name="fm"> FiltersModel </param>
        /// <param name="attDeptList">Empty List of AttDeptSummary</param>
        /// <returns>Populated List of AttDeptSummary</returns>
        public List<AttDeptSummary> GetListForAttDepartmentsSummary(FiltersModel fm, string _dateFrom,string _dateTo)
        {
            List<AttDeptSummary> attDeptList = new List<AttDeptSummary>();
            TAS2013Entities db = new TAS2013Entities();
               //To get the query from the db
            QueryBuilder qb = new QueryBuilder();
            //Get the Department filters
            List<FiltersAttributes> departments = new List<FiltersAttributes>();

            departments = fm.DepartmentFilter;
            //if more then 0 it means some departments are selected now we iterate over them and see
            //how many employee does one dept has. The table empView is the most suitable db for this case.
            if (departments.Count > 0)
            {
            //do nothing still cater for it in future there might be a need
            }
            //if there is no department list in the filter then first get the company's department and then do the same as above.
            else
            {
            foreach (var comp in fm.CompanyFilter)
            {
            int compID = Convert.ToInt16(comp.ID);
            List<Department> depts = db.Departments.Where(aa => aa.CompanyID == compID).ToList();
            foreach (var dept in depts)
                departments.Add(new FiltersAttributes() { ID=dept.DeptID + "", FilterName=dept.DeptName });

            }
            }
            //NOw run the departments if they are from the department filter or from the company itself

            foreach (var dept in departments)
            {

            DataTable dt = qb.GetValuesfromDB("select * from EmpView where DeptID=" + dept.ID);
            List<EmpView> EmView = dt.ToList<EmpView>();

            //2015-01-24

            foreach (DateTime day in EachDay(Convert.ToDateTime(_dateFrom), Convert.ToDateTime(_dateTo)))
            {
                AttDeptSummary singleInstance = new AttDeptSummary();
                singleInstance.Department = dept.FilterName;
                singleInstance.TotalStrength = EmView.Count();
                singleInstance.Total = singleInstance.TotalStrength;
                singleInstance.Location = EmView.FirstOrDefault().LocName;
                singleInstance.Section = EmView.FirstOrDefault().SectionName;
                singleInstance.Company = EmView.FirstOrDefault().CompName;
                singleInstance.CardSwapped = 0;
                singleInstance.Absent = 0;
                singleInstance.OnLeave = 0;
                string dynamicQueryForEmps = GetDynamicQueryForEmps(EmView);
                string queryForCardSwapped = "select * from AttData where (TimeIn is not null AND AttDate = '" + day + "') AND ";
                string queryForAbsent = "select * from AttData where (StatusAB = 1 AND AttDate = '" + day + "') AND ";
                string queryOnLeave = "select * from AttData where (StatusHL = 1 OR StatusLeave =1  AND StatusSL=1 AND AttDate = '" + day + "') AND ";

                queryForCardSwapped = queryForCardSwapped + dynamicQueryForEmps;

                singleInstance.CardSwapped = qb.GetValuesfromDB(queryForCardSwapped).ToList<AttData>().Count();
                queryForAbsent = queryForAbsent + dynamicQueryForEmps;
                singleInstance.Absent = qb.GetValuesfromDB(queryForAbsent).ToList<AttData>().Count(); queryOnLeave = queryOnLeave + dynamicQueryForEmps;
                singleInstance.OnLeave = qb.GetValuesfromDB(queryOnLeave).ToList<AttData>().Count();

                //foreach (var emp in EmView)
                //{

                //s= singleInstance.CardSwapped + db.AttDatas.Where(aa => aa.TimeIn != null && aa.AttDate == day && aa.EmpID == emp.EmpID).Count();
                //singleInstance.Absent = singleInstance.Absent+ db.AttDatas.Where(aa => aa.StatusAB == true && aa.AttDate == day && aa.EmpID == emp.EmpID).Count();
                //singleInstance.OnLeave = singleInstance.OnLeave + db.AttDatas.Where(aa => (aa.StatusHL == true || aa.StatusLeave == true || aa.StatusSL == true) && aa.AttDate == day && aa.EmpID == emp.EmpID).Count();

                //}
                singleInstance.date = day;
                attDeptList.Add(singleInstance);
            }

            }
            return attDeptList;
        }
开发者ID:qq5013,项目名称:WMS-Fatima,代码行数:86,代码来源:HRReportsMaker.cs


示例16: QueryForEmployeeReports

        internal string QueryForEmployeeReports(User LoggedInUser)
        {
            string query = " where ";
            TAS2013Entities db = new TAS2013Entities();
            List<UserAccess> uAcc = new List<UserAccess>();
            uAcc = db.UserAccesses.Where(aa => aa.UserID == LoggedInUser.UserID).ToList();
            List<Region> regions = db.Regions.ToList();
            List<City> cities = db.Cities.ToList();
            List<Location> locs = db.Locations.ToList();
            List<string> queryList = new List<string>();
            foreach (var access in uAcc)
            {
                switch (LoggedInUser.RoleID)
                {
                    case 1://Super ADmin
                        query = "";
                        break;
                    case 4://Zone
                        queryList.Add(" ZoneID =" + access.CriteriaData.ToString());
                        break;
                    case 5://REgion
                        queryList.Add(" RegionID =" + access.CriteriaData.ToString());
                        break;
                    case 6://City

                        queryList.Add(" CityID =" + access.CriteriaData.ToString());
                        break;
                    case 7://Location
                        queryList.Add(" LocID =" + access.CriteriaData.ToString());
                        break;
                }
            }
            if (queryList.Count == 1)
            {
                query = query + queryList[0];
            }
            else if (queryList.Count > 1)
            {
                for (int i = 0; i < queryList.Count - 1; i++)
                {
                    query = query + queryList[i] + " or ";
                }
                query = query + queryList[queryList.Count - 1];
            }

            return query;
        }
开发者ID:ahsinanwar,项目名称:WMSNHA2016,代码行数:47,代码来源:QueryBuilder.cs


示例17: QueryForReportsCity

        internal string QueryForReportsCity(User LoggedInUser, string p)
        {
            string query = " where ";
            TAS2013Entities db = new TAS2013Entities();
            List<UserAccess> uAcc = new List<UserAccess>();
            uAcc = db.UserAccesses.Where(aa => aa.UserID == LoggedInUser.UserID).ToList();
            List<Region> regions = db.Regions.ToList();
            List<City> cities = db.Cities.ToList();
            List<Location> locs = db.Locations.ToList();
            List<string> queryList = new List<string>();
            foreach (var access in uAcc)
            {
                switch (LoggedInUser.RoleID)
                {
                    case 1://Super ADmin
                        query = "";
                        break;
                    case 4://Zone
                        List<City> city = db.Cities.Where(aa => aa.Region.ZoneID== access.CriteriaData).ToList();
                        foreach (var c in city)
                        {
                            queryList.Add(" CityID =" + c.CityID);
                        }

                        break;
                    case 5://REgion
                        city = db.Cities.Where(aa => aa.RegionID == access.CriteriaData).ToList();
                        foreach (var c in city)
                        {
                            queryList.Add(" CityID =" + c.CityID);
                        }
                        break;
                    case 6://City
                        string cityID = cities.Where(aa => aa.CityID == access.CriteriaData).FirstOrDefault().CityID.ToString();
                        queryList.Add(" CityID =" + cityID);
                        break;
                    case 7://Location
                        string cityIDForLoc = locs.Where(aa => aa.LocID == access.CriteriaData).FirstOrDefault().CityID.ToString();
                        queryList.Add(" CityID =" + cityIDForLoc);
                        break;
                }
            }
            if (queryList.Count == 1)
            {
                query = query + queryList[0];
            }
            else if (queryList.Count > 1)
            {
                for (int i = 0; i < queryList.Count - 1; i++)
                {
                    query = query + queryList[i] + " or ";
                }
                query = query + queryList[queryList.Count - 1];
            }

            return query;
        }
开发者ID:ahsinanwar,项目名称:WMSNHA2016,代码行数:57,代码来源:QueryBuilder.cs


示例18: QueryForLocationTableSegeration

 public string QueryForLocationTableSegeration(User _user)
 {
     TAS2013Entities db = new TAS2013Entities();
     List<UserLocation> ulocs = new List<UserLocation>();
     List<string> _CriteriaForOrLoc = new List<string>();
     ulocs = db.UserLocations.Where(aa => aa.UserID == _user.UserID).ToList();
     string query = " where ";
     foreach (var uloc in ulocs)
     {
         _CriteriaForOrLoc.Add(" LocID = " + uloc.LocationID + " ");
     }
     for (int i = 0; i < _CriteriaForOrLoc.Count - 1; i++)
     {
         query = query + _CriteriaForOrLoc[i] + " or ";
     }
     query = query + _CriteriaForOrLoc[_CriteriaForOrLoc.Count - 1];
     return query;
 }
开发者ID:ahsinanwar,项目名称:WMSNHA2016,代码行数:18,代码来源:QueryBuilder.cs


示例19: QueryForUserAccess

        public string QueryForUserAccess(User _User, string view)
        {
            string role="";
             string  query = "";
            using (var context = new TAS2013Entities())
                    {
                        role = context.UserRoles.Where(aa => aa.RoleID == _User.RoleID).FirstOrDefault().RoleName;
                    }

            switch (view)
            {
                case "Region":  query= UserAcccessGetRegion(_User,role);
                    return query;
                case "Zone": query = UserAcccessGetZone(_User, role);
                    return query;
                case "Location": query = UserAcccessGetLocation(_User, role);
                    return query;
                case "City": query = UserAccessGetCity(_User, role);
                    return query;
                case "SuperUser": query = "CompanyID >0";
                    return query;

            }
            return query;
        }
开发者ID:ahsinanwar,项目名称:WMSNHA2016,代码行数:25,代码来源:QueryBuilder.cs


示例20: MakeCustomizeQueryForUserAccess

        public string MakeCustomizeQueryForUserAccess(User _user)
        {
            TAS2013Entities db = new TAS2013Entities();
            string query = "where";
            List<UserAccess> uAcc = new List<UserAccess>();
            uAcc = db.UserAcc 

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Models.User类代码示例发布时间:2022-05-26
下一篇:
C# CustomClass.QueryBuilder类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap