コード例 #1
0
        protected void btnAdd_Click(object sender, EventArgs e)
        {
            if (dopGroup.SelectedValue == "0")
            {
                ScriptManager.RegisterStartupScript(this, this.GetType(), "ShowSuccess", "javascript:popup('Error','Select Group','" + icon.CANCEL_ICON + "')", true);

                return;
            }
            if (String.IsNullOrEmpty(txtNumber.Text))
            {
                ScriptManager.RegisterStartupScript(this, this.GetType(), "ShowSuccess", "javascript:popup('Error','Number field is required!','" + icon.CANCEL_ICON + "')", true);

                return;
            }
            else
            {
                var contact = new SMSON_CONTACT();
                contact.CONTACT_NAME   = txtName.Text;
                contact.CONTACT_NUMBER = txtNumber.Text;
                contact.GROUP_ID       = int.Parse(dopGroup.SelectedValue);
                contact.USER_IDS       = Session["USER_IDS"].ToString();
                var message = save.SaveSMSON_CONTACT(contact);
                if (!message.ToLower().Contains("already"))
                {
                    ScriptManager.RegisterStartupScript(this, this.GetType(), "ShowSuccess", "javascript:popup('Sucess','" + message + "','" + icon.OK_ICON + "')", true);
                }
                else
                {
                    ScriptManager.RegisterStartupScript(this, this.GetType(), "ShowSuccess", "javascript:popup('Error','" + message + "','" + icon.CANCEL_ICON + "')", true);
                }
            }
            clear();
        }
コード例 #2
0
        public static List <SMSON_CONTACT> Get_ALL_SMSON_CONTACT(int USER_IDS)
        {
            List <SMSON_CONTACT> OBJlISTSMSON_CONTACT = new List <SMSON_CONTACT>();
            var conn          = ConnectionClass.GetConnection();
            var objSqlCommand = new SqlCommand();

            objSqlCommand.CommandText = "FSP_SMSON_CONTACT_GA";
            objSqlCommand.CommandType = CommandType.StoredProcedure;
            objSqlCommand.Connection  = conn;
            objSqlCommand.Parameters.Add(new SqlParameter("@USER_IDS", SqlDbType.VarChar, 50));
            objSqlCommand.Parameters["@USER_IDS"].Value = USER_IDS;
            conn.Open();
            try
            {
                var data = objSqlCommand.ExecuteReader();
                while (data.Read())
                {
                    SMSON_CONTACT OBJSMSON_CONTACT = new SMSON_CONTACT();
                    OBJSMSON_CONTACT.CONTACT_ID     = int.Parse(data["CONTACT_ID"].ToString());
                    OBJSMSON_CONTACT.CONTACT_NAME   = data["CONTACT_NAME"].ToString();
                    OBJSMSON_CONTACT.CONTACT_NUMBER = data["CONTACT_NUMBER"].ToString();
                    OBJSMSON_CONTACT.GROUP_NAME     = data["GROUP_NAME"].ToString();
                    OBJlISTSMSON_CONTACT.Add(OBJSMSON_CONTACT);
                }
            }
            catch (Exception ex)
            {
            }
            finally
            {
                conn.Close();
            }

            return(OBJlISTSMSON_CONTACT);
        }
コード例 #3
0
        public static List <SMSON_CONTACT> getAllContactList(string GroupId, string UserId)
        {
            var contactList = new List <SMSON_CONTACT>();

            var conn = ConnectionClass.GetConnection();
            var cmd  = new SqlCommand();

            cmd.Connection  = conn;
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.CommandText = "FSP_GROUP_LIST";
            cmd.Parameters.Add(new SqlParameter("@USER_IDS", SqlDbType.VarChar, 50));
            cmd.Parameters["@USER_IDS"].Value = UserId;
            cmd.Parameters.Add(new SqlParameter("@GROUP_ID", SqlDbType.VarChar, 50));
            cmd.Parameters["@GROUP_ID"].Value = GroupId;
            conn.Open();
            try
            {
                using (cmd)
                {
                    var data = cmd.ExecuteReader();
                    while (data.Read())
                    {
                        var contact = new SMSON_CONTACT();
                        contact.GROUP_ID       = int.Parse(data["GROUP_ID"].ToString());
                        contact.CONTACT_NAME   = data["CONTACT_NAME"].ToString();
                        contact.CONTACT_NUMBER = data["CONTACT_NUMBER"].ToString();
                        contact.GROUP_NAME     = data["GROUP_NAME"].ToString();
                        contact.MAKE_DT        = DateTime.Parse(data["MAKE_DT"].ToString());
                        contactList.Add(contact);
                    }
                }
            }
            catch { }
            finally
            {
                conn.Close();
            }
            return(contactList);
        }
コード例 #4
0
        public static string SaveSMSON_CONTACT(SMSON_CONTACT objSMSON_CONTACT)
        {
            string        message       = "";
            SqlConnection con           = ConnectionClass.GetConnection();
            SqlCommand    objSqlCommand = new SqlCommand();

            objSqlCommand.CommandText = "FSP_ADD_CONTACT_I";
            objSqlCommand.CommandType = CommandType.StoredProcedure;
            objSqlCommand.Connection  = con;
            // objSqlCommand.Parameters.Add(new SqlParameter("@GROUP_ID", SqlDbType.Int));
            // objSqlCommand.Parameters["@GROUP_ID"].Value = objSMSON_GROUP.GROUP_ID;
            objSqlCommand.Parameters.Add(new SqlParameter("@CONTACT_NAME", SqlDbType.VarChar, 50));
            objSqlCommand.Parameters["@CONTACT_NAME"].Value = objSMSON_CONTACT.CONTACT_NAME;
            objSqlCommand.Parameters.Add(new SqlParameter("@USER_IDS", SqlDbType.VarChar));
            objSqlCommand.Parameters["@USER_IDS"].Value = objSMSON_CONTACT.USER_IDS;
            objSqlCommand.Parameters.Add(new SqlParameter("@GROUP_ID", SqlDbType.VarChar, 50));
            objSqlCommand.Parameters["@GROUP_ID"].Value = objSMSON_CONTACT.GROUP_ID;
            objSqlCommand.Parameters.Add(new SqlParameter("@CONTACT_NUMBER", SqlDbType.VarChar, 50));
            objSqlCommand.Parameters["@CONTACT_NUMBER"].Value = objSMSON_CONTACT.CONTACT_NUMBER;
            objSqlCommand.Parameters.Add(new SqlParameter("@ERROR", SqlDbType.VarChar, 50));
            objSqlCommand.Parameters["@ERROR"].Direction = ParameterDirection.Output;

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