protected void CV_ServerValidate(object source, ServerValidateEventArgs args) { CustomValidator cv = (CustomValidator)source; switch (cv.ID) { case "cvUom": if (TheUomMgr.LoadUom(args.Value) == null) { ShowWarningMessage("MasterData.Bom.WarningMessage.UomInvalid", args.Value); args.IsValid = false; } break; case "cvRegion": if (args.Value.Trim() != "") { if (TheRegionMgr.LoadRegion(args.Value) == null) { ShowWarningMessage("MasterData.Bom.WarningMessage.RegionInvalid", args.Value); args.IsValid = false; } } break; default: break; } }
protected void ODS_Workday_Updating(object sender, ObjectDataSourceMethodEventArgs e) { string region = ((TextBox)(this.FV_Workday.FindControl("tbRegion"))).Text.Trim(); string workcenter = ((TextBox)(this.FV_Workday.FindControl("tbWorkCenter"))).Text.Trim(); RadioButtonList rblType = (RadioButtonList)(this.FV_Workday.FindControl("rblType")); workday = (Workday)e.InputParameters[0]; if (region == "") { workday.Region = null; } else { workday.Region = TheRegionMgr.LoadRegion(region); if (workday.Region == null) { ShowWarningMessage("MasterData.WorkCalendar.WarningMessage.RegionInvalid", region); e.Cancel = true; } } if (workcenter == "") { workday.WorkCenter = null; } else { workday.WorkCenter = TheWorkCenterMgr.LoadWorkCenter(workcenter); if (workday.WorkCenter == null) { ShowWarningMessage("MasterData.WorkCalendar.WarningMessage.WorkCenterInvalid", workcenter); e.Cancel = true; } } workday.Type = rblType.SelectedValue; }
protected void btnInsert_Click(object sender, EventArgs e) { CustomValidator cvInsert = ((CustomValidator)(this.FV_Region.FindControl("cvInsert"))); if (cvInsert.IsValid) { TextBox tbCode = (TextBox)(this.FV_Region.FindControl("tbCode")); TextBox tbName = (TextBox)(this.FV_Region.FindControl("tbName")); TextBox tbPlant = (TextBox)(this.FV_Region.FindControl("tbPlant")); CheckBox cbIsActive = (CheckBox)(this.FV_Region.FindControl("cbIsActive")); com.Sconit.Control.CodeMstrDropDownList ddlRegionType = (com.Sconit.Control.CodeMstrDropDownList) this.FV_Region.FindControl("ddlRegionType"); Region region = new Region(); region.Code = tbCode.Text.Trim(); region.Name = tbName.Text.Trim(); region.IsActive = cbIsActive.Checked; region.RegionType = ddlRegionType.SelectedValue; region.Plant = tbPlant.Text.Trim(); TheRegionMgr.CreateRegion(region, this.CurrentUser); if (CreateEvent != null) { CreateEvent(region.Code, e); ShowSuccessMessage("MasterData.Region.AddRegion.Successfully", region.Code); } } }
protected void FV_Region_DataBound(object sender, EventArgs e) { com.Sconit.Control.CodeMstrDropDownList ddlRegionType = (com.Sconit.Control.CodeMstrDropDownList) this.FV_Region.FindControl("ddlRegionType"); Region region = TheRegionMgr.LoadRegion(this.RegionCode); ddlRegionType.SelectedValue = region.RegionType; }
protected void ODS_Bom_Inserting(object sender, ObjectDataSourceMethodEventArgs e) { string uom = ((Controls_TextBox)(this.FV_Bom.FindControl("tbUom"))).Text.Trim(); string region = ((Controls_TextBox)(this.FV_Bom.FindControl("tbRegion"))).Text.Trim(); bom = (Bom)e.InputParameters[0]; item = TheItemMgr.LoadItem(bom.Code); if (item != null) { //default description and uom if (bom.Description.Trim() == "") { bom.Description = item.Description; } if (uom.Trim() == "") { bom.Uom = item.Uom; } else { bom.Uom = TheUomMgr.LoadUom(uom); } } if (region == "") { bom.Region = null; } else { bom.Region = TheRegionMgr.LoadRegion(region); } }
protected void CV_ServerValidate(object source, ServerValidateEventArgs args) { CustomValidator cv = (CustomValidator)source; switch (cv.ID) { case "cvCode": if (TheRoutingMgr.LoadRouting(args.Value) != null) { ShowWarningMessage("MasterData.Routing.Code.Exist", args.Value); args.IsValid = false; } break; case "cvRegion": if (TheRegionMgr.LoadRegion(args.Value) == null) { ShowWarningMessage("MasterData.Region.Code.NotExist", args.Value); args.IsValid = false; } break; default: break; } }
public void ListView(object sender) { string region = ((object[])sender)[0].ToString(); string workcenter = ((object[])sender)[1].ToString(); string para_starttime = ((object[])sender)[2].ToString(); string para_endtime = ((object[])sender)[3].ToString(); DateTime starttime = DateTime.Now; DateTime endtime = DateTime.Now; if (region != "") { Region r = TheRegionMgr.LoadRegion(region); if (r == null) { ShowWarningMessage("MasterData.WorkCalendar.WarningMessage.RegionInvalid", region); return; } } if (workcenter != "") { WorkCenter r = TheWorkCenterMgr.LoadWorkCenter(workcenter); if (r == null) { ShowWarningMessage("MasterData.WorkCalendar.WarningMessage.WorkCenterInvalid", workcenter); return; } } try { starttime = Convert.ToDateTime(para_starttime); } catch (Exception) { ShowWarningMessage("MasterData.WorkCalendar.WarningMessage.StartTimeInvalid"); return; } try { endtime = Convert.ToDateTime(para_endtime); } catch (Exception) { ShowWarningMessage("MasterData.WorkCalendar.WarningMessage.EndTimeInvalid"); return; } if (DateTime.Compare(starttime, endtime) > 0) { ShowWarningMessage("MasterData.WorkCalendar.WarningMessage.TimeCompare"); return; } List <WorkCalendar> workCalendars = TheWorkCalendarMgr.GetWorkCalendar(starttime, endtime, region, workcenter); this.GV_List.DataSource = workCalendars; this.GV_List.DataBind(); GridViewHelper.GV_MergeTableCell(GV_List, new int[] { 0, 1 }); }
protected void ODS_Routing_Updating(object sender, ObjectDataSourceMethodEventArgs e) { Controls_TextBox tbRegion = ((Controls_TextBox)(this.FV_Routing.FindControl("tbRegion"))); CodeMstrDropDownList ddlRoutingType = ((CodeMstrDropDownList)(this.FV_Routing.FindControl("ddlRoutingType"))); Routing routing = (Routing)e.InputParameters[0]; routing.Type = ddlRoutingType.SelectedValue; routing.Region = TheRegionMgr.LoadRegion(tbRegion.Text); }
protected void checkRegionExists(object source, ServerValidateEventArgs args) { string code = ((TextBox)(this.FV_Region.FindControl("tbCode"))).Text; if (TheRegionMgr.LoadRegion(code) != null) { args.IsValid = false; } }
protected void ODS_Location_Updating(object sender, ObjectDataSourceMethodEventArgs e) { Location location = (Location)e.InputParameters[0]; if (location != null) { string region = ((TextBox)(this.FV_Location.FindControl("tbRegion"))).Text.Trim(); location.Region = TheRegionMgr.LoadRegion(region); location.Name = location.Name.Trim(); } }
protected void ODS_Workday_Inserting(object sender, ObjectDataSourceMethodEventArgs e) { string region = ((Controls_TextBox)(this.FV_Workday.FindControl("tbRegion"))).Text.Trim(); string workcenter = ((Controls_TextBox)(this.FV_Workday.FindControl("tbWorkCenter"))).Text.Trim(); RadioButtonList rbType = (RadioButtonList)(this.FV_Workday.FindControl("rbType")); workday = (Workday)e.InputParameters[0]; workday.Region = TheRegionMgr.LoadRegion(region); workday.WorkCenter = TheWorkCenterMgr.LoadWorkCenter(workcenter); workday.Type = rbType.SelectedValue; }
protected void lbtnDelete_Click(object sender, EventArgs e) { string code = ((LinkButton)sender).CommandArgument; try { TheRegionMgr.DeleteRegion(code); ShowSuccessMessage("MasterData.Region.DeleteRegion.Successfully", code); UpdateView(); } catch (Castle.Facilities.NHibernateIntegration.DataException ex) { ShowErrorMessage("MasterData.Region.DeleteRegion.Fail", code); } }
protected void ODS_Bom_Updating(object sender, ObjectDataSourceMethodEventArgs e) { string uom = ((Controls_TextBox)(this.FV_Bom.FindControl("tbUom"))).Text.Trim(); string region = ((TextBox)(this.FV_Bom.FindControl("tbRegion"))).Text.Trim(); bom = (Bom)e.InputParameters[0]; bom.Uom = TheUomMgr.LoadUom(uom); if (region == "") { bom.Region = null; } else { bom.Region = TheRegionMgr.LoadRegion(region); } }
protected void ODS_Location_Inserting(object sender, ObjectDataSourceMethodEventArgs e) { location = (Location)e.InputParameters[0]; location.Code = location.Code.Trim(); location.Name = location.Name.Trim(); if (location != null) { string region = ((Controls_TextBox)(this.FV_Location.FindControl("tbRegion"))).Text.Trim(); location.Region = TheRegionMgr.LoadRegion(region); } if (TheLocationMgr.LoadLocation(location.Code) != null) { ShowErrorMessage("MasterData.Location.CodeExist", location.Code); NewEvent(sender, e); e.Cancel = true; } }
protected void Save_ServerValidate(object source, ServerValidateEventArgs args) { CustomValidator cv = (CustomValidator)source; string region = ((Controls_TextBox)(this.FV_Workday.FindControl("tbRegion"))).Text.Trim(); string workcenter = ((Controls_TextBox)(this.FV_Workday.FindControl("tbWorkCenter"))).Text.Trim(); string dayOfWeek = ((DropDownList)(this.FV_Workday.FindControl("DayOfWeek_DDL"))).SelectedValue; RadioButtonList rbType = (RadioButtonList)(this.FV_Workday.FindControl("rbType")); switch (cv.ID) { case "cvRegion": if (TheRegionMgr.LoadRegion(region) == null) { args.IsValid = false; } break; case "cvWorkCenter": if (TheWorkCenterMgr.LoadWorkCenter(workcenter) == null) { args.IsValid = false; } break; case "cvWeek": if (TheWorkdayMgr.GetWorkdayByDayofweek(dayOfWeek, region, workcenter).Count > 0) { args.IsValid = false; } break; default: break; } }
protected void Save_ServerValidate(object source, ServerValidateEventArgs args) { CustomValidator cv = (CustomValidator)source; string region = ((Controls_TextBox)(this.FV_SpecialTime.FindControl("tbRegion"))).Text.Trim(); string workcenter = ((Controls_TextBox)(this.FV_SpecialTime.FindControl("tbWorkCenter"))).Text.Trim(); string startTime = ((TextBox)(this.FV_SpecialTime.FindControl("tbStartTime"))).Text.Trim(); string endTime = ((TextBox)(this.FV_SpecialTime.FindControl("tbEndTime"))).Text.Trim(); string type = ((RadioButtonList)(this.FV_SpecialTime.FindControl("rblType"))).SelectedValue; switch (cv.ID) { case "cvRegion": if (TheRegionMgr.LoadRegion(region) == null) { args.IsValid = false; } break; case "cvWorkCenter": if (TheWorkCenterMgr.LoadWorkCenter(workcenter) == null) { args.IsValid = false; } break; case "cvStartTime": try { Convert.ToDateTime(startTime); } catch (Exception) { args.IsValid = false; } break; case "cvEndTime": try { Convert.ToDateTime(endTime); } catch (Exception) { args.IsValid = false; } if (DateTime.Compare(DateTime.Parse(startTime), DateTime.Parse(endTime)) >= 0) { cv.ErrorMessage = "${MasterData.WorkCalendar.WarningMessage.TimeCompare}"; args.IsValid = false; } IList specialTimes = TheSpecialTimeMgr.GetSpecialTime(DateTime.Parse(startTime), DateTime.Parse(endTime), region, workcenter); foreach (SpecialTime st in specialTimes) { if (st.Type == type) { cv.ErrorMessage = "${MasterData.WorkCalendar.WarningMessage.Error3}"; args.IsValid = false; } } break; default: break; } }
protected void ODS_SpecialTime_Updating(object sender, ObjectDataSourceMethodEventArgs e) { string region = ((TextBox)(this.FV_SpecialTime.FindControl("tbRegion"))).Text.Trim(); string workcenter = ((TextBox)(this.FV_SpecialTime.FindControl("tbWorkCenter"))).Text.Trim(); RadioButtonList rblType = (RadioButtonList)(this.FV_SpecialTime.FindControl("rblType")); SpecialTime specialTime = (SpecialTime)e.InputParameters[0]; if (region == "") { specialTime.Region = null; } else { specialTime.Region = TheRegionMgr.LoadRegion(region); if (specialTime.Region == null) { ShowWarningMessage("MasterData.WorkCalendar.WarningMessage.RegionInvalid", region); e.Cancel = true; } } if (workcenter == "") { specialTime.WorkCenter = null; } else { specialTime.WorkCenter = TheWorkCenterMgr.LoadWorkCenter(workcenter); if (specialTime.WorkCenter == null) { ShowWarningMessage("MasterData.WorkCalendar.WarningMessage.WorkCenterInvalid", workcenter); e.Cancel = true; } } specialTime.Type = rblType.SelectedValue; try { Convert.ToDateTime(specialTime.StartTime); } catch (Exception) { ShowWarningMessage("MasterData.WorkCalendar.WarningMessage.StartTimeInvalid"); e.Cancel = true; } try { Convert.ToDateTime(specialTime.EndTime); } catch (Exception) { ShowWarningMessage("MasterData.WorkCalendar.WarningMessage.EndTimeInvalid"); e.Cancel = true; } if (DateTime.Compare(specialTime.StartTime, specialTime.EndTime) >= 0) { ShowWarningMessage("MasterData.WorkCalendar.WarningMessage.TimeCompare"); e.Cancel = true; } IList specialTimes = TheSpecialTimeMgr.GetSpecialTime(specialTime.StartTime, specialTime.EndTime, region, workcenter); foreach (SpecialTime st in specialTimes) { if (st.Type == specialTime.Type) { ShowWarningMessage("MasterData.WorkCalendar.WarningMessage.Error3"); e.Cancel = true; } } }