Exemplo n.º 1
0
 private void cmbCity_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (cmbCity.SelectedIndex > 0)
     {
         objCommon.FillAreaCombo(cmbarea, Convert.ToInt32(cmbCity.SelectedValue));
         DataSet             dtArea = new DataSet();
         NameValueCollection para   = new NameValueCollection();
         para.Add("@i_CityID", Convert.ToInt32(cmbCity.SelectedValue).ToString());
         dtArea = CommList.ListOfDataSetRecordwithPara("usp_Area_List", para, "Common - FillAreaCombo");
         if (CommList.Exception != null)
         {
         }
         else
         {
             if (dtArea.Tables[1] != null)
             {
                 if (dtArea.Tables[1].Rows.Count > 0)
                 {
                     txtState.Text = dtArea.Tables[1].Rows[0]["StateName"].ToString();
                 }
             }
         }
     }
 }
Exemplo n.º 2
0
        private void cmbreports_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (cmbreports.SelectedIndex == 1)
            {
                try
                {
                    if (dgvServiceModule.CurrentRow == null)
                    {
                        return;
                    }

                    DataTable           dtReport = new DataTable();
                    NameValueCollection Paralist = new NameValueCollection();
                    Paralist.Add("@i_ServiceId", dgvServiceModule.CurrentRow.Cells["ServiceId"].Value.ToString());
                    dtReport = objList.ListOfRecord("rpt_ServiceModule", Paralist, "ServiceModule - Report");
                    //if (objList.Exception == null)
                    //{
                    //dtReport.TableName = "ServiceModuleRegister";
                    //dtReport.WriteXmlSchema(@"D:\ServiceModuleRegister.xsd");
                    if (System.IO.File.Exists(CurrentUser.ReportPath + "rptServiceModuleRegister.rpt"))
                    {
                        DataView DVReport;
                        DVReport           = dtblItem.DefaultView;
                        DVReport.RowFilter = StrFilter;
                        CrystalDecisions.CrystalReports.Engine.ReportDocument rptDoc = new CrystalDecisions.CrystalReports.Engine.ReportDocument();
                        rptDoc.Load(CurrentUser.ReportPath + "rptServiceModuleRegister.rpt");

                        CurrentUser.AddReportParameters(rptDoc, DVReport.ToTable(), "Service Module", true, true, true, true, false, true, true, false, false, false, true);
                        //CurrentUser.AddExtraParameter(rptDoc);
                        Reports.frmReportViewer fRptView = new Reports.frmReportViewer();
                        fRptView.Text = "Service Module - [Page Size: A4]";
                        fRptView.crViewer.ReportSource = rptDoc;
                        fRptView.ShowDialog();
                    }
                    else
                    {
                        MessageBox.Show("Please check Company Details,\n Go to the Master->Edit->Company Details->ReportPath/DocPath.");
                    }
                    //}
                }
                catch (Exception exc)
                {
                    Utill.Common.ExceptionLogger.writeException("Service Module", exc.StackTrace);
                    MessageBox.Show(Utill.Common.CommonMessage.ExceptionMesg, "Exception");
                }
            }
            else if (cmbreports.SelectedIndex == 2)
            {
                try
                {
                    if (dgvServiceModule.CurrentRow == null)
                    {
                        return;
                    }

                    DataTable dt = new DataTable();
                    // LogoBind(dt);
                    DataSet             dtReport = new DataSet();
                    NameValueCollection Paralist = new NameValueCollection();
                    Paralist.Add("@i_RecID", dgvServiceModule.CurrentRow.Cells["ServiceId"].Value.ToString());
                    dtReport = objList.ListOfDataSetRecordwithPara("rpt_Service_Order", Paralist, "Service Invoice - Report");
                    if (objList.Exception == null)
                    {
                        //dtReport.Tables[0].TableName = "ServiceOrder";
                        //dtReport.Tables[0].WriteXmlSchema(@"D:\ServiceOrder.xsd");
                        if (System.IO.File.Exists(CurrentUser.ReportPath + "rptServiceOrder.rpt"))
                        {
                            CrystalDecisions.CrystalReports.Engine.ReportDocument rptDoc = new CrystalDecisions.CrystalReports.Engine.ReportDocument();
                            rptDoc.Load(CurrentUser.ReportPath + "rptServiceOrder.rpt");
                            //  rptDoc.Database.Tables[1].SetDataSource(dt);
                            rptDoc.Refresh();
                            CurrentUser.AddReportParameters(rptDoc, dtReport.Tables[0], "Service Order", true, true, true, true, false, true, true, false, false, false, true);


                            Reports.frmReportViewer fRptView = new Reports.frmReportViewer();
                            fRptView.Text = "Service Order - [Page Size: A4]";
                            fRptView.crViewer.ReportSource = rptDoc;
                            fRptView.ShowDialog();
                        }
                        else
                        {
                            MessageBox.Show("Please check Company Details,\n Go to the Master->Edit->Company Details->ReportPath/DocPath.");
                        }
                    }
                }
                catch (Exception exc)
                {
                    Utill.Common.ExceptionLogger.writeException("Service Invoice", exc.StackTrace);
                    MessageBox.Show(Utill.Common.CommonMessage.ExceptionMessage, "Exception");
                }
            }
            else if (cmbreports.SelectedIndex == 3)
            {
                try
                {
                    DataTable dt = new DataTable();
                    LogoBind(dt);
                    if (dgvServiceModule.CurrentRow != null)
                    {
                        DataTable           dtTNC = new DataTable();
                        NameValueCollection para2 = new NameValueCollection();
                        para2.Add("@i_Code", dgvServiceModule.CurrentRow.Cells["RequestNo"].Value.ToString());
                        para2.Add("@i_TNC_Sub", "SERVICE");
                        para2.Add("@i_CompId", CurrentCompany.CompId.ToString());
                        dtTNC = objDA.ExecuteDataTableSP("rpt_Service_TNC", para2, false, ref mException, ref mErrorMsg, "Quotation TNC");



                        DataTable           dtReport = new DataTable();
                        NameValueCollection para     = new NameValueCollection();
                        para.Add("@i_RecID", Convert.ToInt64(dgvServiceModule.CurrentRow.Cells["ServiceId"].Value).ToString());

                        dtReport = objList.ListOfRecord("rpt_ServiceInvoice", para, "ServiceInvoice - Report");
                        if (objList.Exception == null)
                        {
                            if (System.IO.File.Exists(CurrentUser.ReportPath + "rptServiceInvoice.rpt"))
                            {
                                //dtReport.TableName = "ServiceInvoice";
                                //dtReport.WriteXmlSchema(@"D:\ServiceInvoice.xsd");
                                CrystalDecisions.CrystalReports.Engine.ReportDocument rptDoc = new CrystalDecisions.CrystalReports.Engine.ReportDocument();
                                rptDoc.Load(CurrentUser.ReportPath + "rptServiceInvoice.rpt");
                                rptDoc.Subreports[0].DataSourceConnections.Clear();
                                rptDoc.Subreports[0].Database.Tables[0].SetDataSource(dtTNC);
                                rptDoc.Database.Tables[1].SetDataSource(dt);
                                rptDoc.Refresh();
                                CurrentUser.AddReportParameters(rptDoc, dtReport, "Service Invoice", true, true, true, true, true, true, true, true, true, true, true);
                                CurrentUser.AddExtraParameter(rptDoc);
                                Reports.frmReportViewer fRptView = new Reports.frmReportViewer();
                                fRptView.Text = "Labour Invoice - [Page Size: A4]";
                                fRptView.crViewer.ReportSource = rptDoc;
                                fRptView.ShowDialog();
                            }
                            else
                            {
                                MessageBox.Show("Please check Company Details,\n Go to the Master->Edit->Company Details->ReportPath/DocPath.");
                            }
                        }
                        else
                        {
                            MessageBox.Show(objList.Exception.Message, "Exception", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        }
                    }
                }
                catch (Exception exc)
                {
                    Utill.Common.ExceptionLogger.writeException("Sales Invoice", exc.StackTrace);
                    MessageBox.Show(Utill.Common.CommonMessage.ExceptionMessage, "Exception");
                }
            }
            else if (cmbreports.SelectedIndex == 4)
            {
                try
                {
                    if (dgvServiceModule.CurrentRow == null)
                    {
                        return;
                    }

                    DataTable           dtReport = new DataTable();
                    NameValueCollection Paralist = new NameValueCollection();
                    Paralist.Add("@i_ServiceId", dgvServiceModule.CurrentRow.Cells["ServiceId"].Value.ToString());
                    dtReport = objList.ListOfRecord("rpt_ServiceModule", Paralist, "ServiceModule - Report");
                    //if (objList.Exception == null)
                    //{
                    //dtReport.TableName = "ServiceModuleRegister";
                    //dtReport.WriteXmlSchema(@"D:\ServiceModuleRegister.xsd");
                    if (System.IO.File.Exists(CurrentUser.ReportPath + "rptServiceVouchar.rpt"))
                    {
                        DataView DVReport;
                        DVReport           = dtblItem.DefaultView;
                        DVReport.RowFilter = StrFilter;
                        CrystalDecisions.CrystalReports.Engine.ReportDocument rptDoc = new CrystalDecisions.CrystalReports.Engine.ReportDocument();
                        rptDoc.Load(CurrentUser.ReportPath + "rptServiceVouchar.rpt");

                        CurrentUser.AddReportParameters(rptDoc, DVReport.ToTable(), "Service Module", true, true, true, true, false, true, true, false, false, false, true);

                        Reports.frmReportViewer fRptView = new Reports.frmReportViewer();
                        fRptView.Text = "Service Module - [Page Size: A4]";
                        fRptView.crViewer.ReportSource = rptDoc;
                        fRptView.ShowDialog();
                    }
                    else
                    {
                        MessageBox.Show("File is not exist...");
                    }
                    //}
                }
                catch (Exception exc)
                {
                    Utill.Common.ExceptionLogger.writeException("Service Module", exc.StackTrace);
                    MessageBox.Show(Utill.Common.CommonMessage.ExceptionMesg, "Exception");
                }
            }

            cmbreports.SelectedIndex = 0;
        }
Exemplo n.º 3
0
        //private void frmGodownList_Load(object sender, EventArgs e)
        //{
        //    AddHandlers(this);
        //    SetControlsDefaults(this);
        //    LoadList();
        //    dgvUsers_SelectionChanged(sender, e);
        //}

        #endregion

        #region "Private Helper Methods"

        private void LoadList()
        {
            try
            {
                _isBind = false;

                NameValueCollection para1 = new NameValueCollection();
                _CompId = CurrentCompany.CompId;
                para1.Add("@i_CompId", CurrentCompany.CompId.ToString());
                dtblUser1 = objList.ListOfDataSetRecordwithPara("usp_CompanyInfo_List", para1, "CompanyInfo - LoadList");
                if (objList.Exception == null)
                {
                    if (dgvUsers.CurrentRow != null)
                    {
                        idgvPosition = dgvUsers.CurrentRow.Index;
                    }
                    //dgvUsers.AutoGenerateColumns = false;
                    dgvUsers.DataSource = dtblUser1.Tables[0];

                    for (int i = 0; i < dtblUser1.Tables[0].Rows.Count; i++)
                    {
                        for (int j = 0; j < dtblUser1.Tables[1].Rows.Count; j++)
                        {
                            if (dtblUser1.Tables[0].Rows[i]["CompId"].ToString() == dtblUser1.Tables[1].Rows[j]["CompId"].ToString())
                            {
                                dtblUser1.Tables[0].Rows[i]["UserName"] = dtblUser1.Tables[1].Rows[j]["UserName"].ToString();
                                dtblUser1.Tables[0].Rows[i]["Password"] = dtblUser1.Tables[1].Rows[j]["Password"].ToString();
                                break;
                            }
                        }
                    }
                    dgvUsers.DataSource = dtblUser1.Tables[0];

                    lblTotRec.Text = Utill.Common.CommonMessage.TotalRecord + dgvUsers.RowCount.ToString();
                    if (dgvUsers.CurrentRow != null && idgvPosition <= dgvUsers.RowCount)
                    {
                        if (dgvUsers.Rows.Count - 1 < idgvPosition)
                        {
                            dgvUsers.CurrentCell = dgvUsers.Rows[idgvPosition - 1].Cells[0];
                        }
                        else
                        {
                            dgvUsers.CurrentCell = dgvUsers.Rows[idgvPosition].Cells[0];
                        }
                    }
                    ArrangeDataGridView();
                    _isBind = true;
                    dgvUsers.Columns["Password"].Visible = false;
                    dgvUsers.Columns["CompId"].Visible   = false;
                }
                else
                {
                    MessageBox.Show(objList.Exception.Message, "Exception", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            catch (Exception exc)
            {
                Utill.Common.ExceptionLogger.writeException("CompanyInfo", exc.StackTrace);
                MessageBox.Show(Utill.Common.CommonMessage.ExceptionMesg, "Exception");
            }
        }