public override void GetAttrMulti(FLOObj O) { FLOCal o = (FLOCal)O; o.Cal_calendarpre = this.tb_calendarpre.Text; if (this.cb_caltype.Enabled == true) { o.Cal_caltype = (FLOObj.CALTYPE) this.cb_caltype.SelectedItem; } o.Cal_pattern = (FLOObj.CPTTYPE) this.cb_pattern.SelectedItem; o.Cal_dayofweek = (FLOObj.CDWTYPE) this.cb_dayofweek.SelectedItem; o.Cal_numofday = (int)this.nud_numofday.Value; o.Cal_details.Clear(); for (int i = 0; i < this.lv_details.Items.Count; i++) { FLOCal.Cal_Detail detail; detail.cal_detaildx = Convert.ToInt32(this.lv_details.Items[i].SubItems[0].Text); detail.cal_effstart = this.lv_details.Items[i].SubItems[1].Text; detail.cal_effend = this.lv_details.Items[i].SubItems[2].Text; detail.cal_qtyper = Convert.ToInt32(this.lv_details.Items[i].SubItems[3].Text); o.Cal_details.Add(detail); } }
public override void SetAttr(FLOObj O) { FLOCal o = (FLOCal)O; // this.tb_calendarpre.Text = o.Cal_calendarpre; this.tb_calendar.Text = o.Cal_calendar; this.cb_caltype.SelectedItem = o.Cal_caltype; this.tb_calendarpre_update(); this.cb_pattern.SelectedItem = o.Cal_pattern; this.cb_dayofweek.SelectedItem = o.Cal_dayofweek; this.nud_numofday.Value = (decimal)o.Cal_numofday; foreach (FLOCal.Cal_Detail detail in o.Cal_details) { this.lv_details.Items.AddRange(new ListViewItem[] { new ListViewItem(new string[] { detail.cal_detaildx.ToString(), Convert.ToDateTime(detail.cal_effstart).ToShortDateString(), Convert.ToDateTime(detail.cal_effend).ToShortDateString(), detail.cal_qtyper.ToString() }, -1) }); } if (this.lv_details.Items.Count < 1) { lv_details.Items.AddRange(new ListViewItem[] { new ListViewItem(new string[] { (lv_details.Items.Count + 1).ToString(), DateTime.Now.ToShortDateString(), DateTime.Now.ToShortDateString(), "1000" }, -1) }); } }
public override void SetAttrMulti(FLOObj O) { FLOCal o = (FLOCal)O; if (init) { this.tb_calendarpre.Text = o.Cal_calendarpre; this.tb_calendar.Text = o.Cal_calendar; this.cb_caltype.SelectedItem = o.Cal_caltype; this.cb_pattern.SelectedItem = o.Cal_pattern; this.cb_dayofweek.SelectedItem = o.Cal_dayofweek; this.nud_numofday.Value = (decimal)o.Cal_numofday; foreach (FLOCal.Cal_Detail detail in o.Cal_details) { this.lv_details.Items.AddRange(new ListViewItem[] { new ListViewItem(new string[] { detail.cal_detaildx.ToString(), Convert.ToDateTime(detail.cal_effstart).ToShortDateString(), Convert.ToDateTime(detail.cal_effend).ToShortDateString(), detail.cal_qtyper.ToString() }, -1) }); } if (this.lv_details.Items.Count < 1) { lv_details.Items.AddRange(new ListViewItem[] { new ListViewItem(new string[] { (lv_details.Items.Count + 1).ToString(), DateTime.Now.ToShortDateString(), DateTime.Now.ToShortDateString(), "1000" }, -1) }); } } init = false; if (this.tb_calendarpre.Text != o.Cal_calendarpre) { this.tb_calendarpre.Text = FLOObj.SCPRE; } if (this.tb_calendar.Text != o.Cal_calendar) { this.tb_calendar.Text = ""; } if (this.cb_caltype.SelectedItem.ToString() != o.Cal_caltype.ToString()) { this.cb_caltype.SelectedItem = FLOObj.CALTYPE.REP_QTY; } if (this.cb_pattern.SelectedItem.ToString() != o.Cal_pattern.ToString()) { this.cb_pattern.SelectedItem = FLOObj.CPTTYPE.EVERYDAY; } if (this.cb_dayofweek.SelectedItem.ToString() != o.Cal_dayofweek.ToString()) { this.cb_dayofweek.SelectedItem = FLOObj.CDWTYPE.Mo; } if (this.nud_numofday.Value != o.Cal_numofday) { this.nud_numofday.Value = 0; } for (int i = 0; i < this.lv_details.Items.Count; i++) { FLOCal.Cal_Detail sdetail; sdetail.cal_detaildx = Convert.ToInt32(this.lv_details.Items[i].SubItems[0].Text); sdetail.cal_effstart = this.lv_details.Items[i].SubItems[1].Text; sdetail.cal_effend = this.lv_details.Items[i].SubItems[2].Text; sdetail.cal_qtyper = Convert.ToInt32(this.lv_details.Items[i].SubItems[3].Text); if (!((FLOCal.Cal_Detail)o.Cal_details[i]).Equals(sdetail)) { lv_details.Items.Clear(); lv_details.Items.AddRange(new ListViewItem[] { new ListViewItem(new string[] { (lv_details.Items.Count + 1).ToString(), DateTime.Now.ToShortDateString(), DateTime.Now.ToShortDateString(), "1000" }, -1) }); break; } } }