示例#1
0
 private void LadeAssignmentAcceptedButton_Click(object sender, EventArgs e)
 {
     try
     {
         if (LadeAssignmentGridView.GetCheckedRows().Length > 1)
         {
             throw new ApplicationException("تعداد بارگیر انتخاب شده بیشتر از یک مورد است");
         }
         if (LadeAssignmentGridView != null && LadeAssignmentGridView.GetCheckedRows().Length > 0)
         {
             HPS.Present.LadeAssignment.LadeAssignmentAcceptForm frm = new LadeAssignmentAcceptForm((Int64)this.LadeAssignmentGridView.CurrentRow.Cells["LadeAssignmentID_bint"].Value, (DataTable)this.LadeAssignmentGridView.DataSource);
             frm.ShowDialog();
         }
     }
     catch (System.Exception ex)
     {
         Hepsa.Core.Common.MessageBox.ErrorMessage(ex.Message);
     }
 }
示例#2
0
        private void ChooseLadeAssignmentAcceptedButton_Click(object sender, EventArgs e)
        {
            try
            {
                HPS.BLL.LadeAssignmentBLL.BLLLadeAssignment_TFactory LadeAssignmentFactory = new HPS.BLL.LadeAssignmentBLL.BLLLadeAssignment_TFactory();
                HPS.BLL.LadeAssignmentBLL.BLLLadeAssignment_T        LadeAssignmentEntity  = new HPS.BLL.LadeAssignmentBLL.BLLLadeAssignment_T();
                HPS.BLL.LadeAssignmentBLL.BLLLadeAssignment_TKeys    LadeAssignmentKeys    = new HPS.BLL.LadeAssignmentBLL.BLLLadeAssignment_TKeys();
                DataTable gridTable = new DataTable();
                gridTable = LadeAssignmentDataTable.Copy();

                DataRow[] dr = null;
                LadeAssignmentFactory.BeginProc();
                foreach (Janus.Windows.GridEX.GridEXRow itm in LadeAssignmentGridView.GetCheckedRows())
                {
                    LadeAssignmentKeys.LadeAssignmentID_bint = (Int64)itm.Cells["LadeAssignmentID_bint"].Value;
                    LadeAssignmentEntity = LadeAssignmentFactory.GetBy(LadeAssignmentKeys);
                    LadeAssignmentEntity.Accepted_bit       = true;
                    LadeAssignmentEntity.AcceptUserName_nvc = HPS.Common.CurrentUser.user.UserName_nvc;
                    LadeAssignmentEntity.AcceptDate_vc      = LadeAssignmentFactory.ServerJalaliDate;
                    LadeAssignmentEntity.AcceptTime_vc      = LadeAssignmentFactory.ServerTime;
                    LadeAssignmentFactory.Update(LadeAssignmentEntity, LadeAssignmentKeys);

                    dr = gridTable.Select(HPS.BLL.LadeAssignmentBLL.BLLLadeAssignment_T.LadeAssignment_TField.LadeAssignmentID_bint.ToString() + "='" + (Int64)itm.Cells["LadeAssignmentID_bint"].Value + "'");
                    if (dr.Length > 0)
                    {
                        dr[0].Delete();
                    }
                    gridTable.AcceptChanges();
                }
                LadeAssignmentFactory.CommitProc();
                LadeAssignmentGridView.DataSource = null;
                LadeAssignmentGridView.SetDataBinding(gridTable, "gridTable");
                LadeAssignmentDataTable = gridTable.Copy();
                gridTable.Dispose();
            }
            catch (Exception ex)
            {
                Hepsa.Core.Common.MessageBox.ErrorMessage(ex.Message);
            }
        }