protected void ButtonAltAcntNo_Click(object sender, EventArgs e)
        {
            int CustReqId = Convert.ToInt32(Request.QueryString["cust_reqId"]);

            if (TextBoxBlnc.Text != null)
            {
                Connections con           = new Connections();
                string      strConnString = con.GetConnString();
                using (SqlConnection SqlCon = new SqlConnection(strConnString))
                {
                    SqlCommand SqlComm = new SqlCommand("", SqlCon);
                    SqlCon.Open();

                    string query = string.Format("SELECT uid, branch, account_type FROM account_req AS acc JOIN cust_details AS cust ON cust.req_no=acc.req_no WHERE acc.req_no='{0}'", CustReqId);
                    SqlComm.CommandText = query;
                    SqlDataReader reader = SqlComm.ExecuteReader();
                    reader.Read();
                    int    CustId  = reader.GetInt32(0);
                    int    BrnchId = reader.GetInt32(1);
                    string acctype = reader.GetString(2);
                    reader.Close();

                    string  aprv_date = DateTime.Now.ToString();
                    decimal amnt      = Convert.ToDecimal(TextBoxBlnc.Text);

                    query = string.Format("INSERT INTO accounts(account_holder, branch_code, account_type, date_approved, approved, account_blnc) VALUES('" + CustId + "', '" + BrnchId + "', '" + acctype + "', '" + aprv_date + "', '1', '" + amnt + "')");
                    SqlComm.CommandText = query;
                    SqlComm.ExecuteNonQuery();

                    string SetStatus = string.Format("UPDATE account_req SET status='1' WHERE req_no='" + CustReqId + "'");
                    SqlComm.CommandText = SetStatus;
                    SqlComm.ExecuteNonQuery();

                    SMRGeneral GetNewCode = new SMRGeneral();
                    string     ChqRefNo   = GetNewCode.GenerateCode();
                    string     Nartion    = "Cash";
                    string     NowDate    = DateTime.Now.ToString();

                    string queryFrTrns = string.Format("INSERT INTO AccountStatements(Cust_ID, Nartion, ChqRef_No, Deposit, ClsBlnc, StDate) VALUES('" + CustId + "', '" + Nartion + "', '" + ChqRefNo + "', '" + amnt + "', '" + amnt + "', '" + NowDate + "')");
                    SqlComm.CommandText = queryFrTrns;
                    SqlComm.ExecuteNonQuery();

                    Response.Redirect("approve_cust.aspx?cust_reqId=" + CustReqId + "");
                }
            }
        }
示例#2
0
        protected void ButtonAltNBK_Click(object sender, EventArgs e)
        {
            int CustId = Convert.ToInt32(Request.QueryString["CustId"]);

            Connections con           = new Connections();
            string      strConnString = con.GetConnString();

            using (SqlConnection SqlCon = new SqlConnection(strConnString))
            {
                SqlCommand SqlComm = new SqlCommand("", SqlCon);
                SqlCon.Open();

                SMRGeneral GetNewCode   = new SMRGeneral();
                string     CustPass     = GetNewCode.GenerateCode();
                string     CustHashPass = FormsAuthentication.HashPasswordForStoringInConfigFile(CustPass, "md5");
                string     AprvDate     = DateTime.Now.ToString();

                string query = string.Format("UPDATE NetBanking SET NBK_pass='******', NBK_approvDate='" + AprvDate + "', NBK_status='1' WHERE NBKU_id='" + CustId + "'");
                SqlComm.CommandText = query;
                SqlComm.ExecuteNonQuery();

                query = string.Format("UPDATE cust_details SET net_banking='1' WHERE uid='" + CustId + "'");
                SqlComm.CommandText = query;
                SqlComm.ExecuteNonQuery();

                //string CustEmailId = "*****@*****.**";
                //string emailBody = "Hello Ravikumar Chauhan, <br /><br />Thank you for using SMR Net Banking Service.<br />Your Password = '******' <br /><br />Thank you,<br />Team SMR Bank";
                //string emailSub = "Net Banking Password";

                //SMRGeneral emailToCust = new SMRGeneral();
                //emailToCust.SendEmailToCust(CustEmailId, emailBody, emailSub);

                //Response.Redirect("netbnkng_req.aspx");
                Response.Redirect("netbnkng_req.aspx?p=" + CustPass + "");
            }
        }