Ejemplo n.º 1
0
 protected void gvSemester_RowCommand(object sender, GridViewCommandEventArgs e)
 {
     if (e.CommandName == "lbEdit")
     {
         int id = int.Parse(e.CommandArgument.ToString());
         //DataKey key = gvSemester.DataKeys[id];
         //int ID =int.Parse(key.Value.ToString());//取出ID
         Response.Redirect("Edit.aspx?ID="+id);
     }
     else if (e.CommandName == "lbDel")
     {
         int id = int.Parse(e.CommandArgument.ToString());
         LabMS.BLL.Semester BS = new LabMS.BLL.Semester();
         try
         {
             BS.Delete(id);
             Common.JShelper.JSAlert(this.Page, "", "删除成功!");
             InitBind();
         }
         catch
         {
             Common.JShelper.JSAlert(this.Page, "", "删除失败!");
         }
     }
 }
Ejemplo n.º 2
0
        /// <summary>
        /// 下拉框绑定
        /// </summary>
        protected void BindDDL()
        {
            LabMS.BLL.Semester BSemester = new LabMS.BLL.Semester();
            DataSet ds = new DataSet();
            string str = "select distinct Year from Semester";
            ds = Maticsoft.DBUtility.DbHelperSQL.Query(str);
            ddlYear.DataSource = ds.Tables[0].DefaultView;
            ddlYear.DataTextField = "Year";
            ddlYear.DataValueField = "Year";
            ddlYear.DataBind();

            string str2 = "select distinct MSemester from Semester";
            DataSet ds2 = new DataSet();
            ds2 = Maticsoft.DBUtility.DbHelperSQL.Query(str2);
            for (int i = ds2.Tables[0].Rows.Count - 1; i > -1; i--)
            {
                if (ds2.Tables[0].Rows[i]["MSemester"].ToString() == "1")
                {
                    ddlSem.Items.Add(new ListItem("春季", "1"));
                }
                else if(ds2.Tables[0].Rows[i]["MSemester"].ToString()=="2")
                {
                    ddlSem.Items.Add(new ListItem("秋季", "2"));
                }
            }
        }
Ejemplo n.º 3
0
 /// <summary>
 /// 保存
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void btnSave_Click(object sender, EventArgs e)
 {
     #region 验证
     if (string.IsNullOrEmpty(ddlYear.SelectedValue))
     {
         Common.JShelper.JSAlert(this.Page,"","学年不能为空!");
         ddlYear.Focus();
     }
     else if (string.IsNullOrEmpty(ddlAcadmic.SelectedValue))
     {
         Common.JShelper.JSAlert(this.Page,"","学期不能为空!");
         ddlAcadmic.Focus();
     }
     else if (string.IsNullOrEmpty(tbSTime.Text.Trim()))
     {
         Common.JShelper.JSAlert(this.Page,"","开学时间不能为空!");
         tbSTime.Focus();
     }
     else if (string.IsNullOrEmpty(tbETime.Text.Trim()))
     {
         Common.JShelper.JSAlert(this.Page,"","结束时间不能为空!");
         tbETime.Focus();
     }
     #endregion
     else
     {
         DateTime Stime =DateTime.Parse(tbSTime.Text.Trim());
         DateTime Etime =DateTime.Parse(tbETime.Text.Trim());
         int a=Etime.CompareTo(Stime);
         if (a != 1)
         {
             Common.JShelper.JSAlert(this.Page, "", "结束时间不能早于开学时间!");
             tbETime.Text = "";
             tbETime.Focus();
         }
         else
         {
             LabMS.Model.Semester MS = new LabMS.Model.Semester();
             MS.ID = int.Parse(Request.QueryString["ID"].ToString());
             MS.ETime = DateTime.Parse(tbETime.Text.Trim());
             MS.STime = DateTime.Parse(tbSTime.Text.Trim());
             MS.Year = int.Parse(ddlYear.SelectedValue.ToString());
             MS.MSemester = int.Parse(ddlAcadmic.SelectedValue.ToString());
             LabMS.BLL.Semester BS = new LabMS.BLL.Semester();
             try
             {
                 BS.Update(MS);
                 Common.JShelper.JSAlertAndRedirect(this.Page, "", "修改成功!", "academic-year.aspx");
             }
             catch
             {
                 Common.JShelper.JSAlert(this.Page, "", "修改失败!");
             }
         }
     }
 }
Ejemplo n.º 4
0
 /////对于学期: 1为春季,2为秋季
 /// <summary>
 /// 保存
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void btnSave_Click(object sender, EventArgs e)
 {
     #region 验证
     if (string.IsNullOrEmpty(tbETime.Text.Trim()))
     {
         Common.JShelper.JSAlert(this.Page,"","开学时间不能为空!");
         tbETime.Focus();
     }
     else if (string.IsNullOrEmpty(tbSTime.Text.Trim()))
     {
         Common.JShelper.JSAlert(this.Page, "", "结束时间不能为空!");
         tbSTime.Focus();
     }
     #endregion
     else
     {
         DateTime ETime=DateTime.Parse(tbETime.Text.Trim());//结束时间
         DateTime STime=DateTime.Parse(tbSTime.Text.Trim());//开学时间
         int a = ETime.CompareTo(STime);
         if (a != 1)
         {
             Common.JShelper.JSAlert(this.Page, "", "结束时间应该比开学时间晚!");
             tbETime.Text = "";
             tbETime.Focus();
         }
         else
         {
             LabMS.Model.Semester MS = new LabMS.Model.Semester();
             MS.ETime = DateTime.Parse(tbETime.Text.Trim());
             MS.STime = DateTime.Parse(tbSTime.Text.Trim());
             MS.Year = int.Parse(ddlYear.SelectedValue.ToString());
             MS.MSemester = int.Parse(ddlAcadmic.SelectedValue.ToString());
             LabMS.BLL.Semester BS = new LabMS.BLL.Semester();
             int count = BS.Add(MS);
             if (count > 0)
             {
                 Common.JShelper.JSAlertAndRedirect(this.Page, "", "保存成功!", "academic-year.aspx");
             }
             else
             {
                 Common.JShelper.JSAlert(this.Page, "", "保存失败!");
             }
         }
     }
 }
Ejemplo n.º 5
0
 /// <summary>
 /// 添加
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 //protected void btnAdd_Click(object sender, EventArgs e)
 //{
 //    Response.Redirect("AddacadmicYear.aspx");
 //}
 /// <summary>
 /// 页面初始化绑定
 /// </summary>
 protected void InitBind()
 {
     LabMS.BLL.Semester BS = new LabMS.BLL.Semester();
     gvSemester.DataSource = BS.GetAllList();
     gvSemester.DataBind();
 }
Ejemplo n.º 6
0
        /// <summary>
        /// 初始化页面赋值
        /// </summary>
        protected void InitBind(int ID)
        {
            string str = "ID="+ID;
            LabMS.BLL.Semester BS = new LabMS.BLL.Semester();
            List<LabMS.Model.Semester> list = new List<LabMS.Model.Semester>();
            list=BS.GetModelList(str);
            ddlYear.SelectedValue = list[0].Year.Value.ToString();
            ddlAcadmic.SelectedValue = list[0].MSemester.Value.ToString();
            tbETime.Text = list[0].ETime.Value.ToShortDateString();
            tbSTime.Text = list[0].STime.Value.ToShortDateString();

            LabMS.BLL.Dictionary BDicitonary = new LabMS.BLL.Dictionary();
            ExtendBLL.Dictionary EDictionary = new ExtendBLL.Dictionary();
            ddlYear.DataSource = EDictionary.GetItemListByDClass("ruxuenianfen");
            ddlYear.DataValueField = "Code";
            ddlYear.DataTextField = "Name";
            ddlYear.DataBind();
            ddlYear.SelectedValue = DateTime.Now.Year.ToString();
        }