public Result PostCompanyCreateEdit(COMPANY company, string userName, string loginID, string emailID, string mobile, string gender, string password, HttpPostedFileBase company_logo)
        {
            try
            {
                int userID = SessionUtil.GetUserID();
                if (company.CompanyId > 0)
                {
                    var tempCompanyId = SessionUtil.GetCompanyID();

                    COMPANY data = new COMPANY();
                    data                = db.COMPANies.Find(company.CompanyId);
                    data.CompanyName    = company.CompanyName;
                    data.ContactNumber  = company.ContactNumber;
                    data.CityId         = company.CityId;
                    data.GSTN           = company.GSTN;
                    data.CTSNumber      = company.CTSNumber;
                    data.CompanyAddress = company.CompanyAddress;
                    data.ContactPerson  = company.ContactPerson;
                    data.EmailId        = company.EmailId;
                    data.PAN            = company.PAN;
                    data.LogoImage      = company_logo != null ? company.LogoImage : data.LogoImage;
                    data.IsActive       = company.IsActive;

                    int sessionComId = (Int32)SessionUtil.GetCompanyID();

                    db.Entry(data).State = System.Data.Entity.EntityState.Modified;

                    BaseUtil.SetSessionValue(UserInfo.CompanyID.ToString(), company.CompanyId.ToString());

                    db.SaveChanges();

                    BaseUtil.SetSessionValue(UserInfo.CompanyID.ToString(), sessionComId.ToString());
                    result.Message = string.Format(BaseConst.MSG_SUCCESS_UPDATE, "Company");
                    result.Id      = company.CompanyId;
                }
                else
                {
                    db.COMPANies.Add(company);
                    db.SaveChanges();
                    result.Message     = string.Format(BaseConst.MSG_SUCCESS_CREATE, "Company");
                    result.MessageType = MessageType.Success;
                    result.Id          = company.CompanyId;
                }
            }
            catch (Exception ex)
            {
                result.MessageType = MessageType.Error;
                result.Message     = ex.Message;
            }
            return(result);
        }
        public CompanyUser GetCompanyData(string id)
        {
            int         companyID       = Convert.ToInt32(id);
            CompanyUser companyUserData = new CompanyUser();
            COMPANY     company         = db.COMPANies.Find(companyID);

            companyUserData.company_id = company.CompanyId;
            companyUserData.is_active  = company.IsActive;

            USER user = db.USERs.Where(x => x.CompanyId == companyID).FirstOrDefault();

            companyUserData.user_name = user.FirstName;
            companyUserData.login_id  = user.LoginId;
            companyUserData.password  = Convert.ToString(user.Password);
            companyUserData.mobile    = user.Mobile;
            companyUserData.email_id  = user.EmailId;
            return(companyUserData);
        }
        public IList <COMPANY> CompanyList()
        {
            int             userID = 0, companyID = 0;
            IList <COMPANY> companyList = new List <COMPANY>();

            try
            {
                COMPANY companyCountRecord = new COMPANY();

                foreach (var item in db.COMPANies.Where(x => x.IsActive))
                {
                    companyCountRecord           = new COMPANY();
                    companyCountRecord.IsActive  = item.IsActive;
                    companyCountRecord.CompanyId = item.CompanyId;
                    companyList.Add(companyCountRecord);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(companyList);
        }