Beispiel #1
0
        public int Insert(CustomerCommendInfo oParam)
        {
            string sql = @"INSERT INTO Customer_Commend
                            (
                            CustomerSysNo, FriendName, CommendEmail, CommendTime, CommendStatus
                            )
                            VALUES (
                            @CustomerSysNo, @FriendName, @CommendEmail, @CommendTime, @CommendStatus
                            );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 paramFriendName = new SqlParameter("@FriendName", SqlDbType.NVarChar, 200);
            SqlParameter paramCommendEmail = new SqlParameter("@CommendEmail", SqlDbType.NVarChar, 200);
            SqlParameter paramCommendTime = new SqlParameter("@CommendTime", SqlDbType.DateTime);
            SqlParameter paramCommendStatus = new SqlParameter("@CommendStatus", SqlDbType.Int, 4);
            paramSysNo.Direction = ParameterDirection.Output;
            if (oParam.CustomerSysNo != AppConst.IntNull)
                paramCustomerSysNo.Value = oParam.CustomerSysNo;
            else
                paramCustomerSysNo.Value = System.DBNull.Value;
            if (oParam.FriendName != AppConst.StringNull)
                paramFriendName.Value = oParam.FriendName;
            else
                paramFriendName.Value = System.DBNull.Value;
            if (oParam.CommendEmail != AppConst.StringNull)
                paramCommendEmail.Value = oParam.CommendEmail;
            else
                paramCommendEmail.Value = System.DBNull.Value;
            if (oParam.CommendTime != AppConst.DateTimeNull)
                paramCommendTime.Value = oParam.CommendTime;
            else
                paramCommendTime.Value = System.DBNull.Value;
            if (oParam.CommendStatus != AppConst.IntNull)
                paramCommendStatus.Value = oParam.CommendStatus;
            else
                paramCommendStatus.Value = System.DBNull.Value;

            cmd.Parameters.Add(paramSysNo);
            cmd.Parameters.Add(paramCustomerSysNo);
            cmd.Parameters.Add(paramFriendName);
            cmd.Parameters.Add(paramCommendEmail);
            cmd.Parameters.Add(paramCommendTime);
            cmd.Parameters.Add(paramCommendStatus);

            return SqlHelper.ExecuteNonQuery(cmd, out oParam.SysNo);
        }
Beispiel #2
0
        public int Update(CustomerCommendInfo oParam)
        {
            string sql = @"UPDATE Customer_Commend SET
                            CustomerSysNo=@CustomerSysNo, FriendName=@FriendName,
                            CommendEmail=@CommendEmail, CommendTime=@CommendTime,
                            CommendStatus=@CommendStatus
                            WHERE SysNo=@SysNo";
            SqlCommand cmd = new SqlCommand(sql);

            SqlParameter paramSysNo = new SqlParameter("@SysNo", SqlDbType.Int, 4);
            SqlParameter paramCustomerSysNo = new SqlParameter("@CustomerSysNo", SqlDbType.Int, 4);
            SqlParameter paramFriendName = new SqlParameter("@FriendName", SqlDbType.NVarChar, 200);
            SqlParameter paramCommendEmail = new SqlParameter("@CommendEmail", SqlDbType.NVarChar, 200);
            SqlParameter paramCommendTime = new SqlParameter("@CommendTime", SqlDbType.DateTime);
            SqlParameter paramCommendStatus = new SqlParameter("@CommendStatus", SqlDbType.Int, 4);

            if (oParam.SysNo != AppConst.IntNull)
                paramSysNo.Value = oParam.SysNo;
            else
                paramSysNo.Value = System.DBNull.Value;
            if (oParam.CustomerSysNo != AppConst.IntNull)
                paramCustomerSysNo.Value = oParam.CustomerSysNo;
            else
                paramCustomerSysNo.Value = System.DBNull.Value;
            if (oParam.FriendName != AppConst.StringNull)
                paramFriendName.Value = oParam.FriendName;
            else
                paramFriendName.Value = System.DBNull.Value;
            if (oParam.CommendEmail != AppConst.StringNull)
                paramCommendEmail.Value = oParam.CommendEmail;
            else
                paramCommendEmail.Value = System.DBNull.Value;
            if (oParam.CommendTime != AppConst.DateTimeNull)
                paramCommendTime.Value = oParam.CommendTime;
            else
                paramCommendTime.Value = System.DBNull.Value;
            if (oParam.CommendStatus != AppConst.IntNull)
                paramCommendStatus.Value = oParam.CommendStatus;
            else
                paramCommendStatus.Value = System.DBNull.Value;

            cmd.Parameters.Add(paramSysNo);
            cmd.Parameters.Add(paramCustomerSysNo);
            cmd.Parameters.Add(paramFriendName);
            cmd.Parameters.Add(paramCommendEmail);
            cmd.Parameters.Add(paramCommendTime);
            cmd.Parameters.Add(paramCommendStatus);

            return SqlHelper.ExecuteNonQuery(cmd);
        }
Beispiel #3
0
        public CustomerCommendInfo LoadCustomerCommend(string CommendEmail)
        {
            string sql = "select * from customer_commend where commendemail=" + Util.ToSqlString(CommendEmail);
            DataSet ds = SqlHelper.ExecuteDataSet(sql);
            if(!Util.HasMoreRow(ds))
                return null;

            CustomerCommendInfo oInfo = new CustomerCommendInfo();
            map(oInfo,ds.Tables[0].Rows[0]);
            return oInfo;
        }
Beispiel #4
0
 private void map(CustomerCommendInfo oParam, DataRow tempdr)
 {
     oParam.SysNo = Util.TrimIntNull(tempdr["SysNo"]);
     oParam.CustomerSysNo = Util.TrimIntNull(tempdr["CustomerSysNo"]);
     oParam.FriendName = Util.TrimNull(tempdr["FriendName"]);
     oParam.CommendEmail = Util.TrimNull(tempdr["CommendEmail"]);
     oParam.CommendTime = Util.TrimDateNull(tempdr["CommendTime"]);
     oParam.CommendStatus = Util.TrimIntNull(tempdr["CommendStatus"]);
 }
Beispiel #5
0
 public int InsertCustomerCommend(CustomerCommendInfo oParam)
 {
     return new FreeShipFeeDac().Insert(oParam);
 }