예제 #1
0
        private void BindMeterSize()
        {
            FP.Controls.Clear();
            _MeterCount = 0;
            DataTable dt = new SqlServerHelper().GetDataTable("Meter_Design", "GroupID='" + _GroupID + "'", "CreateDate");

            if (DataTableHelper.IsExistRows(dt))
            {
                foreach (DataRow dr in dt.Rows)
                {
                    GroupMeterSize GM = new GroupMeterSize();
                    GM.GroupID          = dr["GroupID"].ToString();
                    GM.waterMeterSizeId = dr["waterMeterSizeId"].ToString();
                    GM.MeterCount       = int.Parse(dr["MeterCount"].ToString());
                    _MeterCount        += GM.MeterCount;
                    GM.Memo             = dr["Memo"].ToString();

                    MS.Add(GM);
                    UC_MeterSize UM = new UC_MeterSize();
                    UM.WaterMeterSizeId = dr["waterMeterSizeId"].ToString();
                    UM.MeterCount       = int.Parse(dr["MeterCount"].ToString());
                    UM.DelEvent        += new EventHandler(UM_DelEvent);
                    FP.Controls.Add(UM);
                }
                MG.GroupMeterSize_Items = MS;
                MeterCount.Text         = _MeterCount.ToString();
            }
        }
예제 #2
0
        void UM_DelEvent(object sender, EventArgs e)
        {
            UC_MeterSize UM = (UC_MeterSize)sender;

            for (int i = 0; i < MS.Count; i++)
            {
                if (MS[i].waterMeterSizeId == UM.WaterMeterSizeId)
                {
                    MS.RemoveAt(i);
                    _MeterCount    -= UM.MeterCount;
                    MeterCount.Text = _MeterCount.ToString();
                    FP.Controls.Remove(UM);
                    MG.GroupMeterSize_Items = MS;
                    break;
                }
            }
        }
예제 #3
0
        private void FP_Click(object sender, EventArgs e)
        {
            FrmApprove_Group_MeterSize frm = new FrmApprove_Group_MeterSize();

            frm.SelectedMeter = MG;
            if (frm.ShowDialog() == DialogResult.OK)
            {
                GroupMeterSize GM = new GroupMeterSize();
                UC_MeterSize   UM = new UC_MeterSize();
                GM.waterMeterSizeId = frm.waterMeterSizeId.SelectedValue.ToString();
                UM.WaterMeterSizeId = frm.waterMeterSizeId.SelectedValue.ToString();
                GM.MeterCount       = int.Parse(frm.MeterCount.Text);
                UM.MeterCount       = int.Parse(frm.MeterCount.Text);
                UM.DelEvent        += new EventHandler(UM_DelEvent);
                GM.Memo             = frm.Memo.Text;
                _MeterCount        += GM.MeterCount;
                MeterCount.Text     = _MeterCount.ToString();
                FP.Controls.Add(UM);
                MS.Add(GM);
                MG.GroupMeterSize_Items = MS;
            }
        }