コード例 #1
0
        public void BindIssuedItemsReport()
        {
            GvOperatorBy.ColumnHeadersDefaultCellStyle.Font = new System.Drawing.Font("Arial", 11, FontStyle.Regular);
            GvOperatorBy.RowHeadersDefaultCellStyle.Font    = new System.Drawing.Font("Arial", 9);
            GvOperatorBy.DefaultCellStyle.Font = new System.Drawing.Font("Arial", 9);

            try
            {
                DataTable dt = new DataTable();
                if (Login.IsAdmin)
                {
                    dt = DAL.BindIssuedItemsReport("", "", 1, Login.UserId);
                }
                else
                {
                    dt = DAL.BindIssuedItemsReport("", "", 0, Login.UserId);
                }


                if (dt.Rows.Count > 0)
                {
                    GvOperatorBy.DataSource = dt;
                    GvOperatorBy.AutoResizeColumns();
                }
                else
                {
                    GvOperatorBy.DataSource = null;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
        }
コード例 #2
0
 private void btnSearch_Click(object sender, EventArgs e)
 {
     try
     {
         DataTable dt          = new DataTable();
         string    strFromDate = string.Empty;
         string    strTo       = string.Empty;
         strFromDate = dtpFrom.Value.ToString("dd-MM-yyyy");
         strTo       = dtpTo.Value.ToString("dd-MM-yyyy");
         if (Login.IsAdmin)
         {
             dt = DAL.BindIssuedItemsReport(strFromDate, strTo, 1, Login.UserId);
         }
         else
         {
             dt = DAL.BindIssuedItemsReport(strFromDate, strTo, 0, Login.UserId);
         }
         if (dt.Rows.Count > 0)
         {
             GvOperatorBy.DataSource = dt;
             GvOperatorBy.AutoResizeColumns();
         }
         else
         {
             MessageBox.Show("No Issued items", "Issued Items");
             GvOperatorBy.DataSource = null;
             return;
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
         return;
     }
 }