Example #1
0
        /// <summary>
        /// 开始计算
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected override void btnAdd_ItemClick(object sender, ItemClickEventArgs e)
        {
            try
            {
                #if !DEBUG
                CheckReg();
                #endif

                BaseFunction.GetConfig();
                entList = new List <Ent1>();
                //gvSource.EndEdit();

                int n = gvSource.RowCount - 1;
                for (int i = 0; i < n; i++)
                {
                    Ent1 ent1   = new Ent1();
                    int  length = 0;
                    int  qty    = 0;
                    int  area   = 0;

                    int.TryParse(this.gvSource.GetRowCellValue(i, gvSource.Columns["Length"]) == null ? "0" : this.gvSource.GetRowCellValue(i, gvSource.Columns["Length"]).ToString(), out length);
                    int.TryParse(this.gvSource.GetRowCellValue(i, gvSource.Columns["Qty"]) == null ? "0" : this.gvSource.GetRowCellValue(i, gvSource.Columns["Qty"]).ToString(), out qty);
                    int.TryParse(this.gvSource.GetRowCellValue(i, gvSource.Columns["Area"]) == null ? "0" : this.gvSource.GetRowCellValue(i, gvSource.Columns["Area"]).ToString(), out area);
                    string depth = Convert.ToString(this.gvSource.GetRowCellValue(i, gvSource.Columns["Depth"]));
                    string fPath = Convert.ToString(this.gvSource.GetRowCellValue(i, gvSource.Columns["Path"]));
                    ent1.Length = length;
                    ent1.Area   = area;
                    ent1.Qty    = qty;
                    ent1.Depth  = depth;
                    ent1.Path   = fPath;
                    if (length + area + qty == 0)
                    {
                        continue;
                    }
                    entList.Add(ent1);
                }
                if (entList == null || entList.Count <= 0)
                {
                    MessageBox.Show(@"数据有误!");
                    return;
                }

                LoadDataAysnc();
            }
            catch (Exception ex)
            {
                DialogMessagebox.ShowInfoError(ex.Message);
            }
        }
Example #2
0
 protected override void btnRefresh_ItemClick(object sender, ItemClickEventArgs e)
 {
     AsyncWaitForm.Instance.AsyncShow("设置系统", "正在保存结果",
                                      delegate(AsyncWaitForm exfrm)
     {
         exfrm.SetMsgAndProgress("正在保存", 10);
         string area = txtArea.Text.Trim();
         if (string.IsNullOrEmpty(area))
         {
             BaseFunction.Area = 1000;
         }
         else
         {
             int.TryParse(area, out BaseFunction.Area);
         }
         exfrm.SetMsgAndProgress("保存成功", 90);
     }, delegate
     {
         UpdateConfig();
         AsyncWaitForm.Instance.SetMsgAndProgress(100);
         DialogMessagebox.ShowInfo(@"保存成功");
     });
 }