public void loadLessonGroup()
        {
            ;

            if (Session["LGIDForEditLessonGroup"] != null)
            {
                string      id = Session["LGIDForEditLessonGroup"].ToString();
                LessonGroup lo = rep.FindFromLgByLGID(id.ToInt());

                ddGrade.Items.FindByValue(lo.GradeID.ToString()).Selected = true;
                if (lo.FieldID != 0)
                {
                    Field.Items.FindByValue(lo.FieldID.ToString()).Selected = true;
                }

                Day.Items.FindByValue(lo.Day.ToString()).Selected             = true;
                Time.Items.FindByValue(lo.Time.ToString()).Selected           = true;
                Class.Items.FindByValue(lo.Class.ToString()).Selected         = true;
                Teacher.Items.FindByValue(lo.TeacherCode.ToString()).Selected = true;

                LessonDrpDList.Items.FindByValue(lo.LessonID.ToString()).Selected = true;
                // Year.Items.FindByValue(lo.GradeID.ToString()).Selected = true;
                tbxYear.Text = lo.Year;
            }
            else
            {
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('شما با آدرس اشتباه وارد شده اید ! ');window.location ='http://localhost:4911/Dashboard/Admin/News.aspx'", true);
            }
        }
        public void DeleteLessonGroup(int EID)
        {
            SchoolDBEntities pb = conn.GetContext();

            LessonGroup selectedLesson = pb.LessonGroups.Where(p => p.LGID == EID).Single();

            if (selectedLesson != null)
            {
                pb.LessonGroups.Remove(selectedLesson);
                pb.SaveChanges();
            }
        }
        protected void btnEditLessonGroup_ServerClick(object sender, EventArgs e)
        {
            string id = Request.QueryString["LGID"];

            if (id != "" || id != null)
            {
                LessonGroup vlg = rep.FindFromLgByLGID(id.ToInt());
                LessonGroup lg  = new LessonGroup();

                if (ddGrade.SelectedIndex != 0 && Class.SelectedIndex != 0 && Day.SelectedIndex != 0 && Time.SelectedIndex != 0 && LessonDrpDList.SelectedIndex != 0 && Teacher.SelectedIndex != 0)
                {
                    LessonGroup newLesson = new LessonGroup();
                    newLesson.LGID = id.ToInt();
                    if (Field.SelectedIndex > 0)
                    {
                        newLesson.FieldID = Field.SelectedItem.Value.ToInt();
                    }
                    else
                    {
                        newLesson.FieldID = 0;
                    }
                    newLesson.GradeID = ddGrade.SelectedItem.Value.ToInt();

                    newLesson.Class       = Class.SelectedItem.Value;
                    newLesson.Day         = Day.SelectedItem.Value.ToInt();
                    newLesson.Time        = Time.SelectedItem.Value.ToInt();
                    newLesson.LessonID    = LessonDrpDList.SelectedItem.Value.ToInt();
                    newLesson.TeacherCode = Teacher.SelectedItem.Value;
                    newLesson.Year        = tbxYear.Text;
                    //SchoolDBEntities db = new SchoolDBEntities();
                    vLessonGroupRepository vv = new vLessonGroupRepository();

                    //db.LessonGroups.Attach(newLesson);
                    if (vv.SaveLessonGroups(newLesson))
                    {
                        //Response.Write("<script>alert('ثبت با موفقیت انجام شد');</script>");
                        ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('ویرایش با موفقیت انجام شد! ');window.location ='http://localhost:4911/Dashboard/Admin/LessonGroups.aspx'", true);
                        //Response.Redirect("http://localhost:4911/Dashboard/Admin/LessonGroups.aspx");
                    }
                    else
                    {
                        // Response.Write("<script>alert('ثبت با خطا مواجه شد');</script>");
                        ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('ویرایش با خطا مواجه شد! ')", true);
                    }
                }
                else
                {
                    // Response.Write("<script>alert('لطفا مقدار همه فیلد ها را معین کنید');</script>");
                    ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('لطفا تمام فیلد ها را انتخاب کنید! ')", true);
                }
            }
        }
        protected void btnEditLessonGroup_ServerClick(object sender, EventArgs e)
        {
            if (Session["LGIDForEditLessonGroup"] != null)
            {
                string      id  = Session["LGIDForEditLessonGroup"].ToString();
                LessonGroup vlg = rep.FindFromLgByLGID(id.ToInt());
                LessonGroup lg  = new LessonGroup();

                if (ddGrade.SelectedIndex != 0 && Class.SelectedIndex != 0 && Day.SelectedIndex != 0 && Time.SelectedIndex != 0 && LessonDrpDList.SelectedIndex != 0 && Teacher.SelectedIndex != 0)
                {
                    LessonGroup newLesson = new LessonGroup();
                    newLesson.LGID = id.ToInt();
                    if (Field.SelectedIndex > 0)
                    {
                        newLesson.FieldID = Field.SelectedItem.Value.ToInt();
                    }
                    else
                    {
                        newLesson.FieldID = 0;
                    }
                    newLesson.GradeID = ddGrade.SelectedItem.Value.ToInt();

                    newLesson.Class       = Class.SelectedItem.Value;
                    newLesson.Day         = Day.SelectedItem.Value.ToInt();
                    newLesson.Time        = Time.SelectedItem.Value.ToInt();
                    newLesson.LessonID    = LessonDrpDList.SelectedItem.Value.ToInt();
                    newLesson.TeacherCode = Teacher.SelectedItem.Value;
                    newLesson.Year        = tbxYear.Text;
                    vLessonGroupRepository vv = new vLessonGroupRepository();

                    if (vv.SaveLessonGroups(newLesson))
                    {
                        ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('ویرایش با موفقیت انجام شد! ');window.location ='http://localhost:4911/Dashboard/Admin/LessonGroups.aspx'", true);
                    }
                    else
                    {
                        ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('ویرایش با خطا مواجه شد! ')", true);
                    }
                }
                else
                {
                    ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('لطفا تمام فیلد ها را انتخاب کنید! ')", true);
                }
            }
            else

            {
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('شما با آدرس اشتباه وارد شده اید ! ');window.location ='http://localhost:4911/Dashboard/Admin/News.aspx'", true);
            }
        }
        public Boolean SaveLessonGroups(LessonGroup lessonGroup)
        {
            SchoolDBEntities pb = conn.GetContext();

            if (lessonGroup.LGID > 0)
            {
                //==== UPDATE ====
                pb.LessonGroups.Attach(lessonGroup);
                pb.Entry(lessonGroup).State = EntityState.Modified;
            }
            else
            {
                //==== INSERT ====
                pb.LessonGroups.Add(lessonGroup);
            }

            return(Convert.ToBoolean(pb.SaveChanges()));
        }
Exemple #6
0
        protected void btnSabtLessonGroup_Click(object sender, EventArgs e)
        {
            if (Grade.SelectedIndex != 0 && Class.SelectedIndex != 0 && Day.SelectedIndex != 0 && Time.SelectedIndex != 0 && LessonDrpDList.SelectedIndex != 0 && Teacher.SelectedIndex != 0)
            {
                LessonGroup newLesson = new LessonGroup();
                if (Field.SelectedIndex > 0)
                {
                    newLesson.FieldID = Field.SelectedItem.Value.ToInt();
                }
                else
                {
                    newLesson.FieldID = 0;
                }
                newLesson.GradeID = Grade.SelectedItem.Value.ToInt();

                newLesson.Class       = Class.SelectedItem.Value;
                newLesson.Day         = Day.SelectedItem.Value.ToInt();
                newLesson.Time        = Time.SelectedItem.Value.ToInt();
                newLesson.LessonID    = LessonDrpDList.SelectedItem.Value.ToInt();
                newLesson.TeacherCode = Teacher.SelectedItem.Value;
                newLesson.Year        = Year.SelectedItem.Value;
                SchoolDBEntities db = new SchoolDBEntities();
                db.LessonGroups.Add(newLesson);
                if (Convert.ToBoolean(db.SaveChanges()))
                {
                    //Response.Write("<script>alert('ثبت با موفقیت انجام شد');</script>");
                    Response.Redirect("http://localhost:4911/Dashboard/Admin/LessonGroups.aspx");
                }
                else
                {
                    // Response.Write("<script>alert('ثبت با خطا مواجه شد');</script>");
                    ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('ثبت با خطا مواجه شد! ')", true);
                }
            }
            else
            {
                // Response.Write("<script>alert('لطفا مقدار همه فیلد ها را معین کنید');</script>");
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('لطفا تمام فیلد ها را انتخاب کنید! ')", true);
            }
        }
Exemple #7
0
 public ShowGroupTimeTableCommand([NotNull] INavigationService navigationService,
                                  [NotNull] FlurryPublisher flurryPublisher,
                                  [NotNull] IAsyncDataProvider dataProvider,
                                  [NotNull] IUiStringsProviders stringsProviders, [NotNull] University university,
                                  [NotNull] LessonGroup group)
 {
     if (navigationService == null)
     {
         throw new ArgumentNullException("navigationService");
     }
     if (flurryPublisher == null)
     {
         throw new ArgumentNullException("flurryPublisher");
     }
     if (dataProvider == null)
     {
         throw new ArgumentNullException("dataProvider");
     }
     if (stringsProviders == null)
     {
         throw new ArgumentNullException("stringsProviders");
     }
     if (university == null)
     {
         throw new ArgumentNullException("university");
     }
     if (group == null)
     {
         throw new ArgumentNullException("group");
     }
     _navigationService = navigationService;
     _flurryPublisher   = flurryPublisher;
     _dataProvider      = dataProvider;
     _stringsProviders  = stringsProviders;
     _university        = university;
     _group             = group;
 }
        public void loadLessonGroup()
        {
            string id = Request.QueryString["LGID"];

            if (id != "" || id != null)
            {
                LessonGroup lo = rep.FindFromLgByLGID(id.ToInt());

                ddGrade.Items.FindByValue(lo.GradeID.ToString()).Selected = true;
                if (lo.FieldID != 0)
                {
                    Field.Items.FindByValue(lo.FieldID.ToString()).Selected = true;
                }

                Day.Items.FindByValue(lo.Day.ToString()).Selected             = true;
                Time.Items.FindByValue(lo.Time.ToString()).Selected           = true;
                Class.Items.FindByValue(lo.Class.ToString()).Selected         = true;
                Teacher.Items.FindByValue(lo.TeacherCode.ToString()).Selected = true;

                LessonDrpDList.Items.FindByValue(lo.LessonID.ToString()).Selected = true;
                // Year.Items.FindByValue(lo.GradeID.ToString()).Selected = true;
                tbxYear.Text = lo.Year;
            }
        }
Exemple #9
0
 public ITitledCommand GetShowGroupTimeTableCommand(University university, LessonGroup group)
 {
     return(new ShowGroupTimeTableCommand(_navigationService, _flurryPublisher, _dataProvider, _stringsProviders,
                                          university, group));
 }