Esempio n. 1
0
        public bool Create(VM.CompanyModel model)
        {
            MD.tbl_Company company = new MD.tbl_Company();
            //UserInfo userBL = new UserInfo();

            company.Name           = model.Name.Trim();
            company.Code           = model.Code.Trim();
            company.Description    = model.Description;
            company.ProcessingTime = DateTime.Now - DateTime.Now.AddHours(-1); //TimeSpan.Parse(model.ProcessingHour + ":" + model.ProcessingMinute);
            company.SendTime       = DateTime.Now - DateTime.Now.AddHours(-1); //TimeSpan.Parse(model.SendHour + ":" + model.SendMinute);
            company.SendUrl        = "";
            company.EmailAddress   = "";
            company.CreatedBy      = "sysadmin";//model.CreatedBy;
            company.CreatedDate    = DateTime.Now;
            company.Rate           = model.Rate;
            company.Fee            = model.Fee;
            company.DocumentMaker  = "";
            //userBL.UpdateUserCompany(allSelectList);
            Ctx.tbl_Company.Add(company);
            try
            {
                Ctx.SaveChanges();
                return(true);
            }
            catch (DbEntityValidationException ex)
            {
                return(false);
            }
        }
Esempio n. 2
0
 public string GetCurrCompanyNameById(int Id)
 {
     MD.tbl_Company company = Ctx.tbl_Company.FirstOrDefault(c => c.ID == Id && c.IsDeleted != true);
     if (company != null)
     {
         return(company.Name);
     }
     else
     {
         return(null);
     }
 }
Esempio n. 3
0
        public bool Delete(int Id, string Name)
        {
            var model = false;// Ctx.tbl_Gs_GasStationInfo.Any(c => c.Company == Id && c.IsDelete != true);

            if (model)
            {
                return(false);
            }

            MD.tbl_Company company = Ctx.tbl_Company.First(c => c.ID == Id);
            company.IsDeleted   = true;
            company.UpdatedDate = DateTime.Now;
            company.UpdatedBy   = Name;
            Ctx.SaveChanges();
            return(true);
        }
Esempio n. 4
0
        public bool Update(VM.CompanyModel model, string allSelectList, int currCompanyId, string logonName)
        {
            MD.tbl_Company company = Ctx.tbl_Company.First(c => c.ID == model.ID && c.IsDeleted != true);
            company.Name           = model.Name.Trim();
            company.Code           = model.Code.Trim();
            company.Description    = model.Description;
            company.ProcessingTime = DateTime.Now - DateTime.Now.AddHours(-1);;
            company.SendTime       = DateTime.Now - DateTime.Now.AddHours(-1);;
            company.SendUrl        = model.SendUrl;
            company.EmailAddress   = model.EmailAddress;
            company.Rate           = model.Rate;
            company.Fee            = model.Fee;
            company.DocumentMaker  = model.DocumentMaker;

            company.UpdatedBy   = model.UpdatedBy;
            company.UpdatedDate = DateTime.Now;
            // 用户公司关系
            UpdateUserCompany(allSelectList, currCompanyId, logonName);
            Ctx.SaveChanges();
            return(true);
        }