示例#1
0
    private void InsertBalanceTransfer()
    {
        string senderId = "myctin";

        try
        {
            urBLL.Frmmobileno = "9422325020";

            urBLL.Customermobileno = Convert.ToString(txtmobileno.Text);
            urBLL.Transbal         = Convert.ToString(txttransaction.Text);
            urBLL.Prombal          = Convert.ToString(txtPromotional.Text);
            urBLL.Validfrom        = Convert.ToString(txtvalidfrom.Text);
            urBLL.Validupto        = Convert.ToString(txtvalidupto.Text);
            status = urBLL.BLLInsertBalanceTransfer(urBLL);
            if (status == 1)
            {
                int     Transactional = Convert.ToInt32(urBLL.Transbal);
                int     Promtional    = Convert.ToInt32(urBLL.Prombal);
                string  mobileto      = urBLL.Customermobileno;
                string  query         = "select * from usermaster where usrMobileNo='" + mobileto + "'";
                DataSet dss           = cc.ExecuteDataset(query);
                int     SMSBal1       = Convert.ToInt32(dss.Tables[0].Rows[0]["SMSbal"]);
                int     PaidCount1    = Convert.ToInt32(dss.Tables[0].Rows[0]["paidCount"]);
                SMSBal1    = SMSBal1 + Transactional;
                PaidCount1 = PaidCount1 + Promtional;
                string sql12     = "update usermaster set SMSbal='" + SMSBal1 + "' ,paidCount='" + PaidCount1 + "' where usrMobileNo='" + mobileto + "'  ";
                int    aaa       = cc.ExecuteNonQuery(sql12);
                string messageto = "Dear user Your Transactional Bal is " + urBLL.Transbal + " & Promotional Bal is " + urBLL.Prombal + " updated successfully in ur a/c Thanks Via www.myct.in ";
                cc.SendMessageTra(senderId, mobileto, messageto);
                string  sendto    = "9422325020";
                string  sql       = "select * from usermaster where usrMobileNo='" + sendto + "'";
                DataSet ds        = cc.ExecuteDataset(sql);
                int     SMSBal    = Convert.ToInt32(ds.Tables[0].Rows[0]["SMSbal"]);
                int     PaidCount = Convert.ToInt32(ds.Tables[0].Rows[0]["paidCount"]);
                SMSBal    = SMSBal - Transactional;
                PaidCount = PaidCount - Promtional;
                string sql1    = "update usermaster set SMSbal='" + SMSBal + "' ,paidCount='" + PaidCount + "' where usrMobileNo='" + sendto + "'  ";
                int    a       = cc.ExecuteNonQuery(sql1);
                string message = "Dear user Trans Bal= " + urBLL.Transbal + " & Promo Bal=" + urBLL.Prombal + " is transfer to " + urBLL.Customermobileno + "";
                string sms     = message + " Your Trans Bal is " + SMSBal + " & Promo Bal is" + PaidCount + " Thanks Via www.myct.in";
                cc.SendMessageTra(senderId, sendto, sms);
                //ScriptManager.RegisterStartupScript(this, typeof(Page), "msg", "alert('Balance Transfer successfully')", true);
                Response.Write("<script>alert('Balance Transfer successfully')</script>");

                gvbalanceshow();
                clearall();
            }
            else
            {
                //ScriptManager.RegisterStartupScript(this, typeof(Page), "msg", "alert('Plz fill all information')", true);
                Response.Write("<script>alert('Plz fill all information')</script>");
            }
        }
        catch (Exception ex)
        {
        }
    }