示例#1
0
        public static List <SMSON_SEND_BOX> getAllSend(string UserId)
        {
            var sendList = new List <SMSON_SEND_BOX>();
            var conn     = ConnectionClass.GetConnection();
            var cmd      = new SqlCommand();

            cmd.Connection  = conn;
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.CommandText = "FSP_SEND_BOX_GA";
            cmd.Parameters.Add(new SqlParameter("@USER_IDS", SqlDbType.VarChar, 50));
            cmd.Parameters["@USER_IDS"].Value = UserId;
            conn.Open();
            try
            {
                var data = cmd.ExecuteReader();
                while (data.Read())
                {
                    var send = new SMSON_SEND_BOX();
                    send.MOBILE_NUMBER = data["MOBILE_NUMBER"].ToString();
                    send.MAKE_DT       = DateTime.Parse(data["MAKE_DT"].ToString());
                    if (data["SMS_STATUS"].ToString().Equals("0"))
                    {
                        send.STATUS = "Pending";
                    }
                    if (data["SMS_STATUS"].ToString().Equals("1"))
                    {
                        send.STATUS = "Sent";
                    }
                    if (data["SMS_STATUS"].ToString().Equals("2"))
                    {
                        send.STATUS = "Not Sent";
                    }
                    if (String.IsNullOrEmpty(data["GROUP_NAME"].ToString()))
                    {
                        send.GROUP_NAME = "none";
                    }
                    else
                    {
                        send.GROUP_NAME = data["GROUP_NAME"].ToString();
                    }
                    sendList.Add(send);
                }
            }
            catch { }
            finally { conn.Close(); }
            return(sendList);
        }
        public static string Send_SMS(SMSON_SEND_BOX objSMSON_SEND_BOX)
        {
            string message = "";

            var SMS           = new SMSON_SEND_BOX();
            var conn          = ConnectionClass.GetConnection();
            var objSqlCommand = new SqlCommand();

            objSqlCommand.CommandText = "FSP_SEND_SMS_I";
            objSqlCommand.CommandType = CommandType.StoredProcedure;
            objSqlCommand.Connection  = conn;
            objSqlCommand.Parameters.Add(new SqlParameter("@MOBILE_NUMBER", SqlDbType.VarChar, 50));
            objSqlCommand.Parameters["@MOBILE_NUMBER"].Value = objSMSON_SEND_BOX.MOBILE_NUMBER;

            objSqlCommand.Parameters.Add(new SqlParameter("@USER_IDS", SqlDbType.VarChar, 50));
            objSqlCommand.Parameters["@USER_IDS"].Value = objSMSON_SEND_BOX.USER_IDS;

            objSqlCommand.Parameters.Add(new SqlParameter("@SMS_TEXT", SqlDbType.VarChar, 50));
            objSqlCommand.Parameters["@SMS_TEXT"].Value = objSMSON_SEND_BOX.SMS_TEXT;

            objSqlCommand.Parameters.Add(new SqlParameter("@SMS_STATUS", SqlDbType.VarChar, 50));
            objSqlCommand.Parameters["@SMS_STATUS"].Value = objSMSON_SEND_BOX.SMS_STATUS;

            objSqlCommand.Parameters.Add(new SqlParameter("@GROUP_ID", SqlDbType.VarChar, 50));
            objSqlCommand.Parameters["@GROUP_ID"].Value = "";

            objSqlCommand.Parameters.Add(new SqlParameter("@ERROR", SqlDbType.VarChar, 50));
            objSqlCommand.Parameters["@ERROR"].Direction = ParameterDirection.Output;

            conn.Open();

            try
            {
                var count = objSqlCommand.ExecuteNonQuery();
                message = objSqlCommand.Parameters["@ERROR"].Value.ToString();
            }
            catch//(Exception ex)
            { }
            finally
            {
                conn.Close();
            }

            return(message);
        }
示例#3
0
        protected void btnAdd_Click(object sender, EventArgs e)
        {
            if (String.IsNullOrEmpty(txtMsgBox.Text))
            {
                ScriptManager.RegisterStartupScript(this, this.GetType(), "ShowSuccess", "javascript:popup('Error','Please type some message','" + icon.CANCEL_ICON + "')", true);

                return;
            }
            if (String.IsNullOrEmpty(txtNumber.Text))
            {
                ScriptManager.RegisterStartupScript(this, this.GetType(), "ShowSuccess", "javascript:popup('Error','Please type one phone number','" + icon.CANCEL_ICON + "')", true);

                return;
            }
            var Send    = new SMSON_SEND_BOX();
            var message = "";

            Send.MOBILE_NUMBER = txtNumber.Text;
            Send.SMS_TEXT      = txtMsgBox.Text;
            Send.USER_IDS      = Session["USER_IDS"].ToString();
            Send.SMS_STATUS    = 0;
            try
            {
                message = USER_Acitivity.Send_SMS(Send);
                if (!message.ToLower().Contains("enough"))
                {
                    ScriptManager.RegisterStartupScript(this, this.GetType(), "ShowSuccess", "javascript:popup('Success','" + message + "','" + icon.OK_ICON + "')", true);
                }

                else
                {
                    ScriptManager.RegisterStartupScript(this, this.GetType(), "ShowSuccess", "javascript:popup('Error','" + message + "','" + icon.CANCEL_ICON + "')", true);
                }
            }
            catch (Exception ex)
            {
            }
            finally
            {
                Clear();
            }
        }