Beispiel #1
0
        public void UpdateCompanyInfo()
        {
            if (!string.IsNullOrEmpty(CompanyName))
            {
                string FormattedSpclChPhone = string.Empty;
                String numbersOnlyPhone     = string.Empty;
                string FormattedSpclChFax   = string.Empty;
                String numbersOnlyFax       = string.Empty;
                if (Phone.Length > 0 && Phone != null)
                {
                    FormattedSpclChPhone = fnRemoveSplChars(Phone);
                    numbersOnlyPhone     = Regex.Replace(FormattedSpclChPhone, @"[^\d]", String.Empty);
                }

                if (Fax.Length > 0 & Fax != null)
                {
                    FormattedSpclChFax = fnRemoveSplChars(Fax);
                    numbersOnlyFax     = Regex.Replace(FormattedSpclChFax, @"[^\d]", String.Empty);
                }
                UserApplicationConstantsProp userapp = new UserApplicationConstantsProp();
                userapp.CompanyName     = CompanyName;
                userapp.AddressLine1    = AddressLine1;
                userapp.AddressLine2    = AddressLine2;
                userapp.CitySep         = City;
                userapp.State           = State;
                userapp.Zip             = Zip;
                userapp.Phone           = numbersOnlyPhone;
                userapp.FaxNumber       = numbersOnlyFax;
                userapp.SystemName      = SystemName;
                userapp.NextOrderNumber = NextOrderNumber;
                userapp.UpdatedBy       = Application.Current.Properties["LoggedInUserName"].ToString();
                userapp.UpdatedDate     = DateTime.Now;
                userapp.UserCode        = Application.Current.Properties["LoggedInUserName"].ToString();

                bool isSuccessful = _serviceInstance.UpdateCompanyInfo(userapp);

                if (isSuccessful)
                {
                    MessageBox.Show(Resources.msgUpdatedSuccessfully);
                    AcceptChanges();
                }
                else
                {
                    MessageBox.Show(Resources.ErrorToUpdate);
                }
            }
            else
            {
                MessageBox.Show(Resources.ReqCompanyName);
            }
        }
Beispiel #2
0
 /// <summary>
 /// For updating compnay information
 /// </summary>
 /// <param name="userCode"></param>
 /// <returns></returns>
 public bool UpdateCompanyInfo(UserApplicationConstantsProp objCompanyinfo)
 {
     CommonDAL.logger.LogInfo(typeof(string), string.Format(CultureInfo.InvariantCulture, "Called {2} function ::{0} {1}.", DateTime.Now.ToShortDateString(), DateTime.Now.ToShortTimeString(), MethodBase.GetCurrentMethod().Name));
     try
     {
         return(objPortStorageReportDAL.UpdateCompanyInfo(objCompanyinfo));
     }
     catch (Exception)
     {
         throw;
     }
     finally
     {
         CommonDAL.logger.LogInfo(typeof(string), string.Format(CultureInfo.InvariantCulture, "End {2} function ::{0} {1}.", DateTime.Now.ToShortDateString(), DateTime.Now.ToShortTimeString(), MethodBase.GetCurrentMethod().Name));
     }
 }
        /// <summary>
        /// For updating compnay information
        /// </summary>
        /// <param name="userCode"></param>
        /// <returns></returns>
        public bool UpdateCompanyInfo(UserApplicationConstantsProp objCompanyinfo)
        {
            try
            {
                using (PortStorageEntities psEntities = new PortStorageEntities())
                {
                    CommonDAL.logger.LogInfo(typeof(string), string.Format(CultureInfo.InvariantCulture, "Called {2} function ::{0} {1}.", DateTime.Now.ToShortDateString(), DateTime.Now.ToShortTimeString(), MethodBase.GetCurrentMethod().Name));

                    bool isSuccessfull = false;
                    // ApplicationConstant customer = psEntities.ApplicationConstants.Where(x => x.usercode == objcustomer.CustomerID).FirstOrDefault();
                    ApplicationConstant companyinfo = psEntities.ApplicationConstants.FirstOrDefault();
                    if (companyinfo != null)
                    {
                        companyinfo.CompanyName     = objCompanyinfo.CompanyName;
                        companyinfo.AddressLine1    = objCompanyinfo.AddressLine1;
                        companyinfo.AddressLine2    = objCompanyinfo.AddressLine2;
                        companyinfo.City            = objCompanyinfo.CitySep;
                        companyinfo.Phone           = objCompanyinfo.Phone;
                        companyinfo.State           = objCompanyinfo.State;
                        companyinfo.Zip             = objCompanyinfo.Zip;
                        companyinfo.FaxNumber       = objCompanyinfo.FaxNumber;
                        companyinfo.SystemName      = objCompanyinfo.SystemName;
                        companyinfo.NextOrderNumber = objCompanyinfo.NextOrderNumber;
                        companyinfo.UpdatedDate     = objCompanyinfo.UpdatedDate;
                        companyinfo.UpdatedBy       = objCompanyinfo.UpdatedBy;
                        psEntities.SaveChanges();
                        isSuccessfull = true;
                    }
                    return(isSuccessfull);
                }
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                CommonDAL.logger.LogInfo(typeof(string), string.Format(CultureInfo.InvariantCulture, "End {2} function ::{0} {1}.", DateTime.Now.ToShortDateString(), DateTime.Now.ToShortTimeString(), MethodBase.GetCurrentMethod().Name));
            }
        }