public override SqlParameter[] GetParameters() { M_Spec model = this; SqlParameter[] sp = GetSP(); if (model.CDate <= DateTime.MinValue) { model.CDate = DateTime.Now; } model.EditDate = DateTime.Now; sp[0].Value = model.SpecID; sp[1].Value = model.SpecName; sp[2].Value = model.SpecDir; sp[3].Value = model.SpecDesc; sp[4].Value = model.OpenNew; sp[5].Value = model.SpecCate; sp[6].Value = model.ListFileExt; sp[7].Value = model.ListTemplate; sp[8].Value = model.ListFileRule; sp[9].Value = model.SpecDescriptive; sp[10].Value = model.SpecKeyword; sp[11].Value = model.SpecPicUrl; sp[12].Value = model.SpecTips; sp[13].Value = model.Pid; sp[14].Value = model.CDate; sp[15].Value = model.CUser; sp[16].Value = model.EditDate; sp[17].Value = model.OrderID; return(sp); }
protected void EBtnSubmit_Click(object sender, EventArgs e) { if (this.Page.IsValid) { M_Spec info = new M_Spec(); info.SpecID = DataConverter.CLng(this.HdnSpecID.Value); info.SpecName = this.TxtSpecName.Text; info.SpecDir = this.TxtSpecDir.Text; info.SpecDesc = this.TxtSpecDesc.Text; info.SpecCate = DataConverter.CLng(this.HdnCateID.Value); info.OpenNew = DataConverter.CBool(this.RBLOpenType.SelectedValue); info.ListFileExt = DataConverter.CLng(this.RBLFileExt.SelectedValue); info.ListFileRule = DataConverter.CLng(this.RBLListFileRule.SelectedValue); info.ListTemplate = this.TxtListTemplate.Text; if (info.SpecID > 0) { this.bll.AddSpec(info); } else { this.bll.UpdateSpec(info); } Response.Redirect("SpecList.aspx?CateID=" + this.HdnCateID.Value); } }
public M_Spec GetModelFromReader(DbDataReader rdr) { M_Spec model = new M_Spec(); model.SpecID = Convert.ToInt32(rdr["SpecID"]); model.SpecName = rdr["SpecName"].ToString(); model.SpecDir = rdr["SpecDir"].ToString(); model.SpecDesc = rdr["SpecDesc"].ToString(); model.OpenNew = ConverToBool(rdr["OpenType"]); model.SpecCate = ConvertToInt(rdr["SpecCate"]); model.ListFileExt = ConvertToInt(rdr["ListFileExt"]); model.ListTemplate = rdr["ListTemplate"].ToString(); model.ListFileRule = ConvertToInt(rdr["ListFileRule"]); model.SpecDescriptive = rdr["SpecDescriptive"].ToString(); model.SpecKeyword = rdr["SpecKeyword"].ToString(); model.SpecPicUrl = rdr["SpecPicUrl"].ToString(); model.SpecTips = rdr["SpecTips"].ToString(); model.Pid = ConvertToInt(rdr["Pid"]); model.CDate = ConvertToDate(rdr["CDate"]); model.EditDate = ConvertToDate(rdr["EditDate"]); model.CUser = ConverToStr(rdr["CUser"]); model.OrderID = ConvertToInt(rdr["OrderID"]); rdr.Close(); return(model); }
public M_Node ToNode() { M_Spec specMod = this; M_Node nodeMod = new M_Node(); nodeMod.NodeID = specMod.SpecID; nodeMod.NodeName = specMod.SpecName; nodeMod.NodeDir = specMod.SpecDir; nodeMod.Description = specMod.SpecDesc; nodeMod.OpenTypeTrue = specMod.OpenNew ? "_blank" : "_self"; nodeMod.ListPageEx = specMod.ListFileExt; nodeMod.ListTemplateFile = specMod.ListTemplate; nodeMod.Meta_Keywords = specMod.SpecKeyword; nodeMod.NodePic = specMod.SpecPicUrl; nodeMod.Tips = specMod.SpecTips; nodeMod.ParentID = specMod.Pid; nodeMod.CDate = specMod.CDate; nodeMod.CUName = specMod.CUser; nodeMod.EditDate = specMod.EditDate; nodeMod.OrderID = specMod.OrderID; return(nodeMod); }
/// <summary> /// 从DataReader中读取专题信息 /// </summary> /// <param name="rdr">DataReader</param> /// <returns></returns> private static M_Spec GetInfoFromReader(SqlDataReader rdr) { M_Spec info = new M_Spec(); info.SpecID = DataConverter.CLng(rdr["SpecID"]); info.SpecName = rdr["SpecName"].ToString(); info.SpecDir = rdr["SpecDir"].ToString(); info.SpecDesc = rdr["SpecDesc"].ToString(); info.SpecCate = DataConverter.CLng(rdr["SpecCate"]); info.OpenNew = DataConverter.CBool(rdr["OpenType"].ToString()); info.ListFileExt = DataConverter.CLng(rdr["ListFileExt"]); info.ListFileRule = DataConverter.CLng(rdr["ListFileRule"]); info.ListTemplate = rdr["ListTemplate"].ToString(); return info; }
void ID_Spec.UpdateSpec(M_Spec Spec) { string strSql = "PR_Spec_AddUpdate"; SqlParameter[] cmdParams = GetParameters(Spec); SqlHelper.ExecuteProc(strSql, cmdParams); }
/// <summary> /// 将专题信息的各属性值传递到参数中 /// </summary> /// <param name="administratorInfo"></param> /// <returns></returns> private static SqlParameter[] GetParameters(M_Spec Spec) { SqlParameter[] parameter = new SqlParameter[] { new SqlParameter("@SpecID", SqlDbType.Int), new SqlParameter("@SpecName", SqlDbType.NVarChar, 50), new SqlParameter("@SpecDir", SqlDbType.NVarChar, 50), new SqlParameter("@SpecDesc", SqlDbType.NVarChar, 255), new SqlParameter("@OpenType", SqlDbType.Bit, 1), new SqlParameter("@SpecCate",SqlDbType.Int), new SqlParameter("@ListFileExt", SqlDbType.Int, 4), new SqlParameter("@ListFileRule",SqlDbType.Int,4), new SqlParameter("@ListTemplate", SqlDbType.NVarChar, 255) }; parameter[0].Value = Spec.SpecID; parameter[1].Value = Spec.SpecName; parameter[2].Value = Spec.SpecDir; parameter[3].Value = Spec.SpecDesc; parameter[4].Value = Spec.OpenNew; parameter[5].Value = Spec.SpecCate; parameter[6].Value = Spec.ListFileExt; parameter[7].Value = Spec.ListFileRule; parameter[8].Value = Spec.ListTemplate; return parameter; }
public void UpdateSpec(M_Spec Spec) { dal.UpdateSpec(Spec); }
public void AddSpec(M_Spec Spec) { dal.AddSpec(Spec); }