Exemple #1
0
        public FrmStationMap()
        {
            InitializeComponent();

            publicStreetGroup = this;

            setImages();

            ToolStripEvent();

            Load += OnFormLoad;

            iTransType = TransactionTypeCode.Null;

            OnFormLoad(null, null);

            bttnUpdate.Click += bttnUpdate_Click;

            btnReport.Click += btnReport_Click;
        }
Exemple #2
0
        void ImportCsvFile()
        {
            //if (dateTimePicker1.Value >= DateTime.Now.Date)
            //{
            //    Common.setMessageBox("Transaction Date Must be Less than Today's Date", Program.ApplicationName, 3);
            //    return;
            //}
            //else
            if (_backupdb.doBackUp("TaxSmartSuiteRevised") == "Done")
            {
                bool bResponse = false;
                bool isError   = false;
                using (WaitDialogForm form = new WaitDialogForm())
                {
                    //strDate = GetValidateionDate;
                    //if (string.IsNullOrEmpty(strDate))
                    //    return;
                    //if (!ValidateDate()) return;
                    if (CheuqeOption == "0001")
                    {//import normal paydirect record
                        try
                        {
                            strDate = GetValidateionDate;
                            if (string.IsNullOrEmpty(strDate))
                            {
                                return;
                            }
                            if (!ValidateDate())
                            {
                                return;
                            }
                            using (SqlConnection connect = new SqlConnection(Logic.ConnectionString))
                            {
                                connect.Open();
                                command = new SqlCommand("insertCollectionReportPay", connect)
                                {
                                    CommandType = CommandType.StoredProcedure
                                };
                                command.Parameters.Add(new SqlParameter("@CollectionReport_Temp", SqlDbType.Structured)).Value = Dt;
                                command.Parameters.Add(new SqlParameter("@User", SqlDbType.VarChar)).Value         = user;
                                command.Parameters.Add(new SqlParameter("@ValidateDate", SqlDbType.VarChar)).Value = strDate;
                                //command.Parameters.Add(new SqlParameter("@DateValidate", SqlDbType.DateTime)).Value = dateTimePicker1.Value;
                                command.CommandTimeout = 10000;
                                using (System.Data.DataSet ds = new System.Data.DataSet())
                                {
                                    adp = new SqlDataAdapter(command);
                                    adp.Fill(ds);
                                    Dts = ds.Tables[0];
                                    connect.Close();

                                    if (ds.Tables[0].Rows[0]["returnCode"].ToString() == "02")
                                    {
                                        Common.setMessageBox(ds.Tables[0].Rows[0]["returnMessage"].ToString(), Program.ApplicationName, 3);
                                        isError = true;
                                        goto Map;
                                    }
                                    bResponse = true;
                                }
                            }
                        }
                        catch (Exception ex)
                        {
                            bResponse = false;
                            MessageBox.Show(ex.Message, " CSV Import ", MessageBoxButtons.OK, MessageBoxIcon.Error); return;
                        }
                    }
                    if (CheuqeOption.ToString() == "0003")
                    {
                        //update cheque bank status in the collection report table
                        try
                        {
                            strDate = GetValidateionDate;
                            if (string.IsNullOrEmpty(strDate))
                            {
                                return;
                            }
                            using (SqlConnection connect = new SqlConnection(Logic.ConnectionString))
                            {
                                connect.Open();
                                command = new SqlCommand("UpdateCollectionChequeStatus", connect)
                                {
                                    CommandType = CommandType.StoredProcedure
                                };
                                command.Parameters.Add(new SqlParameter("@CollectionDownloadCredentials_Temp", SqlDbType.Structured)).Value = Dt;
                                command.Parameters.Add(new SqlParameter("@User", SqlDbType.VarChar)).Value = user;
                                command.Parameters.Add(new SqlParameter("@OnlineCurrentDate", SqlDbType.VarChar)).Value = strDate;//dateTimePicker1.Value.ToString("MM/dd/yyyy");

                                command.CommandTimeout = 10000;
                                using (System.Data.DataSet ds = new System.Data.DataSet())
                                {
                                    adp = new SqlDataAdapter(command);
                                    adp.Fill(ds);
                                    //if (ds.Tables[0].Rows[0]["returnCode"].ToString() == "-1")
                                    //    MessageBox.Show(ds.Tables[0].Rows[0]["returnMessage"].ToString(), " CSV Import ", MessageBoxButtons.OK, MessageBoxIcon.Error);
                                    Dts = ds.Tables[0];
                                    connect.Close();

                                    if (ds.Tables[0].Rows[0]["returnCode"].ToString() != "00")
                                    {
                                        if (ds.Tables[0].Rows[0]["returnCode"].ToString() == "04")
                                        {
                                            Common.setMessageBox(ds.Tables[0].Rows[0]["returnMessage"].ToString().Replace("###", dateTimePicker1.Value.ToLongDateString()), Program.ApplicationName, 3);
                                        }
                                        else
                                        {
                                            Common.setMessageBox(ds.Tables[0].Rows[0]["returnMessage"].ToString(), Program.ApplicationName, 3);
                                        }
                                        return;
                                    }

                                    bResponse = true;
                                }
                            }
                        }
                        catch (Exception ex)
                        {
                            bResponse = false;
                            MessageBox.Show(ex.Message, " CSV Import ", MessageBoxButtons.OK, MessageBoxIcon.Error);
                            return;
                        }
                    }
                }
Map:
                if (isError)
                {
                    using (FrmStationMap frmStationMap = new FrmStationMap())
                    {
                        frmStationMap.ShowDialog();
                    }
                }
                else
                {
                    if (bResponse && Dts.Rows[0][0].ToString() == "00")
                    {
                        MessageBox.Show(Dts.Rows[0]["returnMessage"].ToString(), " CSV Import ", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        return;
                    }
                    else
                    {
                        MessageBox.Show("Error...", " CSV Import ", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        return;
                    }
                }
            }
            else
            {
                Common.setMessageBox("Could not create backup", Program.ApplicationName, 3);
                return;
            }
        }