protected void btnSave_Click(object sender, EventArgs e) { try { if (this.customerSchedule.Id > 0) { this.customerSchedule.LastModifyDate = DateTime.Now; this.customerSchedule.LastModifyUser = this.CurrentUser.Code; foreach (GridViewRow gvr in this.GV_List_Detail.Rows) { TextBox tbQty = (TextBox)gvr.FindControl("tbQty"); decimal qty = decimal.Parse(tbQty.Text.Trim()); this.customerSchedule.CustomerScheduleDetails[gvr.RowIndex].Qty = qty; } TheCustomerScheduleMgr.UpdateCustomerSchedule(this.customerSchedule); ShowSuccessMessage("MRP.Schedule.Update.Successfully"); } else { this.customerSchedule.CreateDate = DateTime.Now; this.customerSchedule.CreateUser = this.CurrentUser.Code; this.customerSchedule.LastModifyDate = DateTime.Now; this.customerSchedule.LastModifyUser = this.CurrentUser.Code; this.customerSchedule.Status = BusinessConstants.CODE_MASTER_STATUS_VALUE_CREATE; foreach (GridViewRow gvr in this.GV_List_Detail.Rows) { TextBox tbQty = (TextBox)gvr.FindControl("tbQty"); decimal qty = decimal.Parse(tbQty.Text.Trim()); this.customerSchedule.CustomerScheduleDetails[gvr.RowIndex].Qty = qty; } TheCustomerScheduleMgr.CreateCustomerSchedule(this.customerSchedule); ShowSuccessMessage("MRP.Schedule.Create.Successfully"); } this.InitPageParameter(customerSchedule.Id); } catch (BusinessErrorException ex) { ShowErrorMessage(ex); } }
protected void btnImport_Click(object sender, EventArgs e) { try { if (this.tbScheduleNo.Text.Trim() == string.Empty) { this.rfvScheduleNo.IsValid = false; return; } string flowCode = this.tbFlow.Text.Trim() != string.Empty ? this.tbFlow.Text.Trim() : string.Empty; IList <CustomerSchedule> customerScheduleList = TheImportMgr.ReadCustomerScheduleFromXls(fileUpload.PostedFile.InputStream, this.CurrentUser, null, null, flowCode, this.tbScheduleNo.Text.Trim(), false); if (customerScheduleList.Count > 0) { foreach (CustomerSchedule c in customerScheduleList) { c.CreateDate = DateTime.Now; c.CreateUser = this.CurrentUser.Code; c.LastModifyDate = DateTime.Now; c.LastModifyUser = this.CurrentUser.Code; c.Status = BusinessConstants.CODE_MASTER_STATUS_VALUE_CREATE; TheCustomerScheduleMgr.CreateCustomerSchedule(c); TheCustomerScheduleMgr.ReleaseCustomerSchedule(c.Id, this.CurrentUser.Code); } ShowSuccessMessage("MRP.Schedule.Create.Successfully"); if (this.backClickEvent != null) { this.backClickEvent(this, e); } } } catch (BusinessErrorException ex) { ShowErrorMessage(ex); } }