Beispiel #1
0
        public ClsCompany GetCompanyByCompanyId(long lgCompanyId)
        {
            ClsCompany objClsCompany = new ClsCompany();

            try
            {
                using (this.objDataContext = new CompanyDataContext(Functions.StrConnection))
                {
                    GetCompanyByIdResult item = this.objDataContext.GetCompanyById(lgCompanyId).FirstOrDefault();
                    if (item != null)
                    {
                        objClsCompany.lgId               = item.Id;
                        objClsCompany.strShortName       = item.ShortName;
                        objClsCompany.strFullName        = item.FullName;
                        objClsCompany.strAddress1        = item.Address1;
                        objClsCompany.strAddress2        = item.Address2;
                        objClsCompany.strAddress3        = item.Address3;
                        objClsCompany.intVat             = item.Vat;
                        objClsCompany.strEmail           = item.Email;
                        objClsCompany.strPerson          = item.Person;
                        objClsCompany.strContact         = item.Contact;
                        objClsCompany.strPhone           = item.Phone;
                        objClsCompany.hdnstrAdminUserIds = item.AdminUserIds;
                    }
                }
            }
            catch (Exception ex)
            {
                Functions.Write(ex, System.Reflection.MethodBase.GetCurrentMethod().Name, PageMaster.Company, mySession.Current.UserId);
            }

            return(objClsCompany);
        }
Beispiel #2
0
 public long SaveCompany(ClsCompany objSave)
 {
     try
     {
         using (this.objDataContext = new CompanyDataContext(Functions.StrConnection))
         {
             var result = this.objDataContext.InsertOrUpdateCompany(objSave.lgId, objSave.strShortName, objSave.strFullName, objSave.strAddress1, objSave.strAddress2, objSave.strAddress3, objSave.intVat, objSave.strEmail, objSave.strPerson, objSave.strContact, objSave.strPhone, objSave.strAdminUserIds, mySession.Current.UserId, PageMaster.Company).FirstOrDefault();
             if (result != null)
             {
                 return(result.InsertedId);
             }
             else
             {
                 return(0);
             }
         }
     }
     catch (Exception ex)
     {
         Functions.Write(ex, System.Reflection.MethodBase.GetCurrentMethod().Name, PageMaster.Company, mySession.Current.UserId);
         return(0);
     }
 }