Example #1
0
        public bool AddOrUpdate(CompanyCompanyType companyCompanyType, WTCCeresEntities db)
        {
            bool isSaved = true;

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

            return(isSaved);
        }
Example #2
0
        public bool Delete(int CompanyCompanyTypeId)
        {
            bool isSaved = true;

            using (WTCCeresEntities db = new WTCCeresEntities())
            {
                try
                {
                    CompanyCompanyType cct = db.CompanyCompanyType.Find(CompanyCompanyTypeId);
                    db.CompanyCompanyType.Remove(cct);
                    db.SaveChanges();
                }
                catch (Exception e)
                {
                    isSaved = false;
                }
            }

            return(isSaved);
        }
Example #3
0
        private void cblCompanyType_CheckedChanged(object sender, ItemCheckEventArgs e)
        {
            object hasEdi;

            hasEdi = false;
            var ct = new CompanyType();

            ct = (CompanyType)cblCompanyType.Items[e.Index];
            if (e.NewValue == CheckState.Checked)
            {
                if (cblCompanyType.Items[e.Index].Equals("Steamship Line"))
                {
                    hasEdi = true;
                }

                bool hasThisCompany = cctList.Where(ctt => ctt.CompanyTypeId == ct.CompanyTypeId).Count() > 0;
                if (!hasThisCompany && !firstLoad)
                {
                    var selectedCt = new CompanyCompanyType();
                    cctList.Add(selectedCt);
                }
            }
            else
            {
                var toDelete = cctList.Where(ctt => ctt.CompanyTypeId == ct.CompanyTypeId).ToList();
                if (toDelete.Count > 0 && !firstLoad)
                {
                    bool isDeleted = cctService.Delete(toDelete[0].CompanyCompanyTypeId);
                }
            }

            if (Conversions.ToBoolean(hasEdi))
            {
                ediPanel.Show();
            }
            else
            {
                ediPanel.Hide();
            }
        }
Example #4
0
 public bool AddOrUpdate(CompanyCompanyType companyCompanyType, WTCCeresEntities db)
 {
     return(repository.AddOrUpdate(companyCompanyType, db));
 }