private static SqlParameter[] GetParameters(M_ExClassgroup ExClassgroupinfo) { SqlParameter[] parameter = new SqlParameter[15]; parameter[0] = new SqlParameter("@GroupID", SqlDbType.Int, 4); parameter[0].Value = ExClassgroupinfo.GroupID; parameter[1] = new SqlParameter("@Regulationame", SqlDbType.NVarChar, 50); parameter[1].Value = ExClassgroupinfo.Regulationame; parameter[2] = new SqlParameter("@Regulation", SqlDbType.NVarChar, 255); parameter[2].Value = ExClassgroupinfo.Regulation; parameter[3] = new SqlParameter("@Ratednumber", SqlDbType.Int, 4); parameter[3].Value = ExClassgroupinfo.Ratednumber; parameter[4] = new SqlParameter("@Actualnumber", SqlDbType.Int, 4); parameter[4].Value = ExClassgroupinfo.Actualnumber; parameter[5] = new SqlParameter("@Setuptime", SqlDbType.DateTime, 8); parameter[5].Value = ExClassgroupinfo.Setuptime; parameter[6] = new SqlParameter("@Endtime", SqlDbType.DateTime, 8); parameter[6].Value = ExClassgroupinfo.Endtime; parameter[7] = new SqlParameter("@CourseID", SqlDbType.Int, 4); parameter[7].Value = ExClassgroupinfo.CourseID; parameter[8] = new SqlParameter("@ShiPrice", SqlDbType.Money); parameter[8].Value = ExClassgroupinfo.ShiPrice; parameter[9] = new SqlParameter("@LinPrice", SqlDbType.Money); parameter[9].Value = ExClassgroupinfo.LinPrice; parameter[10] = new SqlParameter("@CourseHour", SqlDbType.Int, 4); parameter[10].Value = ExClassgroupinfo.CourseHour; parameter[11] = new SqlParameter("@Presented", SqlDbType.Int, 4); parameter[11].Value = ExClassgroupinfo.Presented; parameter[12] = new SqlParameter("@isCou", SqlDbType.Int, 4); parameter[12].Value = ExClassgroupinfo.isCou; parameter[13] = new SqlParameter("@ClassID", SqlDbType.Int, 4); parameter[13].Value = ExClassgroupinfo.ClassID; parameter[14] = new SqlParameter("@Speaker", SqlDbType.Int, 4); parameter[14].Value = ExClassgroupinfo.Speaker; return(parameter); }
public int GetInsert(M_ExClassgroup exClassgroup) { string sqlStr = "INSERT INTO [dbo].[ZL_ExClassgroup] ([Regulationame],[Regulation],[Ratednumber],[Actualnumber],[Setuptime],[Endtime],[CourseID],[ShiPrice],[LinPrice],[CourseHour],[Presented],[isCou],[ClassID]) VALUES (@Regulationame,@Regulation,@Ratednumber,@Actualnumber,@Setuptime,@Endtime,@CourseID,@ShiPrice,@LinPrice,@CourseHour,@Presented,@isCou,@ClassID);select @@IDENTITY"; SqlParameter[] cmdParams = GetParameters(exClassgroup); return(SqlHelper.ObjectToInt32(SqlHelper.ExecuteScalar(CommandType.Text, sqlStr, cmdParams))); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { Call.SetBreadCrumb(Master, "<li><a href='" + CustomerPageAction.customPath2 + "I/Main.aspx'>工作台</a></li> <li><a href='Papers_System_Manage.aspx'>教育模块</a></li> <li><a href='ClassManage.aspx'>班级管理</a></li><li>添加班级</li>"); if (Request.QueryString["cid"] != null) { string cid = Request.QueryString["cid"].ToString(); M_ExClassgroup cinfo = ell.GetSelect(DataConverter.CLng(cid)); this.txt_Regulationame.Text = cinfo.Regulationame.ToString(); txt_Endtime.Text = cinfo.Endtime.ToString(); txt_Ratednumber.Text = cinfo.Ratednumber.ToString(); txt_Regulation.Text = cinfo.Regulation.ToString(); txt_Regulation.Text = cinfo.Regulation.ToString(); txt_Setuptime.Text = cinfo.Setuptime.ToString(); txtShiPrice.Text = cinfo.ShiPrice.ToString(); txtLinkPrice.Text = cinfo.LinPrice.ToString(); txtCoureTime.Text = cinfo.CourseHour.ToString(); rbl.Checked = cinfo.Presented == 1 ? true : false; classtype.SelectedValue = cinfo.ClassID.ToString(); classid_Hid.Value = cid; this.EBtnSubmit.Text = "修改学习组"; } } }
protected void EBtnSubmit_Click(object sender, EventArgs e) { string strDay = calculateTime(txt_Setuptime.Text, txt_Endtime.Text); //if (strDay != null) //{ // if (Convert.ToInt32(strDay) <= 0) // { // ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('结束时间不能小于或等于建立时间');</script>"); // return; // } // else // { // lbDay.Text = strDay + "天"; // } //} //else //{ // ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('建立与结束时间错误!');</script>"); // return; //} M_ExClassgroup exinfo = new M_ExClassgroup(); //exinfo.Actualnumber =DataConverter.CLng(this.txt_Actualnumber.Text); exinfo.Endtime = DataConverter.CDate(txt_Endtime.Text); exinfo.Ratednumber = DataConverter.CLng(txt_Ratednumber.Text); exinfo.Regulation = txt_Regulation.Text; exinfo.Regulationame = txt_Regulationame.Text; exinfo.Setuptime = DataConverter.CDate(txt_Setuptime.Text); exinfo.ShiPrice = DataConverter.CDouble(txtShiPrice.Text); exinfo.LinPrice = DataConverter.CDouble(txtLinkPrice.Text); exinfo.CourseHour = DataConverter.CLng(txtCoureTime.Text); exinfo.Presented = rbl.Checked ? 1 : 0; exinfo.ClassID = DataConverter.CLng(classtype.SelectedValue); if (!string.IsNullOrEmpty(Request.QueryString["cid"])) { int txt_Groupid = DataConverter.CLng(Request.QueryString["cid"].ToString()); exinfo.GroupID = txt_Groupid; ell.GetUpdate(exinfo); function.WriteSuccessMsg("修改成功!", "ClassManage.aspx"); } else { ell.GetInsert(exinfo); function.WriteSuccessMsg("添加成功!", "ClassManage.aspx"); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (Request.QueryString["cid"] != null) { string cid = Request.QueryString["cid"].ToString(); M_ExClassgroup cinfo = ell.GetSelect(DataConverter.CLng(cid)); this.txt_Regulationame.Text = cinfo.Regulationame.ToString(); txt_Endtime.Text = cinfo.Endtime.ToString(); txt_Ratednumber.Text = cinfo.Ratednumber.ToString(); txt_Regulation.Text = cinfo.Regulation.ToString(); txt_Regulation.Text = cinfo.Regulation.ToString(); txt_Setuptime.Text = cinfo.Setuptime.ToString(); txtShiPrice.Text = cinfo.ShiPrice.ToString(); txtLinkPrice.Text = cinfo.LinPrice.ToString(); txtCoureTime.Text = cinfo.CourseHour.ToString(); rbl.Checked = cinfo.Presented == 1 ? true : false; classtype.SelectedValue = cinfo.ClassID.ToString(); classid_Hid.Value = cid; this.EBtnSubmit.Text = "修改班级"; } } }
public bool GetUpdate(M_ExClassgroup model) { return(Sql.UpdateByIDs(strTableName, PK, model.GroupID.ToString(), initMod.GetFieldAndPara(), GetParameters(model))); }
public bool GetUpdate(M_ExClassgroup model) { return(DBCenter.UpdateByID(model, model.GroupID)); }