Beispiel #1
0
        public bool AddOrUpdate(CompanyCustomerRateType companyCustomerRateType, WTCCeresEntities db)
        {
            bool isSaved = true;

            try
            {
                db.CompanyCustomerRateType.AddOrUpdate(companyCustomerRateType);
                db.SaveChanges();
            }
            catch (Exception e)
            {
                isSaved = false;
            }

            return(isSaved);
        }
Beispiel #2
0
        public bool UpdateCompanyCustomerRateType(int CompanyCustomerRateTypeId, int CompanyId, int CustomerRateTypeId)
        {
            bool isSaved = true;

            using (WTCCeresEntities db = new WTCCeresEntities())
            {
                try
                {
                    ccrt                    = db.CompanyCustomerRateType.Find(CompanyCustomerRateTypeId);
                    ccrt.CompanyId          = CompanyId;
                    ccrt.CustomerRateTypeId = CustomerRateTypeId;

                    db.CompanyCustomerRateType.AddOrUpdate(ccrt);
                    db.SaveChanges();
                }
                catch (Exception e)
                {
                    string message = e.Message;
                    isSaved = false;
                }
            }
            return(isSaved);
        }
Beispiel #3
0
        public void PopulateInfo(int companyId)
        {
            firstLoad = true;
            addrList.Clear();
            loadForm();
            using (var db = new WTCCeresEntities())
            {
                c       = CompanyService.GetById(companyId, db);
                cctList = CompanyCompanyTypeService.GetByCompanyId(companyId, db);
                for (int i = 0, loopTo = cblCompanyType.Items.Count - 1; i <= loopTo; i++)
                {
                    CompanyType isInCheckList = (CompanyType)cblCompanyType.Items[i];

                    bool typeExistsInList = cctList.Where(c => Operators.ConditionalCompareObjectEqual(c.CompanyTypeId, isInCheckList.CompanyTypeId, false)).Count() > 0;
                    if (typeExistsInList)
                    {
                        cblCompanyType.SetItemChecked(i, true);
                    }
                }

                cboCompanyCategory.SelectedValue = c.CompanyCategoryId;
                tbCode.Text      = c.CompanyCode;
                tbName.Text      = c.CompanyName;
                tbEmail.Text     = c.Email;
                tbWebsite.Text   = c.Website;
                tbAttention.Text = c.Attention;
                tbNotes.Text     = c.Notes;
                if (!Information.IsNothing(c.Rating))
                {
                    SetStarRate((int)c.Rating);
                }
                else
                {
                    SetStarRate(1);
                }

                addrList = CompanyAddressService.GetCompanyAddressByCompanyId(companyId, db);
                CompanyAddressBindingSource.DataSource = addrList;
                if (c.CompanyCategoryId != (int)MdlEnum.CompanyCategory.VENDOR)
                {
                    ccrt = CompanyCustomerRateTypeService.GetByCompanyId(companyId, db);
                    if (!Information.IsNothing(ccrt))
                    {
                        cboRateTier.SelectedValue = ccrt.CustomerRateTypeId;
                    }
                    else
                    {
                        ccrt                      = new CompanyCustomerRateType();
                        ccrt.CompanyId            = companyId;
                        cboRateTier.SelectedValue = 0;
                    }

                    isCustomer = true;
                    pnlRAteTier.Show();
                }
                else
                {
                    isCustomer = false;
                    pnlRAteTier.Hide();
                }
            }

            firstLoad = false;
        }
Beispiel #4
0
 public bool AddOrUpdate(CompanyCustomerRateType companyCustomerRateType, WTCCeresEntities db)
 {
     return(repository.AddOrUpdate(companyCustomerRateType, db));
 }