protected void EBtnModify_Click(object sender, EventArgs e) { M_Source msource = new M_Source(); B_Source bsource = new B_Source(); msource.SourceID = Convert.ToInt32(Request.QueryString["SId"].Trim()); msource.Name = TxtName.Text.ToString(); msource.Address = TxtAddress.Text.ToString(); msource.Tel = TxtTel.Text.ToString(); msource.Fax = TxtFax.Text.ToString(); msource.Contacter = TxtContacterName.Text.ToString(); msource.HomePage = TxtHomePage.Text.ToString(); msource.Photo = txtpic.Text.ToString();//../../manage/Images/default.gif msource.ZipCode = DataConverter.CLng(TxtZipCode.Text); msource.Email = TxtEmail.Text.ToString(); msource.Mail = TxtMail.Text.ToString(); msource.Im = TxtIm.Text.ToString(); msource.LastUseTime = DateTime.Now; msource.Type = TxtType.Text.ToString(); if (ChkElite.Checked) { msource.IsElite = true; } else { msource.IsElite = false; } if (ChkOnTop.Checked) { msource.onTop = true; } else { msource.onTop = false; } msource.Intro = ChkPass.Text.ToString(); if (ChkPass.Checked) { msource.Passed = true; } else { msource.Passed = false; } if (bsource.Update(msource)) { Response.Write("<script language=javascript> alert('修改成功!');window.document.location.href='SourceManage.aspx';</script>"); } }
private SqlParameter[] GetParameters(M_Source sourceInfo) { SqlParameter[] parameter = new SqlParameter[] { new SqlParameter("@Type", SqlDbType.VarChar,50), new SqlParameter("@Name", SqlDbType.VarChar,50), new SqlParameter("@Passed", SqlDbType.Bit), new SqlParameter("@onTop", SqlDbType.Bit), new SqlParameter("@IsElite", SqlDbType.Bit), new SqlParameter("@Hits", SqlDbType.Int,4), new SqlParameter("@LastUseTime", SqlDbType.DateTime), new SqlParameter("@Photo", SqlDbType.VarChar,50), new SqlParameter("@Intro", SqlDbType.NVarChar,255), new SqlParameter("@Address", SqlDbType.VarChar,50), new SqlParameter("@Tel", SqlDbType.VarChar,50), new SqlParameter("@Fax", SqlDbType.VarChar,50), new SqlParameter("@Mail", SqlDbType.VarChar,50), new SqlParameter("@Email", SqlDbType.VarChar,50), new SqlParameter("@ZipCode", SqlDbType.Int), new SqlParameter("@HomePage", SqlDbType.VarChar,50), new SqlParameter("@Im", SqlDbType.VarChar,50), new SqlParameter("@ContacterName", SqlDbType.VarChar,50), new SqlParameter("@ID", SqlDbType.Int,4), }; parameter[0].Value = sourceInfo.Type; parameter[1].Value = sourceInfo.Name; parameter[2].Value = sourceInfo.Passed; parameter[3].Value = sourceInfo.onTop; parameter[4].Value = sourceInfo.IsElite; parameter[5].Value = sourceInfo.Hits; parameter[6].Value = sourceInfo.LastUseTime; parameter[7].Value = sourceInfo.Photo; parameter[8].Value = sourceInfo.Intro; parameter[9].Value = sourceInfo.Address; parameter[10].Value = sourceInfo.Tel; parameter[11].Value = sourceInfo.Fax; parameter[12].Value = sourceInfo.Mail; parameter[13].Value = sourceInfo.Email; parameter[14].Value = sourceInfo.ZipCode; parameter[15].Value = sourceInfo.HomePage; parameter[16].Value = sourceInfo.Im; parameter[17].Value = sourceInfo.Contacter; parameter[18].Value = sourceInfo.SourceID; return parameter; }
public bool Update(M_Source SourceInfo) { return SourceMethod.Update(SourceInfo); }
public bool Add(M_Source sourceInfo) { return SourceMethod.Add(sourceInfo); }
public bool Update(M_Source SourceInfo) { SqlParameter[] cmdParams = GetParameters(SourceInfo); ; return SqlHelper.ExecuteProc("PR_Source_Update", cmdParams); }
public bool Add(M_Source SourceInfo) { string strSql = "PR_Source_Insert"; SqlParameter[] parameter = GetParameters(SourceInfo); return SqlHelper.ExecuteProc(strSql, parameter); }
private M_Source GetSourceInfoFromReader(SqlDataReader reader) { M_Source info = new M_Source(); info.Type = reader["Type"].ToString(); info.Name = reader["Name"].ToString(); info.Passed = DataConverter.CBool(reader["Passed"].ToString()); info.onTop = DataConverter.CBool(reader["onTop"].ToString()); info.IsElite = DataConverter.CBool(reader["IsElite"].ToString()); info.Hits = DataConverter.CLng(reader["Hits"].ToString()); info.LastUseTime = DataConverter.CDate(reader["LastUseTime"].ToString()); info.Photo = reader["Photo"].ToString(); info.Intro = reader["Intro"].ToString(); info.Address = reader["Address"].ToString(); info.Tel = reader["Tel"].ToString(); info.Fax = reader["Fax"].ToString(); info.Mail = reader["Mail"].ToString(); info.Email = reader["Email"].ToString(); info.ZipCode = DataConverter.CLng(reader["ZipCode"].ToString()); info.HomePage = reader["HomePage"].ToString(); info.Im =reader["Im"].ToString(); info.Contacter = reader["Contacter"].ToString(); reader.Close(); return info; }