Ejemplo n.º 1
0
 public SendSmsRequestBody(string username, string password, Rohab.ServiceReference1.ArrayOfString to, string from, string text, bool isflash, string udh, Rohab.ServiceReference1.ArrayOfLong recId, byte[] status)
 {
     this.username = username;
     this.password = password;
     this.to       = to;
     this.from     = from;
     this.text     = text;
     this.isflash  = isflash;
     this.udh      = udh;
     this.recId    = recId;
     this.status   = status;
 }
Ejemplo n.º 2
0
        private void btnsend_Click(object sender, EventArgs e)
        {
            string msgcontent  = matn.Text;
            string phonenumber = RecieverNo.Text;

            ServiceReference1.SendSoapClient sms = new Rohab.ServiceReference1.SendSoapClient();
            byte[] status = new byte[] { };
            ServiceReference1.ArrayOfLong aroflo = new Rohab.ServiceReference1.ArrayOfLong();
            //string[] returnValue
            try
            {
                msgcontent = msgcontent.Replace("*نام*", recieverName.Text);
            }
            catch (Exception) { }
            try
            {
                phonenumber = phonenumber.Substring(0, 11);
            }
            catch (Exception) { }
            Thread.Sleep(1000);
            if (this == null)
            {
                return;
            }
            if (this.IsDisposed || Disposing)
            {
                return;
            }
            try
            {
                Result = sms.SendSms("9369611913", "19130", new ServiceReference1.ArrayOfString {
                    phonenumber
                }, "30004966300049", msgcontent, false, "", ref aroflo, ref status);
            }
            catch (Exception) { MessageBox.Show("سرویس در دسترس نیست"); }
            //label2.Text = i.ToString();
            /////////////////////
            if (Result == 1)
            {
                sms sm = new sms();
                sm.matnsms        = msgcontent;
                sm.shomaremaghsad = msgcontent;
                sm.tahvilgirande  = phonenumber;
                sm.tahvilshod     = true;
                sm.tarikh         = Date.Shamsiwithtime(DateTime.Now);
                sm.type           = "ارسال به سایر";
                sm.Add();
            }
            else
            {
                MessageBox.Show("ارسال با خطا مواجه شد");
            }
        }
Ejemplo n.º 3
0
 public int SendSms(string username, string password, Rohab.ServiceReference1.ArrayOfString to, string from, string text, bool isflash, string udh, ref Rohab.ServiceReference1.ArrayOfLong recId, ref byte[] status)
 {
     Rohab.ServiceReference1.SendSmsRequest inValue = new Rohab.ServiceReference1.SendSmsRequest();
     inValue.Body          = new Rohab.ServiceReference1.SendSmsRequestBody();
     inValue.Body.username = username;
     inValue.Body.password = password;
     inValue.Body.to       = to;
     inValue.Body.from     = from;
     inValue.Body.text     = text;
     inValue.Body.isflash  = isflash;
     inValue.Body.udh      = udh;
     inValue.Body.recId    = recId;
     inValue.Body.status   = status;
     Rohab.ServiceReference1.SendSmsResponse retVal = ((Rohab.ServiceReference1.SendSoap)(this)).SendSms(inValue);
     recId  = retVal.Body.recId;
     status = retVal.Body.status;
     return(retVal.Body.SendSmsResult);
 }
Ejemplo n.º 4
0
 public SendSmsResponseBody(int SendSmsResult, Rohab.ServiceReference1.ArrayOfLong recId, byte[] status)
 {
     this.SendSmsResult = SendSmsResult;
     this.recId         = recId;
     this.status        = status;
 }
Ejemplo n.º 5
0
        void updategridview()
        {
            ServiceReference1.SendSoapClient smsx = new Rohab.ServiceReference1.SendSoapClient();
            byte[] status = new byte[] { };
            ServiceReference1.ArrayOfLong  aroflo = new Rohab.ServiceReference1.ArrayOfLong();
            ServiceReference1.MessagesBL[] msg    = {};
            int msgCount = 0;

            try
            {
                msgCount = smsx.GetInboxCount("9369611913", "19130", false) + smsx.GetInboxCount("9369611913", "19130", true);
                msg      = smsx.getMessages("9369611913", "19130", 1, "30004966300049", 0, msgCount);
            }
            catch (Exception)
            {
                MessageBox.Show("مشکل در دریافت اطلاعات. لطفا دوباره تلاش کنید");
                return;
            }

            dataGridView1.DataSource = msg;

            foreach (DataGridViewColumn dc in dataGridView1.Columns)
            {
                dc.Visible = false;
            }

            dataGridView1.Columns["MsgID"].HeaderText    = "شناسه";
            dataGridView1.Columns["MsgID"].Visible       = true;
            dataGridView1.Columns["Body"].HeaderText     = "متن پیام";
            dataGridView1.Columns["Body"].Visible        = true;
            dataGridView1.Columns["SendDate"].HeaderText = "تاریخ";
            dataGridView1.Columns["SendDate"].Visible    = true;
            dataGridView1.Columns["Sender"].HeaderText   = "از شماره";
            dataGridView1.Columns["Sender"].Visible      = true;
            dataGridView1.Columns["IsRead"].HeaderText   = "خوانده شده";
            dataGridView1.Columns["IsRead"].Visible      = true;

            dataGridView1.Columns["Udh"].HeaderText = "از طرف";
            dataGridView1.Columns["Udh"].Visible    = true;

            //DataGridViewTextBoxColumn dcnew = new DataGridViewTextBoxColumn();
            //dcnew.Name = "sendername";
            //dcnew.HeaderText = "نام فرستنده";
            //dcnew.Width = 70;
            //dcnew.ReadOnly = false;
            //int index = dataGridView1.Columns.Add(dcnew);

            for (int i = 0; i < dataGridView1.RowCount; i++)
            {
                try
                {
                    std    stdda      = new std();
                    string sendername = stdda.GetSenderName(dataGridView1.Rows[i].Cells["Sender"].Value.ToString());
                    if (string.IsNullOrEmpty(sendername))
                    {
                        teachers tch = new teachers();
                        sendername = tch.GetSenderName(dataGridView1.Rows[i].Cells["Sender"].Value.ToString());
                    }
                    if (string.IsNullOrEmpty(sendername))
                    {
                        contact cnt = new contact();
                        sendername = cnt.GetSenderName(dataGridView1.Rows[i].Cells["Sender"].Value.ToString());
                    }
                    dataGridView1.Rows[i].Cells[7].Value = sendername == string.Empty ? "ناشناس" : sendername;
                    //-----------------------
                    // tarikh shamsi

                    dataGridView1.Rows[i].Cells["SendDate"].Value = Date.Shamsi(dataGridView1.Rows[i].Cells["SendDate"].Value.ToString().Substring(0, 10));
                }
                catch (Exception) { }
            }
            //  dataGridView1.Refresh();

            //  Boolean check = false;
            //string SQL = "select [smsid],[type],[tarikh],[tahvilgirande],[shomaremaghsad],[matnsms],[tahvilshod] from sms where ";
            //check = false;


            //// SQL = SQL + "[type] like N'%" + txttype.Text.Trim() + "%'AND ";
            //if (txttarikh.Text != "13  /  /")
            //{
            //    SQL = SQL + "[tarikh] like N'%" + txttarikh.Text.Trim() + "%'AND ";
            //    check = true;
            //}

            //SQL = SQL.Remove(SQL.Length - 4) + " order by tarikh DESC";


            //sms cl = new sms();
            //DataTable dt = new DataTable();
            //dt = cl.Search(SQL);
            //dataGridView1.DataSource = dt;

            //string[] col_headers = { "مشخصه", "ارسال به", "تاریخ", "نام گیرنده", "موبایل", "متن پیام", "تحویل شد" };
            //// int[] col_width = { 70, 80, 100, 70, 110, 80, 80, 80, 100, 80, 78 };

            //for (int i = 0; i < col_headers.Length; i++)
            //{
            //    dataGridView1.Columns[i].HeaderText = col_headers[i].ToString();
            //    //  dataGridView1.Columns[i].Width = col_width[i];
            //}

            //DataGridViewCellStyle objAlternatingCellStyle = new DataGridViewCellStyle();
            //objAlternatingCellStyle.BackColor = Color.Khaki;
            //dataGridView1.AlternatingRowsDefaultCellStyle = objAlternatingCellStyle;
        }
Ejemplo n.º 6
0
        private void Sendsms()
        {
            int count = 0;

            if (datarows != null)
            {
                foreach (DataGridViewRow dr in datarows.Rows)
                {
                    try
                    {
                        if (!bool.Parse(dr.Cells[0].Value.ToString()))
                        {
                            continue;
                        }
                    }
                    catch (Exception) { continue; }
                    string msg = msgcontent;
                    if (string.IsNullOrEmpty(dr.Cells[3].Value.ToString()))
                    {
                        continue;
                    }
                    ServiceReference1.SendSoapClient sms = new Rohab.ServiceReference1.SendSoapClient();
                    byte[] status = new byte[] { };
                    ServiceReference1.ArrayOfLong aroflo = new Rohab.ServiceReference1.ArrayOfLong();
                    //string[] returnValue
                    try
                    {
                        msg = msg.Replace("*نام*", dr.Cells[2].Value.ToString());
                    }
                    catch (Exception) { }
                    string phonenumber = dr.Cells[3].Value.ToString().Trim();
                    try
                    {
                        phonenumber = phonenumber.Substring(0, 11);
                    }
                    catch (Exception) { }
                    SetLabelfun(msg, phonenumber, dr.Cells[2].Value.ToString());
                    //  Thread.Sleep(1000);
                    if (this == null)
                    {
                        return;
                    }
                    if (this.IsDisposed || Disposing)
                    {
                        return;
                    }
                    int i = sms.SendSms("9369611913", "19130", new ServiceReference1.ArrayOfString {
                        phonenumber
                    }, "30004966300049", msg, false, "", ref aroflo, ref status);
                    //label2.Text = i.ToString();
                    /////////////////////
                    count++;
                    if (i == 1)
                    {
                        SetResultfun("پیامک برای " + dr.Cells[2].Value.ToString() + " به شماره " + phonenumber + " با موفقیت ارسال شد", count);
                    }
                    else
                    {
                        SetResultfun("ارسال به " + dr.Cells[2].Value.ToString() + " به شماره " + phonenumber + " نا موفق بوده است ", count);
                    }
                    sms sm = new sms();
                    sm.matnsms        = msg;
                    sm.shomaremaghsad = phonenumber;
                    sm.tahvilgirande  = dr.Cells[2].Value.ToString();
                    //sm.tahvilshod = i == 1 ? true : false;
                    sm.tarikh = Date.Shamsiwithtime(DateTime.Now);
                    try
                    {
                        if (((DataTable)dr.DataGridView.DataSource).Columns[3].Caption.Contains("birthdate"))
                        {
                            sm.type = "تبریک تولد";
                        }
                    }
                    catch (Exception)
                    {
                        if (!((DataTable)dr.DataGridView.DataSource).Columns[0].Caption.Contains("std"))
                        {
                            sm.type = "ارسال به استاد";
                        }
                        else
                        {
                            sm.type = "ارسال به هنرجو";
                        }
                    }
                    sm.Add();
                }
            }
            SetLabel1fun();
        }