public IHttpActionResult PutDEPARTMENTS(int id, DEPARTMENTS dEPARTMENTS) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != dEPARTMENTS.DEPARTMENT_ID) { return(BadRequest()); } db.Entry(dEPARTMENTS).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!DEPARTMENTSExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult GetDEPARTMENTS(int id) { DEPARTMENTS dEPARTMENTS = db.DEPARTMENTS.Find(id); if (dEPARTMENTS == null) { return(NotFound()); } return(Ok(dEPARTMENTS)); }
public IHttpActionResult PostDEPARTMENTS(DEPARTMENTS dEPARTMENTS) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.DEPARTMENTS.Add(dEPARTMENTS); db.SaveChanges(); return(CreatedAtRoute("DefaultApi", new { id = dEPARTMENTS.DEPARTMENT_ID }, dEPARTMENTS)); }
public IHttpActionResult DeleteDEPARTMENTS(int id) { DEPARTMENTS dEPARTMENTS = db.DEPARTMENTS.Find(id); if (dEPARTMENTS == null) { return(NotFound()); } db.DEPARTMENTS.Remove(dEPARTMENTS); db.SaveChanges(); return(Ok(dEPARTMENTS)); }
public async Task <MessageModel <string> > Post([FromBody] DEPARTMENTS request) { var data = new MessageModel <string>(); var id = await _DEPARTMENTSServices.Add(request); data.success = id > 0; if (data.success) { data.response = id.ObjToString(); data.msg = "添加成功"; } return(data); }
public async Task <MessageModel <string> > Put([FromBody] DEPARTMENTS request) { var data = new MessageModel <string>(); if (request.ORIGREC > 0) { data.success = await _DEPARTMENTSServices.Update(request); if (data.success) { data.msg = "更新成功"; data.response = request?.ORIGREC.ObjToString(); } } return(data); }
private void txtdepartmentcode_LostFocus(object sender, RoutedEventArgs e) { string a = "Update", b = Convert.ToString(Save.Content); try { if (b == a) { DEPARTMENTS DE = new DEPARTMENTS(); DE.DEPARTMENT_CODE = txtdepartmentcode.Text; DE.UPDATE_BY = login.u; DE.UPDATE_DATE = DateTime.Today; DE.UPDATE(); txtdepartmentname.Text = DE.DEPARTMENT_NAME; txtreportname.Text = DE.REPORT_NAME; ComboBox1.Text = DE.STATUS; } } catch (Exception) { MessageBox.Show("Eneter departmentcode correctly"); } }
public JObject GetPmInsPectByCode(int iUserId, string iCodeNum) { try { #region 参数检测 iCodeNum.NotAllowNullOrEmpty("抽查批次号"); int StringLength = iCodeNum.Length; (iCodeNum.Length <= 4).ThrowException("抽查批次号格式不正确"); string mCode = iCodeNum.Substring(0, StringLength - 4).ToUpper(); string mNum = iCodeNum.Substring(StringLength - 4); #endregion #region 获取主表信息 var mPmPlanSubInfo = _dal.GetPmPlanSubByCode(mCode, mNum); mPmPlanSubInfo.NotAllowNull("未查询到抽查任务单信息"); #endregion #region 获得任务信息 ****查询NQI_LIMS******** ADD_SUPERVISEPLAN mAddSupervisePlan = null; mAddSupervisePlan = _AddSuperviserPlanDal.GetSupervisePlanByCode(mCode); #endregion #region 获取用户部门信息****查询NQI_LIMS******** var mUserInfo = _SysUserInfoServices.QueryById(iUserId).Result;//用户信息 mUserInfo.addr.NotAllowNullOrEmpty("部门编号"); /* * 20200801 没有组织架构,后期要增加, * 临时在adress字段 里面配置用户的部门信息 * 格式: DEPT部门编号RY01 */ DIVISIONS mDivisions = null; DEPARTMENTS mDepartments = null; mDepartments = _DepartmentsDal.GetDepartmentsByCode(mUserInfo.addr); mDivisions = _DivisionsDal.GetDivisionsByCode(mDepartments.PARENTDIV); #endregion #region 任务表 PM_PLAN mPmPlanInfo = null; if (!string.IsNullOrEmpty(mPmPlanSubInfo.PLAN_CODE)) { mPmPlanInfo = _dal.GetPmPlanByCode(mPmPlanSubInfo.PLAN_CODE); } else { throw new MyException("为查询到对应编号的数据。", data: iCodeNum); } #endregion #region 受检单位信息 PM_CARY mPmCaryInfo = null; if (mPmPlanSubInfo.CARY_ID > 0) { mPmCaryInfo = _dal.GetPmCaryById(mPmPlanSubInfo.CARY_ID); } #endregion #region 生产企业信息 PM_PRODUCE_UNIT mPmProduceUnit = null; if (mPmPlanSubInfo.PRO_ID > 0) { mPmProduceUnit = _dal.GetPmProduceUnitById(mPmPlanSubInfo.PRO_ID); } #endregion #region 抽样单位信息 PM_EXEC_UINT mPmExecUintInfo = null; if (mPmPlanSubInfo.EXEC_ID > 0) { mPmExecUintInfo = _dal.GetPmExecUintById(mPmPlanSubInfo.EXEC_ID); } #endregion #region 网店信息 PM_EC_PLATFORM mPmEcPlatFormInfo = null; if (mPmPlanSubInfo.EC_ID > 0) { mPmEcPlatFormInfo = _dal.GetPmEcPlatFormById(mPmPlanSubInfo.EC_ID); } #endregion #region 组装数据 return(new JObject() { { "ID", mPmPlanSubInfo.ID }, { "PLAN_CODE", mPmPlanSubInfo.PLAN_CODE }, { "LOT_NUM", mPmPlanSubInfo.LOT_NUM }, //任务信息 { "SupervisePlanInfo", JObject.Parse(JsonConvert.SerializeObject(mAddSupervisePlan)) }, //部门信息 { "Department", JObject.Parse(JsonConvert.SerializeObject(mDepartments)) }, //中心信息 { "Division", JObject.Parse(JsonConvert.SerializeObject(mDivisions)) }, //抽检数据库的相关表格: { "PmPlanSubInfo", JObject.Parse(JsonConvert.SerializeObject(mPmPlanSubInfo)) }, { "PmPlanInfo", mPmPlanInfo != null?JObject.Parse(JsonConvert.SerializeObject(mPmPlanInfo)) : new JObject() }, { "PmCaryInfo", mPmCaryInfo != null?JObject.Parse(JsonConvert.SerializeObject(mPmCaryInfo)) : new JObject() }, { "PmProduceUnit", mPmProduceUnit != null?JObject.Parse(JsonConvert.SerializeObject(mPmProduceUnit)) : new JObject() }, { "PmExecUintInfo", mPmExecUintInfo != null?JObject.Parse(JsonConvert.SerializeObject(mPmExecUintInfo)) : new JObject() }, { "PmEcPlatFormInfo", mPmEcPlatFormInfo != null?JObject.Parse(JsonConvert.SerializeObject(mPmEcPlatFormInfo)) : new JObject() }, }); #endregion } catch (Exception ex) { SerilogServer.WriteErrorLog("GetPmInsPectByCode", ex.Message, ex); throw ex; } }
private void Save_Click(object sender, RoutedEventArgs e) { DEPARTMENTS DE = new DEPARTMENTS(); try { if (error != 0 || txtdepartmentcode.Text == "" || txtdepartmentname.Text == "" || txtreportname.Text == "") { // pop1.IsOpen = true; if (txtdepartmentcode.Text == "") { txtdepartmentcode.Text = ""; } if (txtdepartmentname.Text == "") { txtdepartmentname.Text = ""; } if (txtreportname.Text == "") { txtreportname.Text = ""; } } else { DE.DEPARTMENT_CODE = txtdepartmentcode.Text; DE.DEPARTMENT_NAME = txtdepartmentname.Text; DE.REPORT_NAME = txtreportname.Text; DE.STATUS = ComboBox1.Text; //S R I I I 11/15/2017 //DE.USER_NAME = login.u; DE.INSERT_BY = login.u; DE.INSERT_DATE = DateTime.Today; //DEPARTMENT DE.INSERT(); string a1 = "Save", b1 = Convert.ToString(Save.Content); if (b1 == a1) { // insert.Content = "Inserted Sucessfully"; // pop2.IsOpen = true; DataTable dt = d.fill_deptgrid(); dgdept.ItemsSource = dt.DefaultView; //MessageBox.Show("inserted sucessfully"); popup_insert.IsOpen = true; } DE.UPDATE(); string a = "Update", b = Convert.ToString(Save.Content); if (b == a) {//Save.Content = "Update"; // insert.Content = "Updated Sucessfully"; // pop2.IsOpen = true; DataTable dt = d.fill_deptgrid(); dgdept.ItemsSource = dt.DefaultView; //MessageBox.Show("updated sucessfully"); popup_update.IsOpen = true; } txtdepartmentcode.Text = ""; txtdepartmentname.Text = ""; txtreportname.Text = ""; ComboBox1.Text = ""; this.NavigationService.Refresh(); } //Add.Background = new SolidColorBrush(Color.FromRgb(53, 71, 102)); //Modify.Background = new SolidColorBrush(Color.FromRgb(53, 71, 102)); } catch (Exception) { MessageBox.Show("please Eneter correct values"); } }