Пример #1
0
        private void ShowButton_Click(object sender, EventArgs e)
        {
            try
            {
                LadeAssignmentInfoGridView.Visible = true;
                SumPanel.Visible = true;

                if (FromDatefaDatePicker.IsNull)
                {
                    throw new ApplicationException("از تاریخ خالی است");
                }
                else if (ToDatefaDatePicker.IsNull)
                {
                    throw new ApplicationException("تا تاریخ خالی است");
                }

                string CompanyCodeList_nvc = string.Empty;
                foreach (Janus.Windows.GridEX.GridEXRow itm in companyGrid.GetCheckedRows())
                {
                    CompanyCodeList_nvc += itm.Cells["CompanyCode_nvc"].Value.ToString() + ",";
                }
                if (CompanyCodeList_nvc.EndsWith(","))
                {
                    CompanyCodeList_nvc = CompanyCodeList_nvc.Remove(CompanyCodeList_nvc.Length - 1);
                }

                string LaderTypeCodeList_nvc = string.Empty;
                foreach (Janus.Windows.GridEX.GridEXRow itm in laderTypeGrid.GetCheckedRows())
                {
                    LaderTypeCodeList_nvc += itm.Cells["LaderTypeCode_nvc"].Value.ToString() + ",";
                }
                if (LaderTypeCodeList_nvc.EndsWith(","))
                {
                    LaderTypeCodeList_nvc = LaderTypeCodeList_nvc.Remove(LaderTypeCodeList_nvc.Length - 1);
                }

                HPS.BLL.LadeAssignmentBLL.BLLLadeAssignment_TFactory LadeAssignmentFactory = new HPS.BLL.LadeAssignmentBLL.BLLLadeAssignment_TFactory();
                DataTable UsedLadBillDataTable = new DataTable();
                LadeAssignmentFactory.SelectUsedLadBill(FromDatefaDatePicker.Text, ToDatefaDatePicker.Text, CompanyCodeList_nvc, LaderTypeCodeList_nvc, UsedLadBillDataTable);
                LadeAssignmentInfoGridView.DataSource = UsedLadBillDataTable;
                if (UsedLadBillDataTable != null && UsedLadBillDataTable.Rows.Count > 0)
                {
                    decimal UsedLadBill_dec = (decimal)UsedLadBillDataTable.Compute("Sum(UsedLadBill_int)", "True");
                    AllCarCount_fltlabel.Text         = "تعداد درخواستی : " + ((decimal)UsedLadBillDataTable.Compute("Sum(CarCount_int)", "True")).ToString("0.##");
                    AllLadBillCount_fltLabel.Text     = " تعداد مجوز صادره : " + ((decimal)UsedLadBillDataTable.Compute("Sum(LadBillCount_int)", "True")).ToString("0.##");
                    AllUsedLadBillCount_fltLabel.Text = "تعداد بار نامه : " + ((decimal)UsedLadBillDataTable.Compute("Sum(UsedLadBill_int)", "True")).ToString("0.##");
                    if (UsedLadBill_dec != 0)
                    {
                        AllCarCountPercent_decLabel.Text = "درصد درخواستی به بار نامه : " + (((decimal)UsedLadBillDataTable.Compute("Sum(CarCount_int)", "True") * 100 / UsedLadBill_dec).ToString("0.##"));
                        //AllCarCountPercent_decLabel.Text= "درصد درخواستی به بار نامه:"+(((decimal)UsedLadBillDataTable.Compute("Sum(CarCountPercent_dec)", "True") / UsedLadBillDataTable.Rows.Count).ToString("0.##"));
                        AllLadBillCountPercent_decLabel.Text = "درصد مجوز صادره به بارنامه : " + (((decimal)UsedLadBillDataTable.Compute("Sum(LadBillCount_int)", "True") * 100 / UsedLadBill_dec).ToString("0.##"));
                    }
                    else
                    {
                        AllCarCountPercent_decLabel.Text     = "درصد درخواستی به بار نامه :0";
                        AllLadBillCountPercent_decLabel.Text = "درصد مجوز صادره به بارنامه :0";
                    }
                }
            }
            catch (Exception ex)
            {
                Hepsa.Core.Common.MessageBox.ErrorMessage(ex.Message);
            }
        }