public int Insert(FeedBackInfo oParam) { string sql = @"INSERT INTO FeedBack ( CustomerSysNo, Subject, Suggest, NickName, Email, Phone, Memo, Note, CreateTime, UpdateTime,UpdateUserSysNo, Status,Sosysno ) VALUES ( @CustomerSysNo, @Subject, @Suggest, @NickName, @Email, @Phone, @Memo, @Note, @CreateTime, @UpdateTime,@UpdateUserSysNo, @Status,@Sosysno );set @SysNo = SCOPE_IDENTITY();"; SqlCommand cmd = new SqlCommand(sql); SqlParameter paramSysNo = new SqlParameter("@SysNo", SqlDbType.Int,4); SqlParameter paramCustomerSysNo = new SqlParameter("@CustomerSysNo", SqlDbType.Int, 4); SqlParameter paramSubject = new SqlParameter("@Subject", SqlDbType.NVarChar,250); SqlParameter paramSuggest = new SqlParameter("@Suggest", SqlDbType.NVarChar,2000); SqlParameter paramNickName = new SqlParameter("@NickName", SqlDbType.NVarChar,50); SqlParameter paramEmail = new SqlParameter("@Email", SqlDbType.NVarChar,50); SqlParameter paramPhone = new SqlParameter("@Phone", SqlDbType.NVarChar,50); SqlParameter paramMemo = new SqlParameter("@Memo", SqlDbType.NVarChar,500); SqlParameter paramNote = new SqlParameter("@Note", SqlDbType.NVarChar,500); SqlParameter paramCreateTime = new SqlParameter("@CreateTime", SqlDbType.DateTime); SqlParameter paramUpdateTime = new SqlParameter("@UpdateTime", SqlDbType.DateTime); SqlParameter paramUpdateUserSysNo = new SqlParameter("@UpdateUserSysNo", SqlDbType.Int,4); SqlParameter paramStatus = new SqlParameter("@Status", SqlDbType.Int,4); SqlParameter paramSosysno = new SqlParameter("@Sosysno", SqlDbType.Int, 4); paramSysNo.Direction = ParameterDirection.Output; if (oParam.CustomerSysNo != AppConst.IntNull) paramCustomerSysNo.Value = oParam.CustomerSysNo; else paramCustomerSysNo.Value = System.DBNull.Value; if ( oParam.Subject != AppConst.StringNull) paramSubject.Value = oParam.Subject; else paramSubject.Value = System.DBNull.Value; if ( oParam.Suggest != AppConst.StringNull) paramSuggest.Value = oParam.Suggest; else paramSuggest.Value = System.DBNull.Value; if ( oParam.NickName != AppConst.StringNull) paramNickName.Value = oParam.NickName; else paramNickName.Value = System.DBNull.Value; if ( oParam.Email != AppConst.StringNull) paramEmail.Value = oParam.Email; else paramEmail.Value = System.DBNull.Value; if ( oParam.Phone != AppConst.StringNull) paramPhone.Value = oParam.Phone; else paramPhone.Value = System.DBNull.Value; if ( oParam.Memo != AppConst.StringNull) paramMemo.Value = oParam.Memo; else paramMemo.Value = System.DBNull.Value; if ( oParam.Note != AppConst.StringNull) paramNote.Value = oParam.Note; else paramNote.Value = System.DBNull.Value; if ( oParam.CreateTime != AppConst.DateTimeNull) paramCreateTime.Value = oParam.CreateTime; else paramCreateTime.Value = System.DBNull.Value; if ( oParam.UpdateTime != AppConst.DateTimeNull) paramUpdateTime.Value = oParam.UpdateTime; else paramUpdateTime.Value = System.DBNull.Value; if (oParam.UpdateUserSysNo != AppConst.IntNull) paramUpdateUserSysNo.Value = oParam.UpdateUserSysNo; else paramUpdateUserSysNo.Value = System.DBNull.Value; if ( oParam.Status != AppConst.IntNull) paramStatus.Value = oParam.Status; else paramStatus.Value = System.DBNull.Value; if (oParam.Sosysno != AppConst.IntNull) paramSosysno.Value = oParam.Sosysno; else paramSosysno.Value = System.DBNull.Value; cmd.Parameters.Add(paramSysNo); cmd.Parameters.Add(paramCustomerSysNo); cmd.Parameters.Add(paramSubject); cmd.Parameters.Add(paramSuggest); cmd.Parameters.Add(paramNickName); cmd.Parameters.Add(paramEmail); cmd.Parameters.Add(paramPhone); cmd.Parameters.Add(paramMemo); cmd.Parameters.Add(paramNote); cmd.Parameters.Add(paramCreateTime); cmd.Parameters.Add(paramUpdateTime); cmd.Parameters.Add(paramUpdateUserSysNo); cmd.Parameters.Add(paramStatus); cmd.Parameters.Add(paramSosysno); return SqlHelper.ExecuteNonQuery(cmd, out oParam.SysNo); }
private void map(FeedBackInfo oParam, DataRow tempdr) { oParam.SysNo = Util.TrimIntNull(tempdr["SysNo"]); oParam.CustomerSysNo = Util.TrimIntNull(tempdr["CustomerSysNo"]); oParam.Subject = Util.TrimNull(tempdr["Subject"]); oParam.Suggest = Util.TrimNull(tempdr["Suggest"]); oParam.NickName = Util.TrimNull(tempdr["NickName"]); oParam.Email = Util.TrimNull(tempdr["Email"]); oParam.Phone = Util.TrimNull(tempdr["Phone"]); oParam.Memo = Util.TrimNull(tempdr["Memo"]); oParam.Note = Util.TrimNull(tempdr["Note"]); oParam.CreateTime = Util.TrimDateNull(tempdr["CreateTime"]); oParam.UpdateTime = Util.TrimDateNull(tempdr["UpdateTime"]); oParam.UpdateUserSysNo = Util.TrimIntNull(tempdr["UpdateUserSysNo"]); oParam.Status = Util.TrimIntNull(tempdr["Status"]); oParam.Sosysno = Util.TrimIntNull(tempdr["Sosysno"]); }
public void Insert(FeedBackInfo oParam) { new FeedBackDac().Insert(oParam); }
public FeedBackInfo Load(int sysno) { string sql = "select * from feedback where sysno = " + sysno; DataSet ds = SqlHelper.ExecuteDataSet(sql); if ( !Util.HasMoreRow(ds)) return null; FeedBackInfo oInfo = new FeedBackInfo(); map(oInfo, ds.Tables[0].Rows[0]); return oInfo; }
public void Import() { if ( !AppConfig.IsImportable) throw new BizException("Is Importable is false"); /* do not use the following code after Data Pour in */ string sql = " select top 1 * from feedback "; DataSet ds = SqlHelper.ExecuteDataSet(sql); if ( Util.HasMoreRow(ds) ) throw new BizException("the table feedback is not empty"); TransactionOptions options = new TransactionOptions(); options.IsolationLevel = System.Transactions.IsolationLevel.ReadCommitted; options.Timeout = TransactionManager.DefaultTimeout; using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required, options)) { string sql1 = @"select 1 as sysno, subject, suggest, usercode as nickname, usermail as email, userphone as phone, Icsonoutfeed as memo, Icsoninfeed as note, createtime, status, null as updatetime from ipp2003..feedback feedback"; DataSet ds1 = SqlHelper.ExecuteDataSet(sql1); /* * <option selected="selected" value="0">δ����</option> <option value="1">�Ѵ���</option> <option value="2">Icson��ʾ</option> <option value="3">ɾ��</option> ipp2��3���õ�״̬��һ���ģ����Բ���Ҫת�� */ foreach(DataRow dr1 in ds1.Tables[0].Rows) { FeedBackInfo oFeedBack = new FeedBackInfo(); map(oFeedBack,dr1); if ( oFeedBack.Subject == AppConst.StringNull) oFeedBack.Subject = "��"; if ( oFeedBack.Suggest == AppConst.StringNull) oFeedBack.Suggest = "��"; if ( oFeedBack.NickName == AppConst.StringNull ) oFeedBack.NickName = "��"; new FeedBackDac().Insert(oFeedBack); } scope.Complete(); } }