Exemplo n.º 1
0
        /// <summary>
        /// 添加促销单
        /// </summary>
        /// <param name="title"></param>
        /// <param name="desc"></param>
        /// <param name="status"></param>
        /// <param name="createUserSysNo"></param>
        /// <param name="?"></param>
        /// <returns></returns>
        public static bool AddNewPromotionTicket(string title, string desc, int status = 0, int createUserSysNo = 403)
        {
            bool result = false;

            PromotionMasterInfo pmInfo = new PromotionMasterInfo()
            {
                PromotionName = title,
                PromotionNote = desc,
                CreateTime = DateTime.Now,
                Status = status,
                CreateUserSysNo = createUserSysNo,
            };

            try
            {

                PromotionManager.GetInstance().InsertMaster(pmInfo);
                result = true;
                return result;
            }
            catch
            {
                return result;
            }
        }
Exemplo n.º 2
0
        public int Update(PromotionMasterInfo oParam)
        {
            string sql = @"UPDATE Promotion_Master SET
                            PromotionName=@PromotionName, PromotionNote=@PromotionNote,
                            CreateUserSysNo=@CreateUserSysNo, CreateTime=@CreateTime,
                            Status=@Status
                            WHERE SysNo=@SysNo";
              SqlCommand cmd = new SqlCommand(sql);

              SqlParameter paramSysNo = new SqlParameter("@SysNo", SqlDbType.Int, 4);
              SqlParameter paramPromotionName = new SqlParameter("@PromotionName", SqlDbType.NVarChar, 200);
              SqlParameter paramPromotionNote = new SqlParameter("@PromotionNote", SqlDbType.Text, 0);
              SqlParameter paramCreateUserSysNo = new SqlParameter("@CreateUserSysNo", SqlDbType.Int, 4);
              SqlParameter paramCreateTime = new SqlParameter("@CreateTime", SqlDbType.DateTime);
              SqlParameter paramStatus = new SqlParameter("@Status", SqlDbType.Int, 4);

              if (oParam.SysNo != AppConst.IntNull)
              paramSysNo.Value = oParam.SysNo;
              else
              paramSysNo.Value = System.DBNull.Value;
              if (oParam.PromotionName != AppConst.StringNull)
              paramPromotionName.Value = oParam.PromotionName;
              else
              paramPromotionName.Value = System.DBNull.Value;
              if (oParam.PromotionNote != AppConst.StringNull)
              paramPromotionNote.Value = oParam.PromotionNote;
              else
              paramPromotionNote.Value = System.DBNull.Value;
              if (oParam.CreateUserSysNo != AppConst.IntNull)
              paramCreateUserSysNo.Value = oParam.CreateUserSysNo;
              else
              paramCreateUserSysNo.Value = System.DBNull.Value;
              if (oParam.CreateTime != AppConst.DateTimeNull)
              paramCreateTime.Value = oParam.CreateTime;
              else
              paramCreateTime.Value = System.DBNull.Value;
              if (oParam.Status != AppConst.IntNull)
              paramStatus.Value = oParam.Status;
              else
              paramStatus.Value = System.DBNull.Value;

              cmd.Parameters.Add(paramSysNo);
              cmd.Parameters.Add(paramPromotionName);
              cmd.Parameters.Add(paramPromotionNote);
              cmd.Parameters.Add(paramCreateUserSysNo);
              cmd.Parameters.Add(paramCreateTime);
              cmd.Parameters.Add(paramStatus);

              return SqlHelper.ExecuteNonQuery(cmd);
        }
Exemplo n.º 3
0
        public int Insert(PromotionMasterInfo oParam)
        {
            string sql = @"INSERT INTO Promotion_Master
                            (
                            PromotionName, PromotionNote, CreateUserSysNo, CreateTime,
                            Status
                            )
                            VALUES (
                            @PromotionName, @PromotionNote, @CreateUserSysNo, @CreateTime,
                            @Status
                            );set @SysNo = SCOPE_IDENTITY();";
              SqlCommand cmd = new SqlCommand(sql);

              SqlParameter paramSysNo = new SqlParameter("@SysNo", SqlDbType.Int, 4);
              SqlParameter paramPromotionName = new SqlParameter("@PromotionName", SqlDbType.NVarChar, 200);
              SqlParameter paramPromotionNote = new SqlParameter("@PromotionNote", SqlDbType.Text, 0);
              SqlParameter paramCreateUserSysNo = new SqlParameter("@CreateUserSysNo", SqlDbType.Int, 4);
              SqlParameter paramCreateTime = new SqlParameter("@CreateTime", SqlDbType.DateTime);
              SqlParameter paramStatus = new SqlParameter("@Status", SqlDbType.Int, 4);
              paramSysNo.Direction = ParameterDirection.Output;
              if (oParam.PromotionName != AppConst.StringNull)
              paramPromotionName.Value = oParam.PromotionName;
              else
              paramPromotionName.Value = System.DBNull.Value;
              if (oParam.PromotionNote != AppConst.StringNull)
              paramPromotionNote.Value = oParam.PromotionNote;
              else
              paramPromotionNote.Value = System.DBNull.Value;
              if (oParam.CreateUserSysNo != AppConst.IntNull)
              paramCreateUserSysNo.Value = oParam.CreateUserSysNo;
              else
              paramCreateUserSysNo.Value = System.DBNull.Value;
              if (oParam.CreateTime != AppConst.DateTimeNull)
              paramCreateTime.Value = oParam.CreateTime;
              else
              paramCreateTime.Value = System.DBNull.Value;
              if (oParam.Status != AppConst.IntNull)
              paramStatus.Value = oParam.Status;
              else
              paramStatus.Value = System.DBNull.Value;

              cmd.Parameters.Add(paramSysNo);
              cmd.Parameters.Add(paramPromotionName);
              cmd.Parameters.Add(paramPromotionNote);
              cmd.Parameters.Add(paramCreateUserSysNo);
              cmd.Parameters.Add(paramCreateTime);
              cmd.Parameters.Add(paramStatus);

              return SqlHelper.ExecuteNonQuery(cmd, out oParam.SysNo);
        }
Exemplo n.º 4
0
 private void map(PromotionMasterInfo oParam, DataRow tempdr)
 {
     oParam.SysNo = Util.TrimIntNull(tempdr["SysNo"]);
       oParam.PromotionName = Util.TrimNull(tempdr["PromotionName"]);
       oParam.PromotionNote = Util.TrimNull(tempdr["PromotionNote"]);
       oParam.CreateUserSysNo = Util.TrimIntNull(tempdr["CreateUserSysNo"]);
       oParam.CreateTime = Util.TrimDateNull(tempdr["CreateTime"]);
       oParam.Status = Util.TrimIntNull(tempdr["Status"]);
 }
Exemplo n.º 5
0
 public void UpdateMaster(PromotionMasterInfo oParam)
 {
     new PromotionMasterDac().Update(oParam);
 }
Exemplo n.º 6
0
 public PromotionMasterInfo Load(int sysNo)
 {
     string sql = "select * from Promotion_Master where sysno =" + sysNo;
       DataSet ds = SqlHelper.ExecuteDataSet(sql);
       if (!Util.HasMoreRow(ds))
       return null;
       PromotionMasterInfo oMasterInfo = new PromotionMasterInfo();
       map(oMasterInfo, ds.Tables[0].Rows[0]);
       return oMasterInfo;
 }
Exemplo n.º 7
0
 public void InsertMaster(PromotionMasterInfo oParam)
 {
     new PromotionMasterDac().Insert(oParam);
 }
Exemplo n.º 8
0
 /// <summary>
 /// 更新促销单
 /// </summary>
 /// <param name="pmInfo"></param>
 /// <returns></returns>
 public static bool UpdatePromotionTicket(PromotionMasterInfo pmInfo)
 {
     string sqlCmd = String.Format(UpdatePromotionSqlCmdTemplate, pmInfo.PromotionName, pmInfo.PromotionNote, pmInfo.CreateTime, pmInfo.Status, pmInfo.SysNo);
     try
     {
         if (new SqlDBHelper().ExecuteNonQuery(sqlCmd) > 0)
         {
             return true;
         }
         else
         {
             return false;
         }
     }
     catch
     {
         return false;
     }
 }