public JsonResult GetCustomerByIdOnLoad(string customerID) { if (customerID != "") { using (ISEEEntities context = new ISEEEntities()) { var result = _facory.GetCustomersByCustomerID(customerID).Select(x => new { CustomerId = x.CustomerId, CustomerNumber = x.CustomerNumber, FirstName = x.FirstName, LastName = x.LastName, AreaPhone1 = x.AreaPhone1 ?? "!@#$", Phone1 = x.Phone1 ?? "!@#$", Lat = x.Building.Lat, BuildingCode = x.BuildingCode, BuildingNumber = x.Building.Number ?? "!@#$", Long = x.Building.Long, ZipCode = x.Building.ZipCode, StreetName = x.Building.Street.StreetDesc ?? "!@#$", StreetId = x.Building.Street.StateCode, CityId = x.Building.Street.City.CityCode, CityName = x.Building.Street.City.CityDesc ?? "!@#$", StateName = x.Building.Street.City.State.StateDesc ?? "!@#$", StateId = x.Building.Street.City.State.StateCode }).ToList(); ; return new JsonResult { Data = result, JsonRequestBehavior = JsonRequestBehavior.AllowGet }; } } return new JsonResult { Data = null, JsonRequestBehavior = JsonRequestBehavior.AllowGet }; }
//Bind Second Classsification DDL public JsonResult BindSecondClassificationDdl(int id) { using (ISEEEntities dataContext = new ISEEEntities()) { var factoryLevel1list = dataContext.RequsetToFactoryLevel2.Where(d => d.RequestSysIdLevel1 == id).OrderBy(c => c.RequsetOrder).Select(x => new { x.RequestSysIdLevel2, x.RequestDescCodeLevel2 }).ToList(); return Json(factoryLevel1list, JsonRequestBehavior.AllowGet); } }
//Bind Main Classsification DDL public JsonResult BindClassificationDdl() { using (ISEEEntities dataContext = new ISEEEntities()) { var factoryLevel1list = dataContext.RequsetToFactoryLevel1.Where(d => d.Factory == SessionManagement.FactoryID).OrderBy(c => c.RequsetOrder).Select(x => new { x.RequestSysIdLevel1, x.RequestDescCodeLevel1, x.RequsetOrder, x.StatusCode, x.Factory }).ToList(); return Json(factoryLevel1list, JsonRequestBehavior.AllowGet); } }
// Country tab start public JsonResult GetAllCountrys() { using (ISEEEntities context = new ISEEEntities()) { var StateDec = _facory.GetAllcountries().ToList() .Select(x => new { CountryCode = x.CountryCode.ToString().Trim(), CountryDesc = (x.CountryDesc ?? string.Empty).ToString().Trim(), CurrentGmt = x.CurrentGmt, CountryDescEN = (x.CountryDescEn ?? string.Empty).ToString().Trim() }) .Distinct() .ToList(); return new JsonResult { Data = StateDec, JsonRequestBehavior = JsonRequestBehavior.AllowGet }; } }
public string UpdateCustomer(int customerID, string cNumber, string cCompanyName, string cContactName, string cFloor, string cApartment, string cMail, string cPhoneOne, string cPhone11, string cPhoneTwo, string cPhone22, string cFax, string cFax1, string cRemarks1, string cRemarks2, int cbuildingCode, string cbuildingNumber, string cZipCode, int cvisitInterval, string cEndDate, string cNextVisit, int cvisitTime, string cMobile, string cMobile1) { try { using (ISEEEntities context = new ISEEEntities()) { Customer customer = context.Customers.Where(x => x.CustomerId == customerID).FirstOrDefault(); customer.BuildingCode = cbuildingCode; customer.CustomerNumber = Common.Common.GetNullableValues(cNumber.Trim()); customer.LastName = Common.Common.GetNullableValues(cCompanyName.Trim()); customer.FirstName = Common.Common.GetNullableValues(cContactName.Trim()); customer.Floor = Common.Common.GetNullableValues(cFloor.Trim()); customer.Apartment = Common.Common.GetNullableValues(cApartment.Trim()); customer.AreaPhone1 = Common.Common.GetNullableValues(cPhoneOne.Trim()); customer.Phone1 = Common.Common.GetNullableValues(cPhone11.Trim()); customer.AreaPhone2 = Common.Common.GetNullableValues(cPhoneTwo.Trim()); customer.Phone2 = Common.Common.GetNullableValues(cPhone22.Trim()); customer.AreaFax = Common.Common.GetNullableValues(cFax.Trim()); customer.Fax = Common.Common.GetNullableValues(cFax1.Trim()); customer.Mail = Common.Common.GetNullableValues(cMail.Trim()); customer.CustomerRemark1 = Common.Common.GetNullableValues(cRemarks1.Trim()); customer.CustomerRemark2 = Common.Common.GetNullableValues(cRemarks2.Trim()); customer.EndDate = Common.Common.ConvertDateTime(cEndDate); customer.NextVisit = Common.Common.ConvertDateTime(cNextVisit); customer.VisitTime = cvisitTime; customer.VisitInterval = cvisitInterval; customer.Celolar = Common.Common.GetNullableValues(cMobile1); customer.AreaCelolar = Common.Common.GetNullableValues(cMobile); context.SaveChanges(); } } catch (Exception) { return "false"; } return "true"; }
//Save Classificion request public bool UpdateClassificationRequestCustomerByDate(int customerID, string requestDate, int level2, string request, string treatment, string treatmentDate, int requestSysIdLevel1, int requestSysIdLevel2,int sysId) { try { using (ISEEEntities context = new ISEEEntities()) { CustomerRequest customerRequest = context.CustomerRequests.Where(x => x.SysId == sysId).FirstOrDefault(); if (!string.IsNullOrEmpty(treatmentDate)) customerRequest.TreatmentDate = Convert.ToDateTime(treatmentDate); customerRequest.Treatment = treatment; customerRequest.Request = request; customerRequest.RequestSysIdLevel2 = level2; customerRequest.Status = 0; customerRequest.RequsetToFactoryLevel2.RequestSysIdLevel1 = requestSysIdLevel1; context.CustomerRequests.Add(customerRequest); context.SaveChanges(); return true; } } catch (Exception) { return false; } }
public bool SaveClassificationRequestCustomerByDate(int customerID, string requestDate, int level2, string request, string treatment, string treatmentDate) { try { using (ISEEEntities context = new ISEEEntities()) { CustomerRequest customerRequest = new CustomerRequest(); customerRequest.CreateDate = Convert.ToDateTime(requestDate); if (!string.IsNullOrEmpty(treatmentDate)) customerRequest.TreatmentDate = Convert.ToDateTime(treatmentDate); customerRequest.Treatment = treatment; customerRequest.Request = request; customerRequest.RequestSysIdLevel2 = level2; customerRequest.Status = 0; customerRequest.CustomerId = customerID; context.CustomerRequests.Add(customerRequest); context.SaveChanges(); return true; } } catch (Exception) { return false; } }
public JsonResult GetCurrentLogedUserCountery() { int FactoryId = SessionManagement.FactoryID; if (FactoryId > 0) { using (ISEEEntities context = new ISEEEntities()) { var CountryDetail = context.FactoryParms.Select(c => new { FactoryId = c.FactoryId, CountryID = c.Country, Lat = c.Lat, Long = c.Long, Zoom = c.Zoom, MapProvider=c.MapProvider }).Where(x => x.FactoryId == FactoryId).ToList(); return new JsonResult { Data = CountryDetail, JsonRequestBehavior = JsonRequestBehavior.AllowGet }; } } return new JsonResult { Data = null, JsonRequestBehavior = JsonRequestBehavior.AllowGet }; }
public JsonResult GetEmployeeByIdOnLoad(int employeeID) { if (employeeID > 0) { using (ISEEEntities context = new ISEEEntities()) { int factoryId = SessionManagement.FactoryID; var empData = _facory.GetEmployeeById(employeeID, factoryId).Select(x => new { EmployeeID = x.EmployeeId, Number = x.EmployeeNum, FirstName = x.FirstName == null ? "" : x.FirstName, LastName = x.LastName == null ? "" : x.LastName, }).ToList(); return new JsonResult { Data = empData, JsonRequestBehavior = JsonRequestBehavior.AllowGet }; } } return new JsonResult { Data = null, JsonRequestBehavior = JsonRequestBehavior.AllowGet }; }
public JsonResult UserLogin(LoginViewModel data) { try { using (ISEEEntities context = new ISEEEntities()) { var query = from f in context.Factories.ToList() join fp in context.FactoryParms on f.FactoryId equals fp.FactoryId join fd in context.FactoryDistances on f.FactoryId equals fd.FactoryId join country in context.Countries on fp.Country equals country.CountryCode where (String.Compare(f.UserName, data.UserName, StringComparison.OrdinalIgnoreCase) == 0) && (String.CompareOrdinal(f.Password, data.Password) == 0) select new { FactoryGuid = (Guid)f.FactoryKey, FactoryDesc = f.FactoryDesc, FactoryID = f.FactoryId, Country = fp.Country, CountryDesc = country.CountryDesc, StopEmployeeTime = (int)fp.StopEmployeeTime, SlipTime = fp.SplitTime, Lat = (double)fp.Lat, Long = (double)fp.Long, Zoom = (int)fp.Zoom, MapProvider = (int)fp.MapProvider, SmsProvider = (int)fp.SmsProvider, PhoneAreaCode = fp.PhoneAreaCode, CompanyLogo = fp.CompanyLogo, CurrentGmt = country.CurrentGmt, MapSearchModule = fd.MapSearchModule, RadiusSearch = fd.RadiusSearch, TopEmployeeSearch = fd.TopEmployeeSearch, ZoomSearchLevel = fd.ZoomSearchLevel, CalendarShowRadius = fd.CalendarShowRadius, CalenderShowZoomLevel = fd.CalenderShowZoomLevel, }; var loginData = query.ToList()[0]; SessionManagement.FactoryID = loginData.FactoryID; SessionManagement.FactoryDesc = loginData.FactoryDesc; SessionManagement.CountryDesc = loginData.CountryDesc; SessionManagement.FactoryID = loginData.FactoryID; SessionManagement.Country = loginData.Country; SessionManagement.CurrentGmt = loginData.CurrentGmt; SessionManagement.SmsProvider = loginData.SmsProvider; SessionManagement.PhoneAreaCode = loginData.PhoneAreaCode; SessionManagement.MapProvider = loginData.MapProvider; //SessionManegment.SessionManagement. = loginData.; //SessionManegment.SessionManagement. = loginData.; //SessionManegment.SessionManagement. = loginData.; //SessionManegment.SessionManagement. = loginData.; //SessionManegment.SessionManagement. = loginData.; var defaultLang = context.MainStringTables.ToList(); if (SessionManagement.Language.Contains("CL")) { SessionManagement.Sunday = defaultLang.Where(x => x.DefaultLanguage == "Sunday").Select(x => x.HE).FirstOrDefault(); SessionManagement.Monday = defaultLang.Where(x => x.DefaultLanguage == "Monday").Select(x => x.HE).FirstOrDefault(); SessionManagement.Tuesday = defaultLang.Where(x => x.DefaultLanguage == "Tuesday").Select(x => x.HE).FirstOrDefault(); SessionManagement.Wednesday = defaultLang.Where(x => x.DefaultLanguage == "Wednesday").Select(x => x.HE).FirstOrDefault(); SessionManagement.Thursday = defaultLang.Where(x => x.DefaultLanguage == "Thursday").Select(x => x.HE).FirstOrDefault(); SessionManagement.Friday = defaultLang.Where(x => x.DefaultLanguage == "Friday").Select(x => x.HE).FirstOrDefault(); SessionManagement.Saturday = defaultLang.Where(x => x.DefaultLanguage == "Saturday").Select(x => x.HE).FirstOrDefault(); //SessionManagement.Language } else if (SessionManagement.Language == "RU") { SessionManagement.Sunday = defaultLang.Where(x => x.DefaultLanguage == "Sunday").Select(x => x.RU).FirstOrDefault(); SessionManagement.Monday = defaultLang.Where(x => x.DefaultLanguage == "Monday").Select(x => x.RU).FirstOrDefault(); SessionManagement.Tuesday = defaultLang.Where(x => x.DefaultLanguage == "Tuesday").Select(x => x.RU).FirstOrDefault(); SessionManagement.Wednesday = defaultLang.Where(x => x.DefaultLanguage == "Wednesday").Select(x => x.RU).FirstOrDefault(); SessionManagement.Thursday = defaultLang.Where(x => x.DefaultLanguage == "Thursday").Select(x => x.RU).FirstOrDefault(); SessionManagement.Friday = defaultLang.Where(x => x.DefaultLanguage == "Friday").Select(x => x.RU).FirstOrDefault(); SessionManagement.Saturday = defaultLang.Where(x => x.DefaultLanguage == "Saturday").Select(x => x.RU).FirstOrDefault(); //SessionManagement.Language } else if (SessionManagement.Language.Contains("MX")) { SessionManagement.Sunday = defaultLang.Where(x => x.DefaultLanguage == "Sunday").Select(x => x.ES).FirstOrDefault(); SessionManagement.Monday = defaultLang.Where(x => x.DefaultLanguage == "Monday").Select(x => x.ES).FirstOrDefault(); SessionManagement.Tuesday = defaultLang.Where(x => x.DefaultLanguage == "Tuesday").Select(x => x.ES).FirstOrDefault(); SessionManagement.Wednesday = defaultLang.Where(x => x.DefaultLanguage == "Wednesday").Select(x => x.ES).FirstOrDefault(); SessionManagement.Thursday = defaultLang.Where(x => x.DefaultLanguage == "Thursday").Select(x => x.ES).FirstOrDefault(); SessionManagement.Friday = defaultLang.Where(x => x.DefaultLanguage == "Friday").Select(x => x.ES).FirstOrDefault(); SessionManagement.Saturday = defaultLang.Where(x => x.DefaultLanguage == "Saturday").Select(x => x.ES).FirstOrDefault(); //SessionManagement.Language } else if (SessionManagement.Language == "DE") { SessionManagement.Sunday = defaultLang.Where(x => x.DefaultLanguage == "Sunday").Select(x => x.DE).FirstOrDefault(); SessionManagement.Monday = defaultLang.Where(x => x.DefaultLanguage == "Monday").Select(x => x.DE).FirstOrDefault(); SessionManagement.Tuesday = defaultLang.Where(x => x.DefaultLanguage == "Tuesday").Select(x => x.DE).FirstOrDefault(); SessionManagement.Wednesday = defaultLang.Where(x => x.DefaultLanguage == "Wednesday").Select(x => x.DE).FirstOrDefault(); SessionManagement.Thursday = defaultLang.Where(x => x.DefaultLanguage == "Thursday").Select(x => x.DE).FirstOrDefault(); SessionManagement.Friday = defaultLang.Where(x => x.DefaultLanguage == "Friday").Select(x => x.DE).FirstOrDefault(); SessionManagement.Saturday = defaultLang.Where(x => x.DefaultLanguage == "Saturday").Select(x => x.DE).FirstOrDefault(); //SessionManagement.Language } else { SessionManagement.Sunday = defaultLang.Where(x => x.DefaultLanguage == "Sunday").Select(x => x.EN).FirstOrDefault(); SessionManagement.Monday = defaultLang.Where(x => x.DefaultLanguage == "Monday").Select(x => x.EN).FirstOrDefault(); SessionManagement.Tuesday = defaultLang.Where(x => x.DefaultLanguage == "Tuesday").Select(x => x.EN).FirstOrDefault(); SessionManagement.Wednesday = defaultLang.Where(x => x.DefaultLanguage == "Wednesday").Select(x => x.EN).FirstOrDefault(); SessionManagement.Thursday = defaultLang.Where(x => x.DefaultLanguage == "Thursday").Select(x => x.EN).FirstOrDefault(); SessionManagement.Friday = defaultLang.Where(x => x.DefaultLanguage == "Friday").Select(x => x.EN).FirstOrDefault(); SessionManagement.Saturday = defaultLang.Where(x => x.DefaultLanguage == "Saturday").Select(x => x.EN).FirstOrDefault(); //SessionManagement.Language } } } catch (Exception) { throw; } //using (ISEEEntities context = new ISEEEntities()) //{ // var user = context.Factories.Where(d => d.UserName == data.UserName && d.Password == data.Password).Select(x => x.FactoryId).FirstOrDefault(); //} return new JsonResult { Data = 1, JsonRequestBehavior = JsonRequestBehavior.AllowGet }; }
public string UpdateEmployee(int employeeId, string number, string mail, string firstName, string lastName, string phone1, string phone11, string phone2, string phone22, string Start, int manufacture, int phoneType, string end, string hourlyData) { var mainData = Newtonsoft.Json.JsonConvert.DeserializeObject<List<ISEEDataModel.Repository.employeeHours>>(hourlyData); int days = 0; try { foreach (var item in mainData) { days = Int32.Parse(item.Day); using (ISEEEntities db = new ISEEEntities()) { ISEEDataModel.Repository.EmployeeDiaryTemplate factoryDairyTemplet = db.EmployeeDiaryTemplates.Where(x => x.EmployeeId == employeeId && x.DayStatus == days).FirstOrDefault(); if (factoryDairyTemplet != null) { factoryDairyTemplet.Start1 = Common.GetTimeSpan(item.Start1); factoryDairyTemplet.Stop1 = Common.GetTimeSpan(item.End1); factoryDairyTemplet.Start2 = Common.GetTimeSpan(item.Start2); factoryDairyTemplet.Stop2 = Common.GetTimeSpan(item.End2); db.SaveChanges(); } } } using (ISEEEntities db = new ISEEEntities()) { Employee employee = db.Employees.Where(x => x.EmployeeId == employeeId).FirstOrDefault(); if (employee != null) { employee.EmployeeNum = number; employee.Mail = mail.Trim(); employee.FirstName = firstName.Trim(); employee.LastName = lastName.Trim(); employee.MainAreaPhone = phone1.Trim(); employee.MainPhone = phone11.Trim(); employee.SecondAreaPhone = phone2.Trim(); employee.SecondPhone = phone22.Trim(); employee.PhoneManufactory = manufacture; employee.PhoneType = phoneType; if (!string.IsNullOrEmpty(Start)) employee.StartDay = Common.ConvertDateTime(Start); if (!string.IsNullOrEmpty(end)) employee.EndDay = Common.ConvertDateTime(end); else employee.EndDay = null; db.SaveChanges(); } } } catch (Exception) { return "false"; } return "true"; }
public string SendSMSClickatell(int empID, string _strMsg, string _phone, string _PhoneAreaCode, double CurrentGmt) { string result = "1"; if (_strMsg.Length < 70) // is limited to 70 characters per message(Clickatell) for unicode { // string phone = _PhoneAreaCode + _phone; //972545500378 string phone = _PhoneAreaCode + "505774499"; WebClient client = new WebClient(); // Add a user agent header in case the requested URI contains a query. client.Headers.Add("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; .NET CLR 1.0.3705;)"); client.QueryString.Add("user", "Dshabi"); client.QueryString.Add("password", "shabi101827"); client.QueryString.Add("api_id", "3349639"); client.QueryString.Add("to", phone); client.QueryString.Add("from", "regionSEE"); client.QueryString.Add("text", ToUnicode(_strMsg)); client.QueryString.Add("unicode", "1"); string baseurl = "http://api.clickatell.com/http/sendmsg"; Stream data = client.OpenRead(baseurl); StreamReader reader = new StreamReader(data); string s = reader.ReadToEnd(); data.Close(); reader.Close(); } else result = "-1"; //add and save row to DB EmployeeSmsSend emp_sms = new EmployeeSmsSend(); emp_sms.EmployeeId = empID; emp_sms.SmsCreatDate = DateTime.Now.AddHours(CurrentGmt); emp_sms.SmsMsg = _strMsg; emp_sms.SmsCount = 1; emp_sms.SmsStatus = Convert.ToInt32(result); using (ISEEEntities context = new ISEEEntities()) { context.EmployeeSmsSends.Add(emp_sms); context.SaveChanges(); } return (result); }
public string SendSms(string _strMsg, string phoneNumber, int employeeId) { string sss = SessionManagement.PhoneAreaCode; // string _strMsg = ""; string UserName = "******"; string Password = "******"; string msg = System.Security.SecurityElement.Escape(_strMsg); string senderName = "regionSEE"; string senderNumber = "5632455"; //set phone numbers "0545500378;0545500379;" string phonesList = SessionManagement.PhoneAreaCode + "0505774499"; //create XML StringBuilder cbXml = new StringBuilder(); cbXml.Append("<Inforu>"); cbXml.Append("<User>"); cbXml.Append("<Username>" + UserName + "</Username>"); cbXml.Append("<Password>" + Password + "</Password>"); cbXml.Append("</User>"); cbXml.Append("<Content Type=\"sms\">"); cbXml.Append("<Message>" + msg + "</Message>"); cbXml.Append("</Content>"); cbXml.Append("<Recipients>"); cbXml.Append("<PhoneNumber>" + phonesList + "</PhoneNumber>"); cbXml.Append("</Recipients>"); cbXml.Append("<Settings>"); cbXml.Append("<SenderName>" + senderName + "</SenderName>"); cbXml.Append("<SenderNumber>" + senderNumber + "</SenderNumber>"); cbXml.Append("</Settings>"); cbXml.Append("</Inforu>"); string strXML = HttpUtility.UrlEncode(cbXml.ToString(), System.Text.Encoding.UTF8); string result = PostDataToURL("http://api.inforu.co.il/SendMessageXml.ashx", "InforuXML=" + strXML); //one time get result empty(check )!!!!!! int Status = 1; if (!string.IsNullOrEmpty(result)) { XmlDocument xmlRez = new XmlDocument(); xmlRez.LoadXml(result); XmlNode xnNote = xmlRez.SelectSingleNode("Result"); Status = Convert.ToInt32(xnNote["Status"].InnerText); } //add and save row to DB EmployeeSmsSend emp_sms = new EmployeeSmsSend(); emp_sms.EmployeeId = employeeId; emp_sms.SmsCreatDate = DateTime.Now.AddHours(SessionManagement.CurrentGmt); emp_sms.SmsMsg = _strMsg; emp_sms.SmsCount = 1; emp_sms.SmsStatus = Convert.ToInt32(Status); using (ISEEEntities context = new ISEEEntities()) { context.EmployeeSmsSends.Add(emp_sms); context.SaveChanges(); } //this.ObjectContext.EmployeeSmsSend.AddObject(emp_sms); //this.ObjectContext.SaveChanges(); return result; }
public string SenderSMSMexico(int empID, string _strMsg, string _phone, double CurrentGmt) { // string strXML1 = "Appname=Port2SMS&prgname=HTTP_SimpleSMS1&AccountID=1037&UserID=10130&UserPass=1037&Phone=0506447976&Text=Test"; string strXML = "Appname=Port2SMS&prgname=HTTP_SimpleSMS1&AccountID=1037&UserID=10130&UserPass=1037&Phone=" + _phone + "&Text=" + _strMsg; string result = PostDataToURL("http://ign-sms.com/Scripts/mgrqispi.dll?", strXML); ////one time get result empty(check )!!!!!! int Status; if (result.Contains("OK")) Status = 1; else Status = -1; //add and save row to DB EmployeeSmsSend emp_sms = new EmployeeSmsSend(); emp_sms.EmployeeId = empID; emp_sms.SmsCreatDate = DateTime.Now.AddHours(CurrentGmt); emp_sms.SmsMsg = _strMsg; emp_sms.SmsCount = 1; emp_sms.SmsStatus = Convert.ToInt32(Status); using (ISEEEntities context = new ISEEEntities()) { context.EmployeeSmsSends.Add(emp_sms); context.SaveChanges(); } return result; }
public List<GoogleAddressPartsToDB> LoadCountryGoogleProps(int countryCode) { List<GoogleAddressPartsToDB> lresult = new List<GoogleAddressPartsToDB>(); using (var context = new ISEEEntities()) { var v = from c in context.GeocodeToTables join s in context.GeocodeStringResponses on c.GeocodeTagResponse equals s.GeocodeStringResponsePk where c.CountryCode == countryCode select new GoogleAddressPartsToDB() { CountryId = c.CountryCode, PartId = c.AddressTypeTable, GooglePartName = s.GeocodeTagResponse, OrderToShow = c.OrderGeocodeTagResponse, Insert = c.Insert }; lresult = v.ToList(); } return lresult; }
public JsonResult GetCountries() { using (ISEEEntities context = new ISEEEntities()) { var ret = context.LanguageLists.Select(d => d.LanguageNickname).Distinct().ToList(); var selectedImageUrl = string.Format("/images/img/{0}.png", SessionManagement.Language.Trim().ToLower()); var result = ret.Select(c => new { LanguageNickname = c.Trim(), ImageUrl = string.Format("/images/img/{0}.png", c.Trim().ToLower()) }).ToList(); return Json(new { CountryList = result, SelectedCountry = SessionManagement.Language, SelectedCountryImageUrl = selectedImageUrl }, JsonRequestBehavior.AllowGet); } }
// Bind Visiting Data public JsonResult GetEmployeesToCustomerFilter(int customerID, string dtFrom, string dtTo) { using (ISEEEntities context = new ISEEEntities()) { DateTime from = Convert.ToDateTime(dtFrom); DateTime to = Convert.ToDateTime(dtTo); var gpsEmployeeCustomer = context.GpsEmployeeCustomers.Include("Employee").Where( x => x.CustomerId == customerID && x.VisiteDate >= from && x.VisiteDate <= to).OrderByDescending(x => x.VisiteDate).ToList().Select(x => new { EmployeeNum = x.Employee.EmployeeNum, CreateDate = x.VisiteDate.ToShortDateString(), Time = x.VisitTime.ToString(), FirstName = x.Employee.FirstName, LastName = x.Employee.LastName, EmployeeId = x.EmployeeId, InsertStatus = x.InsertStatus }).ToList(); return Json(gpsEmployeeCustomer, JsonRequestBehavior.AllowGet); //.Select(x => new { x.CreateDate, x.CustomerId, x.Employee.FirstName, x.Employee.LastName, x.InsertStatus, x.Employee.EmployeeId, x.SysId, x.VisitTime, x.VisiteDate }) } }
//Bind Request Data public JsonResult GetRequestCustomerByDate(int customerID, int fromyear, string from, string to, int level1, int level2) { var fromdate = Convert.ToDateTime(from); var todate = Convert.ToDateTime(to).AddDays(1).AddMilliseconds(-1); //var customerID = this.ObjectContext.Customer.FirstOrDefault(x => x.CustomerKey == CustomerGuidID).CustomerId; using (ISEEEntities context = new ISEEEntities()) { var customerRequest1 = context.CustomerRequests.Include("RequsetToFactoryLevel2").Include("RequsetToFactoryLevel2.RequsetToFactoryLevel1").Where(x => x.CustomerId == customerID && x.RequsetToFactoryLevel2.RequestSysIdLevel1 == (level1 == -1 ? x.RequsetToFactoryLevel2.RequestSysIdLevel1 : level1) && x.RequestSysIdLevel2 == (level2 == -1 ? x.RequestSysIdLevel2 : level2) && (x.CreateDate >= fromdate && x.CreateDate < todate)).ToList().Select(x => new { RequestDescCodeLevel1= x.RequsetToFactoryLevel2.RequsetToFactoryLevel1.RequestDescCodeLevel1, RequestDescCodeLevel2 = x.RequsetToFactoryLevel2.RequestDescCodeLevel2, CreateDate = x.CreateDate.Date.ToString("dd/MM/yyyy"), Treatment = x.Treatment, TreatmentDate = x.TreatmentDate.ToString(), Request = x.Request, RequestSysIdLevel1 = x.RequsetToFactoryLevel2.RequestSysIdLevel1, RequestSysIdLevel2 = x.RequsetToFactoryLevel2.RequestSysIdLevel2, customerRequestId = x.SysId }).ToList(); return Json(customerRequest1, JsonRequestBehavior.AllowGet); } }
public JsonResult GetAllStatesByCountry() { using (ISEEEntities context = new ISEEEntities()) { var CountryID = SessionManagement.Country; var StateDec = _facory.GetAllStates(CountryID).ToList() .Select(x => new { StateCode = x.StateCode.ToString().Trim(), StateDesc = (x.StateDesc ?? string.Empty).ToString().Trim() }) .Distinct() .ToList(); return new JsonResult { Data = StateDec, JsonRequestBehavior = JsonRequestBehavior.AllowGet }; } }