Exemple #1
0
        protected void btn_TraceMessage_Click(object sender, EventArgs e)
        {
            grd_ShowMessage.Visible = false;


            bool sentSMS;

            lbl_Status.Text = CB.ShowStatusSMS(txt_CodeAsanak.Text, out sentSMS);
            string alertTitle = sentSMS?"پیگیری":"پیام";

            RadwindowManager1.RadAlert(lbl_Status.Text, 0, 100, alertTitle, "");

            lbl_CodeAsanak.Visible   = false;
            txt_CodeAsanak.Visible   = false;
            btn_TraceMessage.Visible = false;
            //Session["Status"] = Session["AppID"] = null;
        }
Exemple #2
0
        protected void btn_SearchCode_Click(object sender, EventArgs e)
        {
            string    Code         = txt_Code.Text;
            DataTable dt           = new DataTable();
            DataTable dtSearchCode = CB.GetSearchStudentOrProf(txt_Code.Text);

            if (dtSearchCode.Rows.Count == 0)
            {
                RadwindowManager1.RadAlert("شماره دانشجویی یا کد استاد صحیح وارد نشده است", 0, 100, "پیام", "");
            }
            else
            {
                if (ddl_IdStatus.Visible == true)
                {
                    AppID  = int.Parse(Session[sessionNames.appID_Karbar].ToString());
                    Status = int.Parse(Session["Status"].ToString());
                    dt     = CB.GetAppIDMessage(0, AppID, 1, Status);
                    if (dt.Rows.Count == 0)
                    {
                        RadwindowManager1.RadAlert("پیامکی ارسال نشده است", 0, 100, "پیغام", "");
                        lbl_CodeAsanak.Visible = false;
                        txt_CodeAsanak.Visible = false;
                    }
                    else
                    {
                        int       IDRow = int.Parse(dt.Rows[0]["ID"].ToString());
                        DataTable dt2   = CB.GetCodeAsanak(Code, IDRow);
                        if (dt2.Rows.Count == 0)
                        {
                            RadwindowManager1.RadAlert("پیامکی ارسال نشده است", 0, 100, "پیغام", "");
                            lbl_CodeAsanak.Visible = false;
                            txt_CodeAsanak.Visible = false;
                        }
                        else
                        {
                            btn_TraceMessage.Visible = true;
                            if (dt.Rows.Count == 1)
                            {
                                txt_CodeAsanak.Visible = true;
                                txt_CodeAsanak.Text    = dt.Rows[0]["codeAsanak"].ToString();
                            }
                            else
                            {
                                DataTable dtNew = new DataTable();
                                dtNew.Columns.Add("date", typeof(string));
                                dtNew.Columns.Add("codeAsanak", typeof(string));
                                DataRow  dr       = dtNew.NewRow();
                                DateTime dtMiladi = new DateTime();
                                // ok
                                if (!IsPostBack)
                                {
                                    for (Int32 i = 0; i < dt.Rows.Count; i++)
                                    {
                                        dtMiladi = DateTime.Parse(dt.Rows[i]["date"].ToString());
                                        PersianCalendar p          = new PersianCalendar();
                                        string          date2      = p.GetYear(dtMiladi).ToString() + "/" + p.GetMonth(dtMiladi).ToString() + "/" + p.GetDayOfMonth(dtMiladi).ToString();
                                        string          codeAsanak = Convert.ToString(dt.Rows[i]["codeAsanak"].ToString());
                                        dr["date"]       = date2;
                                        dr["codeAsanak"] = codeAsanak;
                                        dtNew.Rows.Add(dr.ItemArray);
                                    }
                                }
                                grd_ShowMessage.DataSource = dtNew;
                                grd_ShowMessage.DataBind();
                            }
                        }
                    }
                }
                if (ddl_IdStatus.Visible == false)
                {
                    AppID = int.Parse(Session[sessionNames.appID_Karbar].ToString());
                    dt    = CB.GetAppIDMessage(0, AppID, 1, 1);
                    if (dt.Rows.Count == 0)
                    {
                        RadwindowManager1.RadAlert("پیامکی ارسال نشده است", 0, 100, "پیام", "");
                        lbl_CodeAsanak.Visible = false;
                        txt_CodeAsanak.Visible = false;
                    }
                    else
                    {
                        int IDRow = int.Parse(dt.Rows[0]["ID"].ToString());
                        dt = CB.GetCodeAsanak(Code, IDRow);
                        if (dt.Rows.Count == 0)
                        {
                            RadwindowManager1.RadAlert("پیامکی ارسال نشده است", 0, 100, "پیام", "");
                            lbl_CodeAsanak.Visible = false;
                            txt_CodeAsanak.Visible = false;
                        }
                        else
                        {
                            btn_TraceMessage.Visible = true;
                            if (dt.Rows.Count == 1)
                            {
                                lbl_CodeAsanak.Visible = true;
                                txt_CodeAsanak.Visible = true;
                                txt_CodeAsanak.Text    = dt.Rows[0]["codeAsanak"].ToString();
                                //btn_SearchCode.Visible = true;
                            }
                            else
                            {
                                DataTable dtNew = new DataTable();
                                dtNew.Columns.Add("date", typeof(string));
                                dtNew.Columns.Add("codeAsanak", typeof(string));
                                DataRow dr = dtNew.NewRow();
                                // ok
                                //if (!IsPostBack)
                                //{
                                DateTime dtMiladi = new DateTime();
                                for (Int32 i = 0; i < dt.Rows.Count; i++)
                                {
                                    dtMiladi = DateTime.Parse(dt.Rows[i]["date"].ToString());
                                    PersianCalendar p          = new PersianCalendar();
                                    string          date2      = p.GetYear(dtMiladi).ToString() + "/" + p.GetMonth(dtMiladi).ToString() + "/" + p.GetDayOfMonth(dtMiladi).ToString();
                                    string          codeAsanak = Convert.ToString(dt.Rows[i]["codeAsanak"].ToString());
                                    dr["date"]       = date2;
                                    dr["codeAsanak"] = codeAsanak;
                                    dtNew.Rows.Add(dr.ItemArray);
                                }
                                //}
                                grd_ShowMessage.DataSource = dtNew;
                                grd_ShowMessage.DataBind();
                            }
                        }
                    }
                }
            }
        }