Ejemplo n.º 1
0
 public JsonResult EditCompany(BaseCompany model)
 {
     try
     {
         bool result = false;
         if (string.IsNullOrWhiteSpace(model.CPID))
         {
             result = CompanyServices.Add(model);
         }
         else
         {
             BaseCompany company = CompanyServices.QueryCompanyByRecordId(model.CPID);
             if (string.IsNullOrWhiteSpace(company.MasterID) && !string.IsNullOrWhiteSpace(model.MasterID))
             {
                 throw new MyException("当前修改单位为顶级单位,不能属于任何单位");
             }
             result = CompanyServices.Update(model);
         }
         if (!result)
         {
             throw new MyException("保存单位信息失败");
         }
         UpdateCompanyCacheData(model);
         return(Json(MyResult.Success()));
     }
     catch (MyException ex)
     {
         return(Json(MyResult.Error(ex.Message)));
     }
     catch (Exception ex)
     {
         ExceptionsServices.AddExceptions(ex, "单位管理保存单位信息失败");
         return(Json(MyResult.Error("保存单位信息失败")));
     }
 }
Ejemplo n.º 2
0
        public IHttpActionResult AddData(company companyobj)
        {
            AuthDetails authdet = LoginUserDetails();

            companyobj.UpdatedBy = authdet.UserId;
            companyobj.CreatedBy = authdet.UserId;
            var result = service.Add(companyobj);

            return(Ok(result));
        }
Ejemplo n.º 3
0
        private void Add()
        {
            id_c = id_c + 1;
            Company company = new Company();

            if (companynameTextBox.Text.ToString() == "")
            {
                MessageBox.Show("Enter Name");
            }
            else
            {
                company.Id        = id_c;
                company.Name      = companynameTextBox.Text;
                company.Salary    = salaryTextBox.Text;
                company.Work_type = workTypeTextBox.Text;
                company.Vacancy   = vacancyTextBox.Text;

                CompanyServices companyservices = new CompanyServices();
                if (companyservices.Add(company) == 1)
                {
                    MessageBox.Show("Insert Successfull");
                }
            }
        }