public static bool UpdatePromotion(tbl_UserPromotionCode model)
        {
            string sql  = @"
UPDATE Gungnir..tbl_UserPromotioncode SET [SImage]=@SImage, BImage=@BImage,RuleGuid=@RuleGuid,UserRank=@UserRank,CouponName=@CouponName,CouponDescription=@CouponDescription
WHERE ID=@ID";
            var    conn = ConfigurationManager.ConnectionStrings["Gungnir"].ConnectionString;

            if (SecurityHelp.IsBase64Formatted(conn))
            {
                conn = SecurityHelp.DecryptAES(conn);
            }
            using (var dbhelper = new SqlDbHelper(conn))
            {
                SqlCommand cmd = new SqlCommand(sql);
                cmd.CommandType = CommandType.Text;
                cmd.Parameters.AddWithValue("@SImage", model.SImage);
                cmd.Parameters.AddWithValue("@BImage", model.BImage);
                cmd.Parameters.AddWithValue("@RuleGuid", model.RuleGuid);
                cmd.Parameters.AddWithValue("@UserRank", model.UserRank);
                cmd.Parameters.AddWithValue("@ID", model.ID);
                cmd.Parameters.AddWithValue("@CouponName", model.CouponName);
                cmd.Parameters.AddWithValue("@CouponDescription", model.CouponDescription);
                return(dbhelper.ExecuteNonQuery(cmd) > 0);
            }
        }
Example #2
0
 public ActionResult SavePromotion(tbl_UserPromotionCode model)
 {
     if (UserPermissionManager.EditPromotion(model))
     {
         return(JavaScript("{\"status\":1}"));
     }
     else
     {
         return(JavaScript("{\"status\":0}"));
     }
 }
 public static bool EditPromotion(tbl_UserPromotionCode model)
 {
     if (model.ID <= 0)
     {
         return(DALUserPermission.AddPromotion(model));
     }
     else
     {
         return(DALUserPermission.UpdatePromotion(model));
     }
 }
Example #4
0
 public ActionResult PromotionEdit(string id = "0", string userRank = "LV1")
 {
     if (id == "0")
     {
         return(View(new tbl_UserPromotionCode()
         {
             UserRank = userRank
         }));
     }
     else
     {
         tbl_UserPromotionCode model = UserPermissionManager.GetPromotion(id);
         return(View(model));
     }
 }
        public static bool AddPromotion(tbl_UserPromotionCode model)
        {
            string sql  = "INSERT INTO  Gungnir..tbl_UserPromotioncode VALUES(@SImage,@BImage,@RuleGuid,@UserRank,@CouponName,@CouponDescription)";
            var    conn = ConfigurationManager.ConnectionStrings["Gungnir"].ConnectionString;

            if (SecurityHelp.IsBase64Formatted(conn))
            {
                conn = SecurityHelp.DecryptAES(conn);
            }
            using (var dbhelper = new SqlDbHelper(conn))
            {
                SqlCommand cmd = new SqlCommand(sql);
                cmd.CommandType = CommandType.Text;
                cmd.Parameters.AddWithValue("@SImage", model.SImage);
                cmd.Parameters.AddWithValue("@BImage", model.BImage);
                cmd.Parameters.AddWithValue("@RuleGuid", model.RuleGuid);
                cmd.Parameters.AddWithValue("@UserRank", model.UserRank);
                cmd.Parameters.AddWithValue("@CouponName", model.CouponName);
                cmd.Parameters.AddWithValue("@CouponDescription", model.CouponDescription);
                return(dbhelper.ExecuteNonQuery(cmd) > 0);
            }
        }