protected void btn_Confirm_Click(object sender, EventArgs e)
    {
        string        email = Session["Email1"].ToString();
        ClsConnection obj   = new ClsConnection();
        SqlConnection con1  = obj.connect1();
        ClsConnection obj1  = new ClsConnection();
        SqlConnection con2  = obj1.connect2();
        ClsConnection obj2  = new ClsConnection();
        SqlConnection con3  = obj2.connect3();

        using (con1)
        {
            con1.Open();
            SqlCommand cmd = new SqlCommand("update tbl_Bank set Password='******' where Email='" + email + "'", con1);
            cmd.ExecuteNonQuery();
            con1.Close();
        }
        using (con2)
        {
            con2.Open();
            SqlCommand cmd = new SqlCommand("update tbl_Bank set Password='******' where Email='" + email + "'", con2);
            cmd.ExecuteNonQuery();
            con2.Close();
        }
        using (con3)
        {
            con3.Open();
            SqlCommand cmd = new SqlCommand("update tbl_Bank set Password='******' where Email='" + email + "'", con3);
            cmd.ExecuteNonQuery();
            con3.Close();
        }
        Alert.Show("Password Changed");
    }
예제 #2
0
    private void get_creditdetails()
    {
        ClsConnection obj1 = new ClsConnection();
        SqlConnection con1 = obj1.connect1();
        ClsConnection obj2 = new ClsConnection();
        SqlConnection con2 = obj2.connect2();
        ClsConnection obj3 = new ClsConnection();
        SqlConnection con3 = obj3.connect3();

        using (con1)
        {
            con1.Open();
            string        bank_id = Session["Bank_Id"].ToString();
            SqlCommand    cmd     = new SqlCommand("select * from tbl_Bank where Bank_Id='" + bank_id + "'", con1);
            SqlDataReader dr      = cmd.ExecuteReader();
            if (dr.Read())
            {
                SqlCommand cmd2 = new SqlCommand("insert into tbl_CreditDeposit values('" + txt_AccountNo.Text + "','" + txt_Name.Text + "','" + txt_AdharNo.Text + "','" + txt_Amount.Text + "','" + txt_MobileNo.Text + "','" + txt_EmailId.Text + "','" + txt_Date.Text + "')", con1);
                dr.Close();
                cmd2.ExecuteNonQuery();
            }
            con1.Close();
        }
        using (con2)
        {
            con2.Open();
            string        bank_id = Session["Bank_Id"].ToString();
            SqlCommand    cmd     = new SqlCommand("select * from tbl_Bank where Bank_Id='" + bank_id + "'", con2);
            SqlDataReader dr      = cmd.ExecuteReader();
            if (dr.Read())
            {
                SqlCommand cmd2 = new SqlCommand("insert into tbl_CreditDeposit values('" + txt_AccountNo.Text + "','" + txt_Name.Text + "','" + txt_AdharNo.Text + "','" + txt_Amount.Text + "','" + txt_MobileNo.Text + "','" + txt_EmailId.Text + "','" + txt_Date.Text + "')", con2);
                dr.Close();
                cmd2.ExecuteNonQuery();
            }
            con2.Close();
        }
        using (con3)
        {
            con3.Open();
            string        bank_id = Session["Bank_Id"].ToString();
            SqlCommand    cmd     = new SqlCommand("select * from tbl_Bank where Bank_Id='" + bank_id + "'", con3);
            SqlDataReader dr      = cmd.ExecuteReader();
            if (dr.Read())
            {
                SqlCommand cmd2 = new SqlCommand("insert into tbl_CreditDeposit values('" + txt_AccountNo.Text + "','" + txt_Name.Text + "','" + txt_AdharNo.Text + "','" + txt_Amount.Text + "','" + txt_MobileNo.Text + "','" + txt_EmailId.Text + "','" + txt_Date.Text + "')", con3);
                dr.Close();
                cmd2.ExecuteNonQuery();
            }
            con3.Close();
        }

        send_email();
        clear();
        Alert.Show("Credit Card Details Saved");
    }
예제 #3
0
    private void load_branches()
    {
        ClsConnection obj  = new ClsConnection();
        SqlConnection con1 = obj.connect1();
        ClsConnection obj1 = new ClsConnection();
        SqlConnection con2 = obj1.connect2();
        ClsConnection obj2 = new ClsConnection();
        SqlConnection con3 = obj2.connect3();

        using (con1)
        {
            con1.Open();
            SqlDataAdapter adp = new SqlDataAdapter("select Branch,Bank_Id from tbl_Bank where Bank_No='" + drp_usertype.SelectedItem.ToString() + "'", con1);
            DataTable      dt  = new DataTable();
            adp.Fill(dt);
            if (dt.Rows.Count > 0)
            {
                drp_branch.DataSource     = dt;
                drp_branch.DataTextField  = "Branch";
                drp_branch.DataValueField = "Bank_Id";
                drp_branch.DataBind();
            }

            con1.Close();
        }
        using (con2)
        {
            con2.Open();
            SqlDataAdapter adp1 = new SqlDataAdapter("select Branch,Bank_Id from tbl_Bank where Bank_No='" + drp_usertype.SelectedItem.ToString() + "'", con2);
            DataTable      dt1  = new DataTable();
            adp1.Fill(dt1);
            if (dt1.Rows.Count > 0)
            {
                drp_branch.DataSource     = dt1;
                drp_branch.DataTextField  = "Branch";
                drp_branch.DataValueField = "Bank_Id";
                drp_branch.DataBind();
            }
            con2.Close();
        }
        using (con3)
        {
            con3.Open();
            SqlDataAdapter adp2 = new SqlDataAdapter("select Branch,Bank_Id from tbl_Bank where Bank_No='" + drp_usertype.SelectedItem.ToString() + "'", con3);
            DataTable      dt2  = new DataTable();
            adp2.Fill(dt2);
            if (dt2.Rows.Count > 0)
            {
                drp_branch.DataSource     = dt2;
                drp_branch.DataTextField  = "Branch";
                drp_branch.DataValueField = "Bank_Id";
                drp_branch.DataBind();
            }
            con3.Close();
        }
    }
    private void view_loandetails()
    {
        ClsConnection obj1 = new ClsConnection();
        SqlConnection con1 = obj1.connect1();
        ClsConnection obj2 = new ClsConnection();
        SqlConnection con2 = obj2.connect2();
        ClsConnection obj3 = new ClsConnection();
        SqlConnection con3 = obj3.connect3();

        using (con1)
        {
            con1.Open();
            string         Loan_Id = Session["Loan_Id"].ToString();
            string         bank_id = Session["Bank_Id"].ToString();
            SqlDataAdapter adp     = new SqlDataAdapter("select * from tbl_Loan where Loan_Id='" + Loan_Id + "' AND Bank_Id='" + bank_id + "'", con1);
            DataTable      dt      = new DataTable();
            adp.Fill(dt);
            if (dt.Rows.Count > 0)
            {
                grd_EditLoan.DataSource = dt;
                grd_EditLoan.DataBind();
            }
            con1.Close();
        }
        using (con2)
        {
            con2.Open();
            string         Loan_Id = Session["Loan_Id"].ToString();
            string         bank_id = Session["Bank_Id"].ToString();
            SqlDataAdapter adp     = new SqlDataAdapter("select * from tbl_Loan where Bank_Id='" + bank_id + "' AND Bank_Id='" + bank_id + "'", con2);
            DataTable      dt1     = new DataTable();
            adp.Fill(dt1);
            if (dt1.Rows.Count > 0)
            {
                grd_EditLoan.DataSource = dt1;
                grd_EditLoan.DataBind();
            }
            con2.Close();
        }
        using (con3)
        {
            con3.Open();
            string         Loan_Id = Session["Loan_Id"].ToString();
            string         bank_id = Session["Bank_Id"].ToString();
            SqlDataAdapter adp     = new SqlDataAdapter("select * from tbl_Loan where Bank_Id='" + bank_id + "' AND Bank_Id='" + bank_id + "'", con3);
            DataTable      dt2     = new DataTable();
            adp.Fill(dt2);
            if (dt2.Rows.Count > 0)
            {
                grd_EditLoan.DataSource = dt2;
                grd_EditLoan.DataBind();
            }
            con3.Close();
        }
    }
예제 #5
0
 private void get_keydetails()
 {
     try
     {
         ClsConnection obj1 = new ClsConnection();
         SqlConnection con1 = obj1.connect1();
         ClsConnection obj2 = new ClsConnection();
         SqlConnection con2 = obj2.connect2();
         ClsConnection obj3 = new ClsConnection();
         SqlConnection con3 = obj3.connect3();
         ClsConnection obj  = new ClsConnection();
         SqlConnection con  = obj.connect();
         using (con1)
         {
             con1.Open();
             string        Bank_id = Session["Bank_Id"].ToString();
             SqlCommand    cmd     = new SqlCommand("select KeyInfo from tbl_Loan where Bank_Id='" + Bank_id + "' AND AdharId='" + txt_AdharId.Text + "'", con1);
             SqlDataReader dr      = cmd.ExecuteReader();
             if (dr.Read())
             {
                 txt_Key.Text = dr["KeyInfo"].ToString();
             }
             con1.Close();
         }
         using (con2)
         {
             con2.Open();
             string        Bank_id = Session["Bank_Id"].ToString();
             SqlCommand    cmd     = new SqlCommand("select KeyInfo from tbl_Loan where Bank_Id='" + Bank_id + "' AND AdharId='" + txt_AdharId.Text + "'", con2);
             SqlDataReader dr      = cmd.ExecuteReader();
             if (dr.Read())
             {
                 txt_Key.Text = dr["KeyInfo"].ToString();
             }
             con2.Close();
         }
         using (con3)
         {
             con3.Open();
             string        Bank_id = Session["Bank_Id"].ToString();
             SqlCommand    cmd     = new SqlCommand("select KeyInfo from tbl_Loan where Bank_Id='" + Bank_id + "' AND AdharId='" + txt_AdharId.Text + "'", con3);
             SqlDataReader dr      = cmd.ExecuteReader();
             if (dr.Read())
             {
                 txt_Key.Text = dr["KeyInfo"].ToString();
             }
             con3.Close();
         }
     }
     catch (Exception exp)
     {
     }
 }
예제 #6
0
    private void send_email()
    {
        ClsConnection obj1 = new ClsConnection();
        SqlConnection con1 = obj1.connect1();
        ClsConnection obj2 = new ClsConnection();
        SqlConnection con2 = obj2.connect2();
        ClsConnection obj3 = new ClsConnection();
        SqlConnection con3 = obj3.connect3();

        using (con1)
        {
            con1.Open();
            string        bank_id = Session["Bank_Id"].ToString();
            SqlCommand    cmd     = new SqlCommand("select * from tbl_Bank where Bank_Id='" + bank_id + "'", con1);
            SqlDataReader dr      = cmd.ExecuteReader();
            if (dr.Read())
            {
                SqlCommand cmd2 = new SqlCommand("select Right(Account_No,3) from tbl_CreditDeposit where EmailId='" + txt_EmailId.Text + "'", con1);
                dr.Close();
                string      acc_no = (string)cmd2.ExecuteScalar();
                string      email  = txt_EmailId.Text;
                MailMessage mail   = new MailMessage();
                mail.To.Add(email);
                mail.From    = new MailAddress("*****@*****.**");
                mail.Subject = "Message";
                string name   = "Name :" + txt_Name.Text;
                string Acc_no = "Account No :" + "xxxxxxxxxxxxxxxxx" + acc_no;
                string amount = "Your Account Credited is" + txt_Amount.Text;
                mail.Body       = name + " " + Acc_no + " " + amount + " ";
                mail.IsBodyHtml = true;
                System.Net.Mail.SmtpClient smtp = new System.Net.Mail.SmtpClient();
                smtp.Host           = "smtp.gmail.com";
                smtp.Port           = 587;
                smtp.EnableSsl      = true;
                smtp.DeliveryMethod = System.Net.Mail.SmtpDeliveryMethod.Network;
                smtp.Credentials    = new System.Net.NetworkCredential("*****@*****.**", "8907246218");
                smtp.Send(mail);
            }
            con1.Close();
        }
        using (con2)
        {
            con2.Open();
            string        bank_id = Session["Bank_Id"].ToString();
            SqlCommand    cmd     = new SqlCommand("select * from tbl_Bank where Bank_Id='" + bank_id + "'", con2);
            SqlDataReader dr      = cmd.ExecuteReader();
            if (dr.Read())
            {
                SqlCommand cmd2 = new SqlCommand("select Right(Account_No,3) from tbl_CreditDeposit where EmailId='" + txt_EmailId.Text + "'", con2);
                dr.Close();
                string      acc_no = (string)cmd2.ExecuteScalar();
                string      email  = txt_EmailId.Text;
                MailMessage mail   = new MailMessage();
                mail.To.Add(email);
                mail.From    = new MailAddress("*****@*****.**");
                mail.Subject = "Message";
                string name   = "Name :" + txt_Name.Text;
                string Acc_no = "Account No :" + "xxxxxxxxxxxxxxxxx" + acc_no;
                string amount = "Your Account Credited is" + txt_Amount.Text;
                mail.Body       = name + " " + Acc_no + " " + amount + " ";
                mail.IsBodyHtml = true;
                System.Net.Mail.SmtpClient smtp = new System.Net.Mail.SmtpClient();
                smtp.Host           = "smtp.gmail.com";
                smtp.Port           = 587;
                smtp.EnableSsl      = true;
                smtp.DeliveryMethod = System.Net.Mail.SmtpDeliveryMethod.Network;
                smtp.Credentials    = new System.Net.NetworkCredential("*****@*****.**", "8907246218");
                smtp.Send(mail);
            }
            con2.Close();
        }
        using (con3)
        {
            con3.Open();
            string        bank_id = Session["Bank_Id"].ToString();
            SqlCommand    cmd     = new SqlCommand("select * from tbl_Bank where Bank_Id='" + bank_id + "'", con3);
            SqlDataReader dr      = cmd.ExecuteReader();
            if (dr.Read())
            {
                SqlCommand cmd2 = new SqlCommand("select Right(Account_No,3) from tbl_CreditDeposit where EmailId='" + txt_EmailId.Text + "'", con3);
                dr.Close();
                string      acc_no = (string)cmd2.ExecuteScalar();
                string      email  = txt_EmailId.Text;
                MailMessage mail   = new MailMessage();
                mail.To.Add(email);
                mail.From    = new MailAddress("*****@*****.**");
                mail.Subject = "Message";
                string name   = "Name :" + txt_Name.Text;
                string Acc_no = "Account No :" + "xxxxxxxxxxxxxxxxx" + acc_no;
                string amount = "Your Account Credited is" + txt_Amount.Text;
                mail.Body       = name + " " + Acc_no + " " + amount + " ";
                mail.IsBodyHtml = true;
                System.Net.Mail.SmtpClient smtp = new System.Net.Mail.SmtpClient();
                smtp.Host           = "smtp.gmail.com";
                smtp.Port           = 587;
                smtp.EnableSsl      = true;
                smtp.DeliveryMethod = System.Net.Mail.SmtpDeliveryMethod.Network;
                smtp.Credentials    = new System.Net.NetworkCredential("*****@*****.**", "8907246218");
                smtp.Send(mail);
            }
            con3.Close();
        }
    }
예제 #7
0
    protected void btn_Submit_Click(object sender, EventArgs e)
    {
        if (drp_BankType.SelectedItem.ToString() == "Bank1")
        {
            ClsConnection obj1 = new ClsConnection();
            SqlConnection con1 = obj1.connect1();
            using (con1)
            {
                con1.Open();
                SqlCommand cmd2  = new SqlCommand("select Count(Bank_Id) from tbl_Bank", con1);
                Int32      count = (Int32)cmd2.ExecuteScalar();
                if (count == 0)
                {
                    string     Bank_Id = "Bank" + 1;
                    SqlCommand cmd     = new SqlCommand("insert into tbl_Bank values('" + Bank_Id + "','" + txtbankname.Text + "','" + txt_branch.Text + "','" + txt_IfscCode.Text + "','" + txt_SecretCode.Text + "','" + txt_Email.Text + "','" + txt_MobileNo.Text + "','" + txtusername.Text + "','" + txtpwd.Text + "','" + drp_BankType.SelectedItem.ToString() + "')", con1);
                    cmd.ExecuteNonQuery();
                    send_email();
                }
                else if (count > 0)
                {
                    SqlCommand cmd1   = new SqlCommand("select Max(Bank_Id) from tbl_Bank", con1);
                    string     max    = (string)cmd1.ExecuteScalar();
                    string     BankId = max + 1;
                    SqlCommand cmd    = new SqlCommand("insert into tbl_Bank values('" + BankId + "','" + txtbankname.Text + "','" + txt_branch.Text + "','" + txt_IfscCode.Text + "','" + txt_SecretCode.Text + "','" + txt_Email.Text + "','" + txt_MobileNo.Text + "','" + txtusername.Text + "','" + txtpwd.Text + "','" + drp_BankType.SelectedItem.ToString() + "')", con1);
                    cmd.ExecuteNonQuery();
                    send_email();
                    con1.Close();
                }
            }
        }

        else if (drp_BankType.SelectedItem.ToString() == "Bank2")
        {
            ClsConnection obj2 = new ClsConnection();
            SqlConnection con2 = obj2.connect2();
            using (con2)
            {
                con2.Open();
                SqlCommand cmd2  = new SqlCommand("select Count(Bank_Id) from tbl_Bank", con2);
                Int32      count = (Int32)cmd2.ExecuteScalar();
                if (count == 0)
                {
                    string     Bank_Id = "Bank" + 2;
                    SqlCommand cmd     = new SqlCommand("insert into tbl_Bank values('" + Bank_Id + "','" + txtbankname.Text + "','" + txt_branch.Text + "','" + txt_IfscCode.Text + "','" + txt_SecretCode.Text + "','" + txt_Email.Text + "','" + txt_MobileNo.Text + "','" + txtusername.Text + "','" + txtpwd.Text + "','" + drp_BankType.SelectedItem.ToString() + "')", con2);
                    cmd.ExecuteNonQuery();
                    send_email();
                }
                else if (count > 0)
                {
                    SqlCommand cmd1   = new SqlCommand("select Max(Bank_Id) from tbl_Bank", con2);
                    string     max    = (string)cmd1.ExecuteScalar();
                    string     BankId = max + 1;
                    SqlCommand cmd    = new SqlCommand("insert into tbl_Bank values('" + BankId + "','" + txtbankname.Text + "','" + txt_branch.Text + "','" + txt_IfscCode.Text + "','" + txt_SecretCode.Text + "','" + txt_Email.Text + "','" + txt_MobileNo.Text + "','" + txtusername.Text + "','" + txtpwd.Text + "','" + drp_BankType.SelectedItem.ToString() + "')", con2);
                    cmd.ExecuteNonQuery();
                    send_email();
                    con2.Close();
                }
            }
        }
        else if (drp_BankType.SelectedItem.ToString() == "Bank3")
        {
            ClsConnection obj3 = new ClsConnection();
            SqlConnection con3 = obj3.connect3();
            using (con3)
            {
                con3.Open();
                SqlCommand cmd2  = new SqlCommand("select Count(Bank_Id) from tbl_Bank", con3);
                Int32      count = (Int32)cmd2.ExecuteScalar();
                if (count == 0)
                {
                    string     Bank_Id = "Bank" + 3;
                    SqlCommand cmd     = new SqlCommand("insert into tbl_Bank values('" + Bank_Id + "','" + txtbankname.Text + "','" + txt_branch.Text + "','" + txt_IfscCode.Text + "','" + txt_SecretCode.Text + "','" + txt_Email.Text + "','" + txt_MobileNo.Text + "','" + txtusername.Text + "','" + txtpwd.Text + "','" + drp_BankType.SelectedItem.ToString() + "')", con3);
                    cmd.ExecuteNonQuery();
                    send_email();
                }
                else if (count > 0)
                {
                    SqlCommand cmd1   = new SqlCommand("select Max(Bank_Id) from tbl_Bank", con3);
                    string     max    = (string)cmd1.ExecuteScalar();
                    string     BankId = max + 1;
                    SqlCommand cmd    = new SqlCommand("insert into tbl_Bank values('" + BankId + "','" + txtbankname.Text + "','" + txt_branch.Text + "','" + txt_IfscCode.Text + "','" + txt_SecretCode.Text + "','" + txt_Email.Text + "','" + txt_MobileNo.Text + "','" + txtusername.Text + "','" + txtpwd.Text + "','" + drp_BankType.SelectedItem.ToString() + "')", con3);
                    cmd.ExecuteNonQuery();
                    send_email();
                    con3.Close();
                }
            }
        }
        else
        {
            Alert.Show("Select Any Bank");
        }
        clear();
        Alert.Show("Bank Registration Successfully");
    }
    private void getloandetails()
    {
        ClsConnection obj1 = new ClsConnection();
        SqlConnection con1 = obj1.connect1();
        ClsConnection obj2 = new ClsConnection();
        SqlConnection con2 = obj2.connect2();
        ClsConnection obj3 = new ClsConnection();
        SqlConnection con3 = obj3.connect3();

        using (con1)
        {
            con1.Open();
            string        bank_id = Session["Bank_Id"].ToString();
            string        Loan_Id = Session["Loan_Id"].ToString();
            SqlCommand    cmd     = new SqlCommand("select * from tbl_Loan where Loan_Id='" + Loan_Id + "' AND Bank_Id='" + bank_id + "'", con1);
            SqlDataReader dr      = cmd.ExecuteReader();
            if (dr.Read())
            {
                txt_BankName.Text        = dr["BankName"].ToString();
                txt_LoanStartedDate.Text = dr["Loan_StartedDate"].ToString();
                txt_Name.Text            = dr["Name"].ToString();
                txt_LoanName.Text        = dr["LoanName"].ToString();
                txt_Amount.Text          = dr["LoanAmount"].ToString();
                txt_Balance.Text         = dr["Balance"].ToString();
            }
            con1.Close();
        }
        using (con2)
        {
            con2.Open();
            string        bank_id = Session["Bank_Id"].ToString();
            string        Loan_Id = Session["Loan_Id"].ToString();
            SqlCommand    cmd     = new SqlCommand("select * from tbl_Loan where Loan_Id='" + Loan_Id + "' AND Bank_Id='" + bank_id + "'", con2);
            SqlDataReader dr      = cmd.ExecuteReader();
            if (dr.Read())
            {
                txt_BankName.Text        = dr["BankName"].ToString();
                txt_LoanStartedDate.Text = dr["Loan_StartedDate"].ToString();
                txt_Name.Text            = dr["Name"].ToString();
                txt_LoanName.Text        = dr["LoanName"].ToString();
                txt_Amount.Text          = dr["LoanAmount"].ToString();
                txt_Balance.Text         = dr["Balance"].ToString();
            }
            con2.Close();
        }
        using (con3)
        {
            con3.Open();
            string        bank_id = Session["Bank_Id"].ToString();
            string        Loan_Id = Session["Loan_Id"].ToString();
            SqlCommand    cmd     = new SqlCommand("select * from tbl_Loan where Loan_Id='" + Loan_Id + "' AND Bank_Id='" + bank_id + "'", con3);
            SqlDataReader dr      = cmd.ExecuteReader();
            if (dr.Read())
            {
                txt_BankName.Text        = dr["BankName"].ToString();
                txt_LoanStartedDate.Text = dr["Loan_StartedDate"].ToString();
                txt_Name.Text            = dr["Name"].ToString();
                txt_LoanName.Text        = dr["LoanName"].ToString();
                txt_Amount.Text          = dr["LoanAmount"].ToString();
                txt_Balance.Text         = dr["Balance"].ToString();
            }
            con3.Close();
        }
    }
    private void update_loandetails()
    {
        ClsConnection obj1 = new ClsConnection();
        SqlConnection con1 = obj1.connect1();
        ClsConnection obj2 = new ClsConnection();
        SqlConnection con2 = obj2.connect2();
        ClsConnection obj3 = new ClsConnection();
        SqlConnection con3 = obj3.connect3();

        using (con1)
        {
            con1.Open();
            string        bank_id     = Session["Bank_Id"].ToString();
            string        Loan_Id     = Session["Loan_Id"].ToString();
            string        paymentdate = DateTime.Now.Date.ToString("dd/MM/yyyy");
            SqlCommand    cmd         = new SqlCommand("select * from tbl_Loan where Loan_Id='" + Loan_Id + "' AND Bank_Id='" + bank_id + "'", con1);
            SqlDataReader dr          = cmd.ExecuteReader();
            if (dr.Read())
            {
                string   payment_status  = dr["Status"].ToString();
                DateTime Loan_FirstDate  = Convert.ToDateTime(dr["Loan_FirstDate"].ToString());
                DateTime Loan_SecondDate = Convert.ToDateTime(dr["Loan_SecondDate"].ToString());
                DateTime Loan_ThirdDate  = Convert.ToDateTime(dr["Loan_ThirdDate"].ToString());
                DateTime Loan_issuedDate = Convert.ToDateTime(txt_LoanStartedDate.Text);
                if (payment_status == "Pending")
                {
                    int oldbalance    = Convert.ToInt32(txt_Balance.Text);
                    int paymentamount = Convert.ToInt32(txt_PaymentAmount.Text);
                    int newbalance    = oldbalance - paymentamount;
                    txt_Balance.Text = newbalance.ToString();
                    SqlCommand cmd1 = new SqlCommand("update tbl_Loan set PaymentAmount='" + txt_PaymentAmount.Text + "',Balance='" + newbalance + "',PaymentDate='" + paymentdate + "',Status='" + drp_Status.SelectedItem.ToString() + "' where BankName='" + txt_BankName.Text + "' AND Loan_Id='" + Loan_Id + "' AND Bank_Id='" + bank_id + "'", con1);
                    dr.Close();
                    cmd1.ExecuteNonQuery();
                }
                else
                {
                    if (payment_status == "Not Paid" || payment_status == "First Payment" || payment_status == "Second Payment")
                    {
                        if (Loan_issuedDate < Loan_FirstDate || Loan_issuedDate < Loan_SecondDate || Loan_issuedDate < Loan_ThirdDate)
                        {
                            int oldbalance    = Convert.ToInt32(txt_Balance.Text);
                            int paymentamount = Convert.ToInt32(txt_PaymentAmount.Text);
                            int newbalance    = oldbalance - paymentamount;
                            txt_Balance.Text = newbalance.ToString();
                            //string scoringfactor = "Regular Payment";
                            //string scoringrating;
                            if (paymentamount >= 1000)
                            {
                                //scoringrating = "1000";
                                SqlCommand cmd2 = new SqlCommand("update tbl_Loan set PaymentAmount='" + txt_PaymentAmount.Text + "',Balance='" + newbalance + "',PaymentDate='" + paymentdate + "',Status='" + drp_Status.SelectedItem.ToString() + "' where BankName='" + txt_BankName.Text + "' AND Loan_Id='" + Loan_Id + "' AND Bank_Id='" + bank_id + "'", con1);
                                dr.Close();
                                cmd2.ExecuteNonQuery();
                                Alert.Show("Loan Details Updated");
                            }
                            else if (paymentamount < 1000)
                            {
                                //scoringrating = "589";
                                SqlCommand cmd2 = new SqlCommand("update tbl_Loan set PaymentAmount='" + txt_PaymentAmount.Text + "',Balance='" + newbalance + "',PaymentDate='" + paymentdate + "',Status='" + drp_Status.SelectedItem.ToString() + "' where BankName='" + txt_BankName.Text + "' AND Loan_Id='" + Loan_Id + "' AND Bank_Id='" + bank_id + "'", con1);
                                dr.Close();
                                cmd2.ExecuteNonQuery();
                                Alert.Show("Loan Details Updated");
                            }
                        }
                    }

                    else if (payment_status == "Third Payment")
                    {
                        Alert.Show("All Payment Done");
                    }
                }

                //txt_BankName.Text = dr["Bank_Name"].ToString();
            }
            con1.Close();
        }
        using (con2)
        {
            con2.Open();
            string        Loan_Id     = Session["Loan_Id"].ToString();
            string        bank_id     = Session["Bank_Id"].ToString();
            string        paymentdate = DateTime.Now.Date.ToString("dd/MM/yyyy");
            SqlCommand    cmd         = new SqlCommand("select * from tbl_Loan where Loan_Id='" + Loan_Id + "' AND Bank_Id='" + bank_id + "'", con2);
            SqlDataReader dr          = cmd.ExecuteReader();
            if (dr.Read())
            {
                string   payment_status  = dr["Status"].ToString();
                DateTime Loan_FirstDate  = Convert.ToDateTime(dr["Loan_FirstDate"].ToString());
                DateTime Loan_SecondDate = Convert.ToDateTime(dr["Loan_SecondDate"].ToString());
                DateTime Loan_ThirdDate  = Convert.ToDateTime(dr["Loan_ThirdDate"].ToString());
                DateTime Loan_issuedDate = Convert.ToDateTime(txt_LoanStartedDate.Text);
                if (payment_status == "Pending")
                {
                    int oldbalance    = Convert.ToInt32(txt_Balance.Text);
                    int paymentamount = Convert.ToInt32(txt_PaymentAmount.Text);
                    int newbalance    = oldbalance - paymentamount;
                    txt_Balance.Text = newbalance.ToString();
                    SqlCommand cmd2 = new SqlCommand("update tbl_Loan set PaymentAmount='" + txt_PaymentAmount.Text + "',Balance='" + newbalance + "',PaymentDate='" + paymentdate + "',Status='" + drp_Status.SelectedItem.ToString() + "' where BankName='" + txt_BankName.Text + "' AND Loan_Id='" + Loan_Id + "' AND Bank_Id='" + bank_id + "'", con2);
                    dr.Close();
                    cmd2.ExecuteNonQuery();
                }
                else
                {
                    if (payment_status == "Not Paid" || payment_status == "First Payment" || payment_status == "Second Payment")
                    {
                        if (Loan_issuedDate < Loan_FirstDate || Loan_issuedDate < Loan_SecondDate || Loan_issuedDate < Loan_ThirdDate)
                        {
                            int oldbalance    = Convert.ToInt32(txt_Balance.Text);
                            int paymentamount = Convert.ToInt32(txt_PaymentAmount.Text);
                            int newbalance    = oldbalance - paymentamount;
                            txt_Balance.Text = newbalance.ToString();
                            //string scoringfactor = "Regular Payment";
                            //string scoringrating;
                            if (paymentamount >= 1000)
                            {
                                //scoringrating = "1000";
                                SqlCommand cmd2 = new SqlCommand("update tbl_Loan set PaymentAmount='" + txt_PaymentAmount.Text + "',Balance='" + newbalance + "',PaymentDate='" + paymentdate + "',Status='" + drp_Status.SelectedItem.ToString() + "' where BankName='" + txt_BankName.Text + "' AND Loan_Id='" + Loan_Id + "' AND Bank_Id='" + bank_id + "'", con2);
                                dr.Close();
                                cmd2.ExecuteNonQuery();
                                Alert.Show("Loan Details Updated");
                            }
                            else if (paymentamount < 1000)
                            {
                                //scoringrating = "589";
                                SqlCommand cmd2 = new SqlCommand("update tbl_Loan set PaymentAmount='" + txt_PaymentAmount.Text + "',Balance='" + newbalance + "',PaymentDate='" + paymentdate + "',Status='" + drp_Status.SelectedItem.ToString() + "' where BankName='" + txt_BankName.Text + "' AND Loan_Id='" + Loan_Id + "' AND Bank_Id='" + bank_id + "'", con2);
                                dr.Close();
                                cmd2.ExecuteNonQuery();
                                Alert.Show("Loan Details Updated");
                            }
                        }
                    }

                    else if (payment_status == "Third Payment")
                    {
                        Alert.Show("All Payment Done");
                    }
                }

                //txt_BankName.Text = dr["Bank_Name"].ToString();
            }

            con2.Close();
        }
        using (con3)
        {
            con3.Open();
            string        bank_id     = Session["Bank_Id"].ToString();
            string        Loan_Id     = Session["Loan_Id"].ToString();
            string        paymentdate = DateTime.Now.Date.ToString("dd/MM/yyyy");
            SqlCommand    cmd         = new SqlCommand("select * from tbl_Loan where Loan_Id='" + Loan_Id + "' AND Bank_Id='" + bank_id + "'", con3);
            SqlDataReader dr          = cmd.ExecuteReader();
            if (dr.Read())
            {
                string   payment_status  = dr["Status"].ToString();
                DateTime Loan_FirstDate  = Convert.ToDateTime(dr["Loan_FirstDate"].ToString());
                DateTime Loan_SecondDate = Convert.ToDateTime(dr["Loan_SecondDate"].ToString());
                DateTime Loan_ThirdDate  = Convert.ToDateTime(dr["Loan_ThirdDate"].ToString());
                DateTime Loan_issuedDate = Convert.ToDateTime(txt_LoanStartedDate.Text);
                if (payment_status == "Pending")
                {
                    int oldbalance    = Convert.ToInt32(txt_Balance.Text);
                    int paymentamount = Convert.ToInt32(txt_PaymentAmount.Text);
                    int newbalance    = oldbalance - paymentamount;
                    txt_Balance.Text = newbalance.ToString();
                    SqlCommand cmd2 = new SqlCommand("update tbl_Loan set PaymentAmount='" + txt_PaymentAmount.Text + "',Balance='" + newbalance + "',PaymentDate='" + paymentdate + "',Status='" + drp_Status.SelectedItem.ToString() + "' where BankName='" + txt_BankName.Text + "' AND Loan_Id='" + Loan_Id + "' AND Bank_Id='" + bank_id + "'", con3);
                    dr.Close();
                    cmd2.ExecuteNonQuery();
                }
                else
                {
                    if (payment_status == "Not Paid" || payment_status == "First Payment" || payment_status == "Second Payment")
                    {
                        if (Loan_issuedDate < Loan_FirstDate || Loan_issuedDate < Loan_SecondDate || Loan_issuedDate < Loan_ThirdDate)
                        {
                            int oldbalance    = Convert.ToInt32(txt_Balance.Text);
                            int paymentamount = Convert.ToInt32(txt_PaymentAmount.Text);
                            int newbalance    = oldbalance - paymentamount;
                            txt_Balance.Text = newbalance.ToString();
                            //string scoringfactor = "Regular Payment";
                            //string scoringrating;
                            if (paymentamount >= 1000)
                            {
                                //scoringrating = "1000";
                                SqlCommand cmd2 = new SqlCommand("update tbl_Loan set PaymentAmount='" + txt_PaymentAmount.Text + "',Balance='" + newbalance + "',PaymentDate='" + paymentdate + "',Status='" + drp_Status.SelectedItem.ToString() + "' where BankName='" + txt_BankName.Text + "' AND Loan_Id='" + Loan_Id + "' AND Bank_Id='" + bank_id + "'", con3);
                                dr.Close();
                                cmd2.ExecuteNonQuery();
                                Alert.Show("Loan Details Updated");
                            }
                            else if (paymentamount < 1000)
                            {
                                //scoringrating = "589";
                                SqlCommand cmd2 = new SqlCommand("update tbl_Loan set PaymentAmount='" + txt_PaymentAmount.Text + "',Balance='" + newbalance + "',PaymentDate='" + paymentdate + "',Status='" + drp_Status.SelectedItem.ToString() + "' where BankName='" + txt_BankName.Text + "' AND Loan_Id='" + Loan_Id + "' AND Bank_Id='" + bank_id + "'", con3);
                                dr.Close();
                                cmd2.ExecuteNonQuery();
                                Alert.Show("Loan Details Updated");
                            }
                        }
                    }

                    else if (payment_status == "Third Payment")
                    {
                        Alert.Show("All Payment Done");
                    }
                }

                //txt_BankName.Text = dr["Bank_Name"].ToString();
            }

            con3.Close();
        }
        clear();
    }
예제 #10
0
    protected void btnlogin_Click(object sender, EventArgs e)
    {
        ClsConnection obj  = new ClsConnection();
        SqlConnection con1 = obj.connect1();
        ClsConnection obj1 = new ClsConnection();
        SqlConnection con2 = obj1.connect2();
        ClsConnection obj2 = new ClsConnection();
        SqlConnection con3 = obj2.connect3();

        using (con1)
        {
            con1.Open();
            SqlCommand    cmd1 = new SqlCommand("Select UserName,Password,Bank_Id,Bank_Name from tbl_Bank where Bank_No='" + drp_usertype.SelectedItem.ToString() + "' AND Branch='" + drp_branch.SelectedItem.ToString() + "'", con1);
            SqlDataReader dr1  = cmd1.ExecuteReader();
            if (dr1.Read())
            {
                string user_name = dr1["UserName"].ToString();
                string password  = dr1["Password"].ToString();
                string bank_id   = dr1["Bank_Id"].ToString();
                string bank_name = dr1["Bank_Name"].ToString();
                if (txtusername.Text == user_name && txtpassword.Text == password)
                {
                    Session["Bank_Id"]   = bank_id;
                    Session["Bank_Name"] = bank_name;
                    Response.Redirect("~/Users/Bank/AddLoan/AddLoanDetails.aspx");
                }
                else
                {
                    Alert.Show("Invalid UserName && Password !!");
                }
            }
            dr1.Close();
            con1.Close();
        }
        using (con2)
        {
            con2.Open();
            SqlCommand    cmd2 = new SqlCommand("Select UserName,Password,Bank_Id,Bank_Name from tbl_Bank where Bank_No='" + drp_usertype.SelectedItem.ToString() + "' AND Branch='" + drp_branch.SelectedItem.ToString() + "'", con2);
            SqlDataReader dr2  = cmd2.ExecuteReader();
            if (dr2.Read())
            {
                string user_name = dr2["UserName"].ToString();
                string password  = dr2["Password"].ToString();
                string bank_id   = dr2["Bank_Id"].ToString();
                string bank_name = dr2["Bank_Name"].ToString();
                if (txtusername.Text == user_name && txtpassword.Text == password)
                {
                    Session["Bank_Id"]   = bank_id;
                    Session["Bank_Name"] = bank_name;
                    Response.Redirect("~/Users/Bank/AddLoan/AddLoanDetails.aspx");
                }
                else
                {
                    Alert.Show("Invalid UserName && Password !!");
                }
            }
            dr2.Close();
            con2.Close();
        }
        using (con3)
        {
            con3.Open();
            SqlCommand    cmd3 = new SqlCommand("Select UserName,Password,Bank_Id,Bank_Name from tbl_Bank where Bank_No='" + drp_usertype.SelectedItem.ToString() + "' AND Branch='" + drp_branch.SelectedItem.ToString() + "'", con3);
            SqlDataReader dr3  = cmd3.ExecuteReader();
            if (dr3.Read())
            {
                string user_name = dr3["UserName"].ToString();
                string password  = dr3["Password"].ToString();
                string bank_id   = dr3["Bank_Id"].ToString();
                string bank_name = dr3["Bank_Name"].ToString();
                if (txtusername.Text == user_name && txtpassword.Text == password)
                {
                    Session["Bank_Id"]   = bank_id;
                    Session["Bank_Name"] = bank_name;
                    Response.Redirect("~/Users/Bank/AddLoan/AddLoanDetails.aspx");
                }
                else
                {
                    Alert.Show("Invalid UserName && Password !!");
                }
            }
            dr3.Close();
            con3.Close();
        }
    }
    private void insert_details()
    {
        ClsConnection obj1 = new ClsConnection();
        SqlConnection con1 = obj1.connect1();
        ClsConnection obj2 = new ClsConnection();
        SqlConnection con2 = obj2.connect2();
        ClsConnection obj3 = new ClsConnection();
        SqlConnection con3 = obj3.connect3();

        using (con1)
        {
            string bank_id = Session["Bank_Id"].ToString();
            con1.Open();
            SqlCommand    cmd5 = new SqlCommand("select * from tbl_Loan where AdharId='" + txt_AdharId.Text + "'", con1);
            SqlDataReader dr2  = cmd5.ExecuteReader();
            if (dr2.Read())
            {
                string PanCardNo    = dr2["PanCardNo"].ToString();
                string RationCardNo = dr2["RationCardNo"].ToString();
                string Bank_Id      = dr2["Bank_Id"].ToString();
                if (txt_PanCardNo.Text != PanCardNo || txt_RationCardNo.Text != RationCardNo)
                {
                    Alert.Show("Invalid");
                }
                else
                {
                    insert_data1();
                }
            }
            else
            {
                insert_data1();
            }
            dr2.Close();
            con1.Close();
        }
        using (con2)
        {
            con2.Open();
            string        bank_id = Session["Bank_Id"].ToString();
            SqlCommand    cmd5    = new SqlCommand("select * from tbl_Loan where AdharId='" + txt_AdharId.Text + "'", con2);
            SqlDataReader dr2     = cmd5.ExecuteReader();
            if (dr2.Read())
            {
                string PanCardNo    = dr2["PanCardNo"].ToString();
                string RationCardNo = dr2["RationCardNo"].ToString();
                string Bank_Id      = dr2["Bank_Id"].ToString();
                if (txt_PanCardNo.Text != PanCardNo || txt_RationCardNo.Text != RationCardNo)
                {
                    Alert.Show("Invalid");
                }
                else
                {
                    insert_data2();
                }
            }
            else
            {
                insert_data2();
            }
            dr2.Close();
            con2.Close();
        }
        using (con3)
        {
            con3.Open();
            string        bank_id = Session["Bank_Id"].ToString();
            SqlCommand    cmd5    = new SqlCommand("select * from tbl_Loan where AdharId='" + txt_AdharId.Text + "'", con3);
            SqlDataReader dr2     = cmd5.ExecuteReader();
            if (dr2.Read())
            {
                string PanCardNo    = dr2["PanCardNo"].ToString();
                string RationCardNo = dr2["RationCardNo"].ToString();
                string Bank_Id      = dr2["Bank_Id"].ToString();
                if (txt_PanCardNo.Text != PanCardNo || txt_RationCardNo.Text != RationCardNo)
                {
                    Alert.Show("Invalid");
                }
                else
                {
                    insert_data3();
                }
            }
            else
            {
                insert_data3();
            }
            dr2.Close();
            con3.Close();
        }
    }
    private void insert_data3()
    {
        ClsConnection obj3 = new ClsConnection();
        SqlConnection con3 = obj3.connect3();

        using (con3)
        {
            con3.Open();
            string        bank_id = Session["Bank_Id"].ToString();
            SqlCommand    cmd     = new SqlCommand("select * from tbl_Bank where Bank_Id='" + bank_id + "'", con3);
            SqlDataReader dr      = cmd.ExecuteReader();
            if (dr.Read())
            {
                txt_BankName.Text = dr["Bank_Name"].ToString();
                string key = getkeytoencrypt.GetUniqueKey();
                //string A = null;
                string i             = txt_LoanName.Text;
                string loanname      = Encrypt.Encryptdata(i, key, true);
                int    paymentamount = 0;
                string paymentdate   = "No Payment";
                //string scoringfactor = "InSufficient History And Score";
                //string scoringrating = "-1";
                if (drp_LoanDuration.SelectedItem.ToString() == "1Month")
                {
                    string     month_firstdate  = DateTime.Now.Date.AddDays(10).ToString("dd/MM/yyyy");
                    string     month_seconddate = DateTime.Now.Date.AddDays(20).ToString("dd/MM/yyyy");
                    string     month_thirddate  = DateTime.Now.Date.AddDays(30).ToString("dd/MM/yyyy");
                    SqlCommand cmd2             = new SqlCommand("insert into tbl_Loan values('" + bank_id + "','" + txt_BankName.Text + "','" + txt_LoanStartedDate.Text + "' , '" + month_firstdate + "','" + month_seconddate + "','" + month_thirddate + "','" + txt_Name.Text + "','" + txt_AdharId.Text + "','" + txt_PanCardNo.Text + "','" + txt_RationCardNo.Text + "','" + txt_Income.Text + "','" + txt_Address.Text + "','" + loanname + "','" + drp_LoanDuration.SelectedItem.ToString() + "', '" + txt_Amount.Text + "','" + txt_Amount.Text + "','" + paymentdate + "','" + paymentamount + "','" + drp_Status.SelectedItem.ToString() + "','" + key + "')", con3);
                    dr.Close();
                    cmd2.ExecuteNonQuery();
                    Alert.Show("Loan Saved");
                }
                else if (drp_LoanDuration.SelectedItem.ToString() == "3Months")
                {
                    string     month_firstdate  = DateTime.Now.Date.AddMonths(1).ToString("dd/MM/yyyy");
                    string     month_seconddate = DateTime.Now.Date.AddMonths(2).ToString("dd/MM/yyyy");
                    string     month_thirddate  = DateTime.Now.Date.AddMonths(3).ToString("dd/MM/yyyy");
                    SqlCommand cmd2             = new SqlCommand("insert into tbl_Loan values('" + bank_id + "','" + txt_BankName.Text + "','" + txt_LoanStartedDate.Text + "' , '" + month_firstdate + "','" + month_seconddate + "','" + month_thirddate + "','" + txt_Name.Text + "','" + txt_AdharId.Text + "','" + txt_PanCardNo.Text + "','" + txt_RationCardNo.Text + "','" + txt_Income.Text + "','" + txt_Address.Text + "','" + loanname + "','" + drp_LoanDuration.SelectedItem.ToString() + "', '" + txt_Amount.Text + "','" + txt_Amount.Text + "','" + paymentdate + "','" + paymentamount + "','" + drp_Status.SelectedItem.ToString() + "','" + key + "')", con3);
                    dr.Close();
                    cmd2.ExecuteNonQuery();
                    Alert.Show("Loan Saved");
                }
                else if (drp_LoanDuration.SelectedItem.ToString() == "6Months")
                {
                    string     month_firstdate  = DateTime.Now.Date.AddMonths(2).ToString("dd/MM/yyyy");
                    string     month_seconddate = DateTime.Now.Date.AddMonths(4).ToString("dd/MM/yyyy");
                    string     month_thirddate  = DateTime.Now.Date.AddMonths(6).ToString("dd/MM/yyyy");
                    SqlCommand cmd2             = new SqlCommand("insert into tbl_Loan values('" + bank_id + "','" + txt_BankName.Text + "','" + txt_LoanStartedDate.Text + "' , '" + month_firstdate + "','" + month_seconddate + "','" + month_thirddate + "','" + txt_Name.Text + "','" + txt_AdharId.Text + "','" + txt_PanCardNo.Text + "','" + txt_RationCardNo.Text + "','" + txt_Income.Text + "','" + txt_Address.Text + "','" + loanname + "','" + drp_LoanDuration.SelectedItem.ToString() + "', '" + txt_Amount.Text + "','" + txt_Amount.Text + "','" + paymentdate + "','" + paymentamount + "','" + drp_Status.SelectedItem.ToString() + "','" + key + "')", con3);
                    dr.Close();
                    cmd2.ExecuteNonQuery();
                    Alert.Show("Loan Saved");
                }
                else if (drp_LoanDuration.SelectedItem.ToString() == "1Year")
                {
                    string     month_firstdate  = DateTime.Now.Date.AddMonths(4).ToString("dd/MM/yyyy");
                    string     month_seconddate = DateTime.Now.Date.AddMonths(8).ToString("dd/MM/yyyy");
                    string     month_thirddate  = DateTime.Now.Date.AddMonths(12).ToString("dd/MM/yyyy");
                    SqlCommand cmd2             = new SqlCommand("insert into tbl_Loan values('" + bank_id + "','" + txt_BankName.Text + "','" + txt_LoanStartedDate.Text + "' , '" + month_firstdate + "','" + month_seconddate + "','" + month_thirddate + "','" + txt_Name.Text + "','" + txt_AdharId.Text + "','" + txt_PanCardNo.Text + "','" + txt_RationCardNo.Text + "','" + txt_Income.Text + "','" + txt_Address.Text + "','" + loanname + "','" + drp_LoanDuration.SelectedItem.ToString() + "', '" + txt_Amount.Text + "','" + txt_Amount.Text + "','" + paymentdate + "','" + paymentamount + "','" + drp_Status.SelectedItem.ToString() + "','" + key + "')", con3);
                    dr.Close();
                    cmd2.ExecuteNonQuery();
                    Alert.Show("Loan Saved");
                }
                else if (drp_LoanDuration.SelectedItem.ToString() == "3Years")
                {
                    string     month_firstdate  = DateTime.Now.Date.AddMonths(12).ToString("dd/MM/yyyy");
                    string     month_seconddate = DateTime.Now.Date.AddMonths(24).ToString("dd/MM/yyyy");
                    string     month_thirddate  = DateTime.Now.Date.AddMonths(36).ToString("dd/MM/yyyy");
                    SqlCommand cmd2             = new SqlCommand("insert into tbl_Loan values('" + bank_id + "','" + txt_BankName.Text + "','" + txt_LoanStartedDate.Text + "' , '" + month_firstdate + "','" + month_seconddate + "','" + month_thirddate + "','" + txt_Name.Text + "','" + txt_AdharId.Text + "','" + txt_PanCardNo.Text + "','" + txt_RationCardNo.Text + "','" + txt_Income.Text + "','" + txt_Address.Text + "','" + loanname + "','" + drp_LoanDuration.SelectedItem.ToString() + "', '" + txt_Amount.Text + "','" + txt_Amount.Text + "','" + paymentdate + "','" + paymentamount + "','" + drp_Status.SelectedItem.ToString() + "','" + key + "')", con3);
                    dr.Close();
                    cmd2.ExecuteNonQuery();
                    Alert.Show("Loan Saved");
                }
                //Alert.Show("Loan Saved");
            }
            dr.Close();
            con3.Close();
        }
    }
예제 #13
0
    private void get_loanfailures()
    {
        try
        {
            ClsConnection obj1 = new ClsConnection();
            SqlConnection con1 = obj1.connect1();
            ClsConnection obj2 = new ClsConnection();
            SqlConnection con2 = obj2.connect2();
            ClsConnection obj3 = new ClsConnection();
            SqlConnection con3 = obj3.connect3();
            ClsConnection obj  = new ClsConnection();
            SqlConnection con  = obj.connect();
            using (con)
            {
                con.Open();
                string        Bank_id = Session["Bank_Id"].ToString();
                SqlCommand    cmd     = new SqlCommand("select * from tbl_LoanFailure where Bank_Id='" + Bank_id + "' AND AdharId='" + txt_AdharId.Text + "'", con);
                SqlDataReader dr      = cmd.ExecuteReader();
                if (dr.Read())
                {
                    Alert.Show("Loan Failure Datas Already Stored in Another Database");
                }
                else
                {
                    using (con1)
                    {
                        con1.Open();
                        SqlCommand cmd2 = new SqlCommand("select * from tbl_Loan where Bank_Id='" + Bank_id + "' AND AdharId='" + txt_AdharId.Text + "' AND Status='Pending'", con1);
                        dr.Close();
                        SqlDataReader dr2 = cmd2.ExecuteReader();
                        if (dr2.Read())
                        {
                            string     bank_id  = dr2["Bank_Id"].ToString();
                            int        loan_id  = Convert.ToInt32(dr2["Loan_Id"].ToString());
                            string     bankname = dr2["BankName"].ToString();
                            string     adharid  = dr2["AdharId"].ToString();
                            string     name     = dr2["Name"].ToString();
                            string     loanname = dr2["LoanName"].ToString();
                            string     amount   = dr2["LoanAmount"].ToString();
                            string     status   = dr2["Status"].ToString();
                            string     Key      = dr2["KeyInfo"].ToString();
                            SqlCommand cmd3     = new SqlCommand("insert into tbl_LoanFailure values('" + bank_id + "','" + loan_id + "','" + bankname + "','" + adharid + "','" + name + "','" + loanname + "','" + amount + "','" + status + "','" + Key + "')", con);
                            dr2.Close();
                            cmd3.ExecuteNonQuery();
                            Alert.Show("Loan Failure Datas are Stored in Another Database");
                        }

                        con1.Close();
                    }
                    using (con2)
                    {
                        con2.Open();
                        SqlCommand cmd2 = new SqlCommand("select * from tbl_Loan where Bank_Id='" + Bank_id + "' AND AdharId='" + txt_AdharId.Text + "' AND Status='Pending'", con2);
                        dr.Close();
                        SqlDataReader dr2 = cmd2.ExecuteReader();
                        if (dr2.Read())
                        {
                            string     bank_id  = dr2["Bank_Id"].ToString();
                            int        loan_id  = Convert.ToInt32(dr2["Loan_Id"].ToString());
                            string     bankname = dr2["BankName"].ToString();
                            string     adharid  = dr2["AdharId"].ToString();
                            string     name     = dr2["Name"].ToString();
                            string     loanname = dr2["LoanName"].ToString();
                            string     amount   = dr2["LoanAmount"].ToString();
                            string     status   = dr2["Status"].ToString();
                            string     Key      = dr2["KeyInfo"].ToString();
                            SqlCommand cmd3     = new SqlCommand("insert into tbl_LoanFailure values('" + bank_id + "','" + loan_id + "','" + bankname + "','" + adharid + "','" + name + "','" + loanname + "','" + amount + "','" + status + "','" + Key + "')", con);
                            dr2.Close();
                            cmd3.ExecuteNonQuery();
                            Alert.Show("Loan Failure Datas are Stored in Another Database");
                        }

                        con2.Close();
                    }
                    using (con3)
                    {
                        con3.Open();
                        SqlCommand cmd2 = new SqlCommand("select * from tbl_Loan where Bank_Id='" + Bank_id + "' AND AdharId='" + txt_AdharId.Text + "' AND Status='Pending'", con3);
                        dr.Close();
                        SqlDataReader dr2 = cmd2.ExecuteReader();
                        if (dr2.Read())
                        {
                            string     bank_id  = dr2["Bank_Id"].ToString();
                            int        loan_id  = Convert.ToInt32(dr2["Loan_Id"].ToString());
                            string     bankname = dr2["BankName"].ToString();
                            string     adharid  = dr2["AdharId"].ToString();
                            string     name     = dr2["Name"].ToString();
                            string     loanname = dr2["LoanName"].ToString();
                            string     amount   = dr2["LoanAmount"].ToString();
                            string     status   = dr2["Status"].ToString();
                            string     Key      = dr2["KeyInfo"].ToString();
                            SqlCommand cmd3     = new SqlCommand("insert into tbl_LoanFailure values('" + bank_id + "','" + loan_id + "','" + bankname + "','" + adharid + "','" + name + "','" + loanname + "','" + amount + "','" + status + "','" + Key + "')", con);
                            dr2.Close();
                            cmd3.ExecuteNonQuery();
                            Alert.Show("Loan Failure Datas are Stored in Another Database");
                        }

                        con3.Close();
                    }

                    con.Close();
                }
            }
        }

        catch (Exception exp)
        {
        }
    }
예제 #14
0
 private void get_adhardetails()
 {
     try
     {
         ClsConnection obj1 = new ClsConnection();
         SqlConnection con1 = obj1.connect1();
         ClsConnection obj2 = new ClsConnection();
         SqlConnection con2 = obj2.connect2();
         ClsConnection obj3 = new ClsConnection();
         SqlConnection con3 = obj3.connect3();
         ClsConnection obj  = new ClsConnection();
         SqlConnection con  = obj.connect();
         using (con)
         {
             con.Open();
             //string Bank_id = Session["Bank_Id"].ToString();
             //SqlDataAdapter adp = new SqlDataAdapter("select * from tbl_Loan where Bank_Id='" + Bank_id + "' AND AdharId='" + txt_AdharId.Text + "'", con1);
             SqlDataAdapter adp = new SqlDataAdapter("select * from tbl_Loan where  AdharId='" + txt_AdharId.Text + "'", con1);
             DataTable      dt  = new DataTable();
             adp.Fill(dt);
             if (dt.Rows.Count > 0)
             {
                 dl_DB1.DataSource = dt;
                 dl_DB1.DataBind();
             }
             else
             {
                 //Alert.Show("Not Found in Bank2 & Bank3 !!");
             }
             con1.Close();
         }
         using (con2)
         {
             con2.Open();
             //string Bank_id = Session["Bank_Id"].ToString();
             SqlDataAdapter adp = new SqlDataAdapter("select * from tbl_Loan where  AdharId='" + txt_AdharId.Text + "'", con2);
             //SqlDataAdapter adp = new SqlDataAdapter("select * from tbl_Loan where Bank_Id='" + Bank_id + "' AND AdharId='" + txt_AdharId.Text + "'", con2);
             DataTable dt = new DataTable();
             adp.Fill(dt);
             if (dt.Rows.Count > 0)
             {
                 dl_DB2.DataSource = dt;
                 dl_DB2.DataBind();
             }
             else
             {
                 //Alert.Show("Not Found in Bank1 & Bank3  !!");
             }
             con2.Close();
         }
         using (con3)
         {
             con3.Open();
             //string Bank_id = Session["Bank_Id"].ToString();
             SqlDataAdapter adp = new SqlDataAdapter("select * from tbl_Loan where  AdharId='" + txt_AdharId.Text + "'", con3);
             //SqlDataAdapter adp = new SqlDataAdapter("select * from tbl_Loan where Bank_Id='" + Bank_id + "' AND AdharId='" + txt_AdharId.Text + "'", con3);
             DataTable dt = new DataTable();
             adp.Fill(dt);
             if (dt.Rows.Count > 0)
             {
                 dl_DB3.DataSource = dt;
                 dl_DB3.DataBind();
             }
             else
             {
                 //Alert.Show("Not Found in Bank1 & Bank2  !!");
             }
             con3.Close();
         }
     }
     catch (Exception exp)
     {
     }
 }