Beispiel #1
0
    protected void Button2_Click(object sender, EventArgs e)
    {
        int    TrueCount = 0;
        string info      = "";

        for (int i = 0; i < this.GridView1.Rows.Count; i++)
        {
            if ((this.GridView1.Rows[i].FindControl("CheckBox1") as CheckBox).Checked)
            {
                string ss = ((HiddenField)GridView1.Rows[i].FindControl("HiddenField1")).Value;
                using (SqlConnection con = new SqlConnection(DAL.DBHelper.connString))
                {
                    con.Open();
                    SqlTransaction tran = con.BeginTransaction();
                    try
                    {
                        BLL.MobileSMS sms = new BLL.MobileSMS();
                        DataTable     dt  = sms.GetSMS(tran, ss);

                        BLL.MobileSMS.SendMsgTo(tran, dt.Rows[0]["CustomerID"].ToString(), dt.Rows[0]["CustomerID"].ToString(), dt.Rows[0]["mobile"].ToString(), dt.Rows[0]["sendMsg"].ToString(), out info, (Model.SMSCategory)Convert.ToInt32(dt.Rows[0]["Category"].ToString()));
                        sms.DelSMS(tran, ss);
                        if (info.IndexOf("发送成功") != -1)
                        {
                            TrueCount++;
                        }
                        tran.Commit();
                    }
                    catch
                    {
                        tran.Rollback();
                    }
                    finally
                    {
                        con.Close();
                    }
                }
            }
        }
        ClientScript.RegisterStartupScript(this.GetType(), "", "alert('" + GetTran("007902", "共成功发送") + TrueCount + GetTran("006978", "条") + "!')", true);
    }
Beispiel #2
0
    protected void Button1_Click(object sender, EventArgs e)
    {
        for (int i = 0; i < this.GridView1.Rows.Count; i++)
        {
            if ((this.GridView1.Rows[i].FindControl("CheckBox1") as CheckBox).Checked)
            {
                string ss = ((HiddenField)GridView1.Rows[i].FindControl("HiddenField1")).Value;
                using (SqlConnection con = new SqlConnection(DAL.DBHelper.connString))
                {
                    con.Open();
                    SqlTransaction tran = con.BeginTransaction();
                    try
                    {
                        BLL.MobileSMS sms             = new BLL.MobileSMS();
                        BLL.CommonClass.ChangeLogs cl = new BLL.CommonClass.ChangeLogs("h_mobileMsg", "ltrim(rtrim(str(id)))");

                        cl.AddRecordtran(tran, ss);
                        sms.DelSMS(tran, ss);

                        cl.AddRecordtran(tran, ss);
                        cl.DeletedIntoLogs(BLL.CommonClass.ChangeCategory.company65, Session["Company"].ToString(), BLL.CommonClass.ENUM_USERTYPE.objecttype10);


                        tran.Commit();
                    }
                    catch
                    {
                        tran.Rollback();
                    }
                    finally
                    {
                        con.Close();
                    }
                }
            }
        }

        btnSearch_Click(null, null);
    }
Beispiel #3
0
    protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        string id = e.CommandArgument.ToString();

        if (e.CommandName == "Del")
        {
            using (SqlConnection con = new SqlConnection(DAL.DBHelper.connString))
            {
                con.Open();
                SqlTransaction tran = con.BeginTransaction();
                try
                {
                    BLL.MobileSMS sms             = new BLL.MobileSMS();
                    BLL.CommonClass.ChangeLogs cl = new BLL.CommonClass.ChangeLogs("h_mobileMsg", "ltrim(rtrim(str(id)))");

                    cl.AddRecordtran(tran, id);
                    sms.DelSMS(tran, id);

                    cl.AddRecordtran(tran, id.ToString());
                    cl.DeletedIntoLogs(BLL.CommonClass.ChangeCategory.company65, Session["Company"].ToString(), BLL.CommonClass.ENUM_USERTYPE.objecttype10);


                    tran.Commit();
                    ClientScript.RegisterStartupScript(this.GetType(), "", "alert('" + BLL.Translation.Translate("000008", "删除成功") + "')", true);
                    btnSearch_Click(null, null);
                }
                catch
                {
                    tran.Rollback();
                    ClientScript.RegisterStartupScript(this.GetType(), "", "alert('" + BLL.Translation.Translate("000009", "删除失败") + "')", true);
                }
                finally
                {
                    con.Close();
                }
            }
        }

        if (e.CommandName == "AgainSend")
        {
            string   info     = "";
            string[] AllValue = e.CommandArgument.ToString().Split(',');
            string   CommName = e.CommandArgument.ToString();
            using (SqlConnection con = new SqlConnection(DAL.DBHelper.connString))
            {
                con.Open();
                SqlTransaction tran = con.BeginTransaction();
                try
                {
                    BLL.MobileSMS sms = new BLL.MobileSMS();
                    BLL.MobileSMS.SendMsgTo(tran, AllValue[2], AllValue[2], AllValue[1], AllValue[3], out info, (Model.SMSCategory)Convert.ToInt32(AllValue[4]));
                    sms.DelSMS(tran, AllValue[0]);
                    tran.Commit();
                    //BLL.MobileSMS.SendMsgTo(tran, bianhao, bianhao, mobile, msg, out info, Model.SMSCategory.sms_ManualSent);
                    ClientScript.RegisterStartupScript(this.GetType(), "", "alert('" + info + "');", true);


                    btnSearch_Click(null, null);
                }
                catch
                {
                    tran.Rollback();
                    ClientScript.RegisterStartupScript(this.GetType(), "", "alert('" + info + "');", true);
                }
                finally
                {
                    con.Close();
                }
            }
        }
    }