Ejemplo n.º 1
0
    public void CreateAccounts(string BrCode, string CustNo, string PrCode, string EDate, string Mid)
    {
        try
        {
            sql = "Select Rec_Prd From AVS_RS Where AccOpen = 'Y' And Rec_Prd <> '" + PrCode + "'";
            DT  = conn.GetDatatable(sql);

            if (DT.Rows.Count > 0)
            {
                for (int i = 0; i < DT.Rows.Count; i++)
                {
                    GlCode = ""; AccNo = "";

                    sql    = "Select GlCode From GlMast Where BrCd = '" + BrCode + "' And SubGlCode = '" + DT.Rows[i]["Rec_Prd"].ToString() + "' ";
                    GlCode = conn.sExecuteScalar(sql);

                    if (GlCode == "2")
                    {
                        sql = "Select (Case When LastNo Is Null Then 1 Else (LastNo+1) End) LastNo From GlMast Where BrCd = '" + BrCode + "' And GlCode = '" + GlCode + "' And SubGlCode = '" + DT.Rows[i]["Rec_Prd"].ToString() + "' ";
                    }
                    else
                    {
                        sql = "Select (Case When LastNo Is Null Then 1 Else (LastNo+1) End) LastNo From GlMast Where BrCd = '" + BrCode + "' And SubGlCode = '" + DT.Rows[i]["Rec_Prd"].ToString() + "' ";
                    }

                    AccNo = conn.sExecuteScalar(sql);
                    if (Convert.ToDouble(AccNo.ToString()) > 0)
                    {
                        sql = "Insert Into Avs_Acc(BrCd, GlCode, SubGlCode, CustNo, AccNo, OpeningDate, Acc_Status, Stage, Mid, PcMac, Acc_Type, Opr_Type, SystemDate) " +
                              "Values('" + BrCode + "', '" + GlCode + "', '" + DT.Rows[i]["Rec_Prd"].ToString() + "', '" + CustNo + "', '" + AccNo + "', '" + conn.ConvertDate(EDate).ToString() + "', '1', '1001', '" + Mid + "','" + conn.PCNAME() + "', '1', '1', GetDate())";
                        Result = conn.sExecuteQuery(sql);

                        if (Result > 0)
                        {
                            if (GlCode == "2")
                            {
                                sql = "Update GlMast Set LastNo = '" + Convert.ToInt32(AccNo) + "' Where BrCd = '" + BrCode + "' And GlCode = '" + GlCode + "' And SubGlCode = '" + DT.Rows[i]["Rec_Prd"].ToString() + "'";
                            }
                            else
                            {
                                sql = "Update GlMast Set LastNo = '" + Convert.ToInt32(AccNo) + "' Where BrCd = '" + BrCode + "' And SubGlCode = '" + DT.Rows[i]["Rec_Prd"].ToString() + "'";
                            }
                            Result = conn.sExecuteQuery(sql);
                        }
                    }
                }
            }
        }
        catch (Exception Ex)
        {
            ExceptionLogging.SendErrorToText(Ex);
        }
    }
Ejemplo n.º 2
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(AccNo.Text))
            {
                MessageBox.Show("Please enter Accession ID");
                AccNo.Focus();
                return;
            }
            else
            {
                if (AccNo.Text == "" || bookTitle.Text == "" || author.Text == "" || dept.Text == "" || isbn.Text == "" || price.Text == "")
                {
                    MessageBox.Show("Please Fill the Record Properly", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }

                try
                {
                    SqlConnection conn = new SqlConnection(str);
                    SqlCommand    cmd  = new SqlCommand("insert into tbl_book ([AcNo],[title],[author],[sub],[dept],[isbn],[edition],[publisher],[pubYear],[price],[vol],[ref]) values('" + AccNo.Text + "','" + bookTitle.Text + "','" + author.Text + "','" + sub.Text + "','" + dept.Text + "','" + isbn.Text + "','" + edition.Text + "','" + publisher.Text + "','" + pubYear.Text + "','" + price.Text + "','" + volume.Text + "','" + reference.Text + "')", conn);

                    try
                    {
                        conn.Open();
                        cmd.ExecuteNonQuery();
                        MessageBox.Show("Book record inserted Succesfully" /*"", MessageBoxButtons.OK, MessageBoxIcon.Information*/);

                        clear();
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.ToString());
                        //    MessageBox.Show("Failed!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    }
                    finally
                    {
                        conn.Close();
                    }
                }
                catch
                {
                }
            }
        }
Ejemplo n.º 3
0
    public void CreateAccounts(string BrCode, string CustNo, string PrCode, string EDate, string Mid)
    {
        try
        {
            sql     = "Select IsNull(IntAccYN, 'N') As IntAccYN From GlMast Where BrCd = '" + BrCode + "' And SubGlCode = '" + PrCode + "'";
            sResult = conn.sExecuteScalar(sql);

            if (sResult.ToString() == "Y")
            {
                sql    = "Select GlCode From GlMast Where BrCd = '" + BrCode + "' And SubGlCode = '" + PrCode + "' ";
                GlCode = conn.sExecuteScalar(sql);

                if (Convert.ToDouble(GlCode) > 0)
                {
                    sql   = "Select (Case When LastNo Is Null Then 1 Else (LastNo+1) End) LastNo From GlMast Where BrCd = '" + BrCode + "' And SubGlCode = '" + PrCode + "' ";
                    AccNo = conn.sExecuteScalar(sql);

                    if (Convert.ToDouble(AccNo.ToString()) > 0)
                    {
                        sql = "Insert Into Avs_Acc(BrCd, GlCode, SubGlCode, CustNo, AccNo, OpeningDate, Acc_Status, Stage, Mid, PcMac, Acc_Type, Opr_Type, SystemDate) " +
                              "Values('" + BrCode + "', '" + GlCode + "', '" + PrCode + "', '" + CustNo + "', '" + AccNo + "', '" + conn.ConvertDate(EDate).ToString() + "', '1', '1003', '" + Mid + "','" + conn.PCNAME() + "', '1', '1', GetDate())";
                        Result = conn.sExecuteQuery(sql);

                        if (Result > 0)
                        {
                            sql    = "Update GlMast Set LastNo = '" + Convert.ToInt32(AccNo) + "' Where BrCd = '" + BrCode + "' And SubGlCode = '" + PrCode + "'";
                            Result = conn.sExecuteQuery(sql);
                        }
                    }
                }
            }
        }
        catch (Exception Ex)
        {
            ExceptionLogging.SendErrorToText(Ex);
        }
    }
 protected void ShowDiv()
 {
     try
     {
         DataSet   dt     = new DataSet();
         DataTable DT     = new DataTable();
         DataTable DT1    = new DataTable();
         DataTable DTOD   = new DataTable();
         string    OpDate = LI.GetAccOpenDate(Session["BRCD"].ToString(), CustNo.Trim().ToString(), Prod.Trim().ToString(), AccNo.Trim().ToString());
         dt = GetLoanStatDetails(OpDate.ToString(), Session["EntryDate"].ToString(), Prod, AccNo, Session["BRCD"].ToString());
         if (dt.Tables[0].Rows.Count > 0)
         {
             GridRecords.DataSource = dt;
             GridRecords.DataBind();
             txtCustId.Text     = dt.Tables[0].Rows[0]["CustNO"].ToString();
             txtBranchCode.Text = Session["BRCD"].ToString();
             txtAccId.Text      = dt.Tables[0].Rows[0]["ACCNO"].ToString();
             //txtAddress.Text = dt.Tables[0].Rows[0]["BR_Add1"].ToString();
             txtAcName.Text      = dt.Tables[0].Rows[0]["CustName"].ToString();
             GLcode.Text         = Prod;
             txtCity.Text        = dt.Tables[0].Rows[0]["City"].ToString() + "-" + dt.Tables[0].Rows[0]["PINCODE"].ToString();
             txtLD.Text          = dt.Tables[0].Rows[0]["LASTINTDATE1"].ToString();
             txtED.Text          = dt.Tables[0].Rows[0]["EDATE1"].ToString();
             txtCustAddress.Text = dt.Tables[0].Rows[0]["FLAT_ROOMNO"].ToString();
             txtSD.Text          = dt.Tables[0].Rows[0]["SANSSIONDATE"].ToString();
             DT = LI.FetchNomineeDetails(dt.Tables[0].Rows[0]["CustNO"].ToString(), Prod.ToString(), Session["BRCD"].ToString());
             if (DT.Rows.Count > 0)
             {
                 GridGurantor.DataSource = DT;
                 GridGurantor.DataBind();
                 //txtNomiee.Text = DT.Rows[0]["Nominee"].ToString();
             }
             DT1 = LI.FetchLoanDetails(dt.Tables[0].Rows[0]["CustNO"].ToString(), dt.Tables[0].Rows[0]["ACCNO"].ToString(), Session["BRCD"].ToString(), Prod);
             if (DT1.Rows.Count > 0)
             {
                 txtIRate.Text = DT1.Rows[0]["INTRate"].ToString() + "%";
                 txtlimit.Text = DT1.Rows[0]["LIMIT"].ToString();
             }
             DTOD = LI.FetchOpeningDate(dt.Tables[0].Rows[0]["CustNO"].ToString(), dt.Tables[0].Rows[0]["ACCNO"].ToString(), Session["BRCD"].ToString(), Prod);
             if (DTOD.Rows.Count > 0)
             {
                 txtPh.Text = DTOD.Rows[0]["Mobile"].ToString();
             }
             ScriptManager.RegisterStartupScript(this, this.GetType(), "ModalView", "<script>$('.bs-example-modal-lg').modal('show');</script>", false);
         }
         else
         {
             lblMessage.Text = "Details Not Found For This Account Number...!!";
             ModalPopup.Show(this.Page);
         }
     }
     catch (Exception Ex)
     {
         ExceptionLogging.SendErrorToText(Ex);
     }
 }