public prjaccountModel GetModel(string accountid) { StringBuilder builder = new StringBuilder(); builder.Append("select id,accountid,prjNum,accountNum,acountName,authorizer,creatData,isActivity,activeData,activeMan,remark,createMan,contractNum,isnullify from fund_Prjaccount "); builder.Append(" where accountid=@accountid "); SqlParameter[] commandParameters = new SqlParameter[] { new SqlParameter("@accountid", SqlDbType.VarChar, 0x24) }; commandParameters[0].Value = accountid; prjaccountModel model = new prjaccountModel(); SqlConnection conn = new SqlConnection(SqlHelper.ConnectionString); DataSet set = SqlHelper.ExecuteQuery(conn, CommandType.Text, builder.ToString(), commandParameters); if (set.Tables[0].Rows.Count <= 0) { return(null); } if (set.Tables[0].Rows[0]["id"].ToString() != "") { model.id = int.Parse(set.Tables[0].Rows[0]["id"].ToString()); } if (set.Tables[0].Rows[0]["prjNum"].ToString() != "") { model.prjNum = new Guid(set.Tables[0].Rows[0]["prjNum"].ToString()); } model.accountNum = set.Tables[0].Rows[0]["accountNum"].ToString(); model.acountName = set.Tables[0].Rows[0]["acountName"].ToString(); model.authorizer = set.Tables[0].Rows[0]["authorizer"].ToString(); if (set.Tables[0].Rows[0]["creatData"].ToString() != "") { model.creatData = new DateTime?(DateTime.Parse(set.Tables[0].Rows[0]["creatData"].ToString())); } if (set.Tables[0].Rows[0]["isActivity"].ToString() != "") { model.isActivity = new int?(int.Parse(set.Tables[0].Rows[0]["isActivity"].ToString())); } if (set.Tables[0].Rows[0]["activeData"].ToString() != "") { model.activeData = new DateTime?(DateTime.Parse(set.Tables[0].Rows[0]["activeData"].ToString())); } model.activeMan = set.Tables[0].Rows[0]["activeMan"].ToString(); model.remark = set.Tables[0].Rows[0]["remark"].ToString(); model.createMan = set.Tables[0].Rows[0]["createMan"].ToString(); if (set.Tables[0].Rows[0]["contractNum"].ToString() != "") { model.contractNum = set.Tables[0].Rows[0]["contractNum"].ToString(); } if (set.Tables[0].Rows[0]["accountid"].ToString() != "") { model.contractNum = set.Tables[0].Rows[0]["accountid"].ToString(); } if (set.Tables[0].Rows[0]["isnullify"].ToString() != "") { model.isnullify = set.Tables[0].Rows[0]["isnullify"].ToString(); } return(model); }
public int upActivityDal(SqlTransaction trans, prjaccountModel model) { StringBuilder builder = new StringBuilder(); builder.Append("update fund_Prjaccount set "); builder.Append("isActivity=@isActivity,"); builder.Append("activeData=@activeData,"); builder.Append("activeMan=@activeMan"); builder.Append(" where accountid=@accountid "); SqlParameter[] commandParameters = new SqlParameter[] { new SqlParameter("@isActivity", SqlDbType.Int, 4), new SqlParameter("@activeData", SqlDbType.DateTime), new SqlParameter("@activeMan", SqlDbType.VarChar, 50), new SqlParameter("@accountid", SqlDbType.UniqueIdentifier, 0x24) }; commandParameters[0].Value = model.isActivity; commandParameters[1].Value = model.activeData; commandParameters[2].Value = model.activeMan; commandParameters[3].Value = model.accountID; return(SqlHelper.ExecuteNonQuery(trans, CommandType.Text, builder.ToString(), commandParameters)); }
public int Update(prjaccountModel model) { StringBuilder builder = new StringBuilder(); builder.Append("update fund_Prjaccount set "); builder.Append("acountName=@acountName,"); builder.Append("authorizer=@authorizer,"); builder.Append("remark=@remark,"); builder.Append("accountNum=@accountNum"); builder.Append(" where accountid=@accountid "); SqlParameter[] commandParameters = new SqlParameter[] { new SqlParameter("@acountName", SqlDbType.VarChar, 50), new SqlParameter("@authorizer", SqlDbType.VarChar, 0x1388), new SqlParameter("@remark", SqlDbType.VarChar, 0x7d0), new SqlParameter("@accountNum", SqlDbType.VarChar, 0x3e8), new SqlParameter("@accountid", SqlDbType.UniqueIdentifier, 0x10) }; commandParameters[0].Value = model.acountName; commandParameters[1].Value = model.authorizer; commandParameters[2].Value = model.remark; commandParameters[3].Value = model.accountNum; commandParameters[4].Value = model.accountID; return(SqlHelper.ExecuteNonQuery(CommandType.Text, builder.ToString(), commandParameters)); }
public int Add(SqlTransaction trans, prjaccountModel model) { StringBuilder builder = new StringBuilder(); builder.Append("insert into fund_Prjaccount("); builder.Append("prjNum,accountNum,acountName,authorizer,creatData,isActivity,remark,createMan,contractNum)"); builder.Append(" values ("); builder.Append("@prjNum,@accountNum,@acountName,@authorizer,@creatData,@isActivity,@remark,@createMan,@contractNum)"); SqlParameter[] commandParameters = new SqlParameter[] { new SqlParameter("@prjNum", SqlDbType.UniqueIdentifier, 9), new SqlParameter("@accountNum", SqlDbType.VarChar, 50), new SqlParameter("@acountName", SqlDbType.VarChar, 50), new SqlParameter("@authorizer", SqlDbType.VarChar, 0x1388), new SqlParameter("@creatData", SqlDbType.DateTime), new SqlParameter("@isActivity", SqlDbType.Int, 4), new SqlParameter("@remark", SqlDbType.VarChar, 0x7d0), new SqlParameter("@createMan", SqlDbType.VarChar, 50), new SqlParameter("@contractNum", SqlDbType.VarChar, 0x3e8) }; commandParameters[0].Value = model.prjNum; commandParameters[1].Value = model.accountNum; commandParameters[2].Value = model.acountName; commandParameters[3].Value = model.authorizer; commandParameters[4].Value = model.creatData; commandParameters[5].Value = model.isActivity; commandParameters[6].Value = model.remark; commandParameters[7].Value = model.createMan; commandParameters[8].Value = model.contractNum; return(SqlHelper.ExecuteNonQuery(trans, CommandType.Text, builder.ToString(), commandParameters)); }