Esempio n. 1
0
        protected void grdProfessorStatus_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            //System.Threading.Thread.Sleep(5000);
            if (e.CommandName == "send")
            {
                GridViewRow            curruntRow = (GridViewRow)(((Button)e.CommandSource).NamingContainer);
                DropDownList           drpStatus  = (DropDownList)curruntRow.FindControl("drpUserStatus") as DropDownList;
                string                 status     = drpStatus.SelectedValue;
                string                 UserName   = e.CommandArgument.ToString();
                FacultyReportsBusiness FRB        = new FacultyReportsBusiness();
                try
                {
                    DataTable user = FRB.GetInfoPeoByCodeMeli(UserName);

                    string lastStatus = drpStatus.Items.FindByValue(user.Rows[0]["status"].ToString()).Text;
                    string newStatus  = drpStatus.Items.FindByValue(status).Text;
                    if (canChangeStatus(Convert.ToInt32(user.Rows[0]["status"]), Convert.ToInt32(status)))
                    {
                        FRB.UpdateInfoPeopleStatus(UserName, status);

                        CommonBusiness cb = new CommonBusiness();
                        cb.InsertIntoUserLog(int.Parse(Session[sessionNames.userID_Karbar].ToString()), DateTime.Now.ToShortTimeString(), int.Parse(Session[sessionNames.appID_Karbar].ToString()), (int)DTO.eventEnum.تغییر_وضعیت_استاد, " تغییر وضعیت از " + lastStatus + " به " + newStatus, int.Parse(user.Rows[0]["ID"].ToString()));
                        RadWindowManager1.RadAlert("تغییر وضعیت استاد انجام شد.", 300, 100, "پیام سیستم", "");
                    }
                    else
                    {
                        RadWindowManager1.RadAlert(" تغییر وضعیت از " + lastStatus + " به " + newStatus + " امکان پذیر نمی باشد.", 300, 100, "پیام سیستم", "");
                    }
                    if (user.Rows.Count > 0)
                    {
                        grdProfessorStatus.DataSource = user;
                        grdProfessorStatus.DataBind();
                    }
                }
                catch (Exception)
                {
                    throw;
                }
                finally
                {
                    FRB = null;
                }
            }
            else if (e.CommandName == "Details")
            {
                Session["page"] = 4;
                Response.Redirect("ShowDetailInfo.aspx?ID=" + e.CommandArgument.ToString());
            }
            else if (e.CommandName == "History")
            {
                // TeacherName.InnerText ="کد استاد: "+ e.CommandArgument.ToString();
                CommonBusiness cmb = new CommonBusiness();

                lst_history.DataSource = cmb.getUserAndStudentLogByAppId(13, int.Parse(e.CommandArgument.ToString()));
                lst_history.DataBind();


                //rgHistoryGrid.DataSource = cmb.getUserAndStudentLogByAppId(13, int.Parse(e.CommandArgument.ToString()), 5);
                //rgHistoryGrid.DataBind();
                ScriptManager.RegisterStartupScript(this, this.GetType(), "Pop", "openModal();", true);
            }
        }