//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 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";
        }
        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;
            }
        }
Beispiel #4
0
        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";
        }
Beispiel #5
0
        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);
        }
Beispiel #6
0
        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;
        }
Beispiel #7
0
        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;
        }