public async Task <bool> RequestReviewing(string param, reviewingtbl data) { OrderMasterControls orderMasterControls = new OrderMasterControls(); var ret = await AddData(data); if (ret) { var update = await orderMasterControls.UpdateStatus(data.orderNo, status : "Kaji Ulang"); if (update) { return(true); } } return(false); }
public async Task <bool> UpdateData(string id, reviewingtbl obj) { try { if (id != obj.reviewingNo.ToString()) { return(false); } using (var context = new smlpobDB()) { context.reviewingtbls.Attach(obj); context.Entry(obj).Property(x => x.orderNo).IsModified = true; context.Entry(obj).Property(x => x.elementCodeList).IsModified = true; context.Entry(obj).Property(x => x.reviewingDate).IsModified = true; context.Entry(obj).Property(x => x.isLabUtilitySurfficient).IsModified = true; context.Entry(obj).Property(x => x.isHumanResourceSurfficient).IsModified = true; context.Entry(obj).Property(x => x.isChemicalMaterialSurfficent).IsModified = true; context.Entry(obj).Property(x => x.isVolumeCorrect).IsModified = true; context.Entry(obj).Property(x => x.workdays).IsModified = true; context.Entry(obj).Property(x => x.isMethode).IsModified = true; context.Entry(obj).Property(x => x.isQualityStandard).IsModified = true; context.Entry(obj).Property(x => x.modBy).IsModified = true; context.Entry(obj).Property(x => x.modDate).IsModified = true; await context.SaveChangesAsync(); return(true); } } catch (Exception ex) { LogHelpers.source = this.GetType().Name; LogHelpers.message = ex.Message; LogHelpers.user = ""; LogHelpers.WriteLog(); } return(false); }
public async Task <bool> AddData(reviewingtbl obj) { try { using (var context = new smlpobDB()) { context.reviewingtbls.Add(obj); await context.SaveChangesAsync(); return(true); } } catch (Exception ex) { LogHelpers.source = this.GetType().Name; LogHelpers.message = ex.Message; LogHelpers.user = ""; LogHelpers.WriteLog(); } return(false); }
private void DoSave() { reviewingtbl review = new reviewingtbl(); List <reviewingtbl> parameter = new List <reviewingtbl>(); var data = new reviewingtbl { orderNo = TxtNoOrder.Text, reviewingDate = Convert.ToDateTime(TxtReceiptDate.Text), workdays = Convert.ToInt32(TxtWorkDay.Text), creaBy = currentUser, creaDate = DatetimeHelper.GetDatetimeNow() }; foreach (GridViewRow gvrow in GvParam.Rows) { var chkbx = gvrow.FindControl("isChecked") as CheckBox; if (chkbx.Checked) { var element = gvrow.FindControl("txtParameterUji") as Label; parameter.Add(new reviewingtbl { elementCodeList = element.Text, }); } } if (TxtLabUtility1.Checked) { data.isLabUtilitySurfficient = "1"; } else { data.isLabUtilitySurfficient = "0"; } if (TxtLabHumanResource1.Checked) { data.isHumanResourceSurfficient = "1"; } else { data.isHumanResourceSurfficient = "0"; } if (TxtLabChemicalMat1.Checked) { data.isChemicalMaterialSurfficent = "1"; } else { data.isChemicalMaterialSurfficent = "0"; } if (TxtVolume1.Checked) { data.isVolumeCorrect = "1"; } else { data.isVolumeCorrect = "0"; } if (TxtMethode1.Checked) { data.isMethode = "1"; } else { data.isMethode = "0"; } if (TxtQualityStandard1.Checked) { data.isQualityStandard = "1"; } else { data.isQualityStandard = "0"; } var ret = reviewingControls.AddData(data); if (ret.Result) { CommonWeb.Alert(this, "data berhasil disimpan"); Response.Redirect("CustomerBeranda.aspx"); } else { CommonWeb.Alert(this, "Gagal menyimpan data"); } }