Esempio n. 1
0
 /// <summary>
 /// 改变全选的状态时
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void Checkall_CheckedChanged(object sender, EventArgs e)
 {
     try
     {
         if (Checkall.Checked)
         {
             foreach (var row in lvAssTemplate.Rows)
             {
                 frmATChooseLayout ATRow = (frmATChooseLayout)row.Control;
                 ATRow.CheckBox1.Checked = true;
             }
         }
         else
         {
             foreach (var row in lvAssTemplate.Rows)
             {
                 frmATChooseLayout ATRow = (frmATChooseLayout)row.Control;
                 ATRow.CheckBox1.Checked = false;
             }
         }
     }
     catch (Exception ex)
     {
         Toast(ex.Message);
     }
 }
Esempio n. 2
0
        /// <summary>
        /// 得到行项数据
        /// </summary>
        private void GetRow()
        {
            try
            {
                foreach (var row in lvAssTemplate.Rows)
                {
                    frmATChooseLayout ATRow = (frmATChooseLayout)row.Control;
                    //更新对应的AllATTale行项
                    string  TId      = ATRow.LblTId.Text;
                    DataRow allATRow = AllATTable.Rows.Find(TId);
                    if (allATRow != null)
                    {
                        decimal Quantity;
                        if (decimal.TryParse(ATRow.numQuant.Value.ToString(), out Quantity) == false)
                        {
                            throw new Exception("模板" + ATRow.LblTId.Text + "的计划数量格式不正确。");
                        }
                        decimal PRICE;
                        if (decimal.TryParse(ATRow.numPrice.Value.ToString(), out PRICE) == false)
                        {
                            throw new Exception("模板" + ATRow.LblTId.Text + "的计划单价格式不正确。");
                        }
                        allATRow["IsChecked"] = ATRow.CheckBox1.Checked;
                        allATRow["PRICE"]     = PRICE;
                        allATRow["QUANT"]     = Quantity;
//                        if (Quantity != 0 && PRICE != 0)
//                        {
//                            allATRow["IsChecked"] = ATRow.CheckBox1.Checked;
//                            allATRow["PRICE"] = PRICE;
//                            allATRow["QUANT"] = Quantity;
//                        }
//                        else
//                        {
//                            errorInfo = "请保证行项中的数量和单价均不为0!";
//                            throw new Exception("请保证行项中的数量和单价均不为0!");
//                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Toast(ex.Message);
            }
        }