Ejemplo n.º 1
0
        /// Function Header*******************************************************
        /// Function Name: SaveCompanyDetails
        /// Function Type: Function
        /// Functionality: used to save the details of company
        /// Input: 
        /// Output: 
        /// Return Value:
        /// Note: 
        /// *********************************************************************
        public int SaveCompanyDetails(Entity.CompanyInfo oCompanyInfo)
        {
            using (TLWDALDataContext _db = new TLWDALDataContext())
            {
                int intRetVal = 1;
                /* var _varUserDuplicate = _db.aspnet_Users.Where(x => x.LoweredUserName.Equals(oCompanyInfo.StrCompanyEmail.ToLower())).SingleOrDefault();
                 if (_varUserDuplicate != null)
                 {
                     intRetVal = -1;
                     _varUserDuplicate = null;
                 }
                 else
                 {
                     var _varCompDuplicate = _db.CompanyInfos.Where(x => x.strCompanyEmail.ToLower().Equals(oCompanyInfo.StrCompanyEmail.ToLower())).SingleOrDefault();
                     if (_varCompDuplicate != null)
                     {
                         intRetVal = -1;
                         _varCompDuplicate = null;
                     }
                 }

                 if (intRetVal.Equals(0))
                 {*/
                DAL.CompanyInfo oCompanyInfoDAL = new DAL.CompanyInfo();
                oCompanyInfoDAL.strCompanyEmail = oCompanyInfo.StrCompanyEmail;
                oCompanyInfoDAL.strPassword = oCompanyInfo.StrPassword;
                oCompanyInfoDAL.strCompanyName = oCompanyInfo.StrCompanyName;
                oCompanyInfoDAL.strCompanyPhone = oCompanyInfo.StrCompanyPhone;
                oCompanyInfoDAL.strCompanyFax = oCompanyInfo.StrCompanyFax;
                oCompanyInfoDAL.intCountryId = oCompanyInfo.IntCountryId;
                oCompanyInfoDAL.intStateId = oCompanyInfo.IntStateId;
                oCompanyInfoDAL.strStateText = oCompanyInfo.StrStateName;

                // David K. Bowers 04/10/12 added in zip code
                oCompanyInfoDAL.strZipCode = oCompanyInfo.StrZipCode;
                // David K. Bowers 04/09/12 fixed a bug where company address was not getting stored in DB
                oCompanyInfoDAL.strCompanyAddress = oCompanyInfo.StrCompanyAddress;
                oCompanyInfoDAL.strCity = oCompanyInfo.StrCity;
                oCompanyInfoDAL.chrIsPaid = oCompanyInfo.ChrIsPaid;
                oCompanyInfoDAL.chrIsActive = oCompanyInfo.ChrIsActive;
                oCompanyInfoDAL.dtCreatedDate = oCompanyInfo.DtCreatedDate;
                oCompanyInfoDAL.dtModifiedDate = oCompanyInfo.DtModifiedDate;
                oCompanyInfoDAL.chrIsDeleted = oCompanyInfo.ChrIsDeleted;
                oCompanyInfoDAL.chrCreatedBy = oCompanyInfo.ChrCreatedBy;
                oCompanyInfoDAL.chrIsApproved = oCompanyInfo.ChrIsApproved;
                _db.CompanyInfos.InsertOnSubmit(oCompanyInfoDAL);
                _db.SubmitChanges();
                _db.ms_UpdateUserINRoles(oCompanyInfoDAL.strCompanyEmail);
                intRetVal = oCompanyInfoDAL.intCompanyId;
                oCompanyInfoDAL = null;
                /* }*/

                return intRetVal;
            }
        }