/// <summary> /// 新增加 /// </summary> /// <param name="model"></param> /// <returns></returns> public int Add(t_App_Au model) { StringBuilder strSql = new StringBuilder(); strSql.Append(" declare @oid int; "); strSql.Append(" select @oid=id from t_App_Au where accid=@accid and appkey=@appkey; "); strSql.Append(" if(isnull(@oid,0)>0) "); strSql.Append(" begin "); strSql.Append(" update t_App_Au set aa_Status = @aa_Status, appkey = @appkey , "); strSql.Append(" appName = @appName ,stattime = @stattime ,endtime = @endtime ,aa_time = GETDATE() , "); strSql.Append(" aa_remark = @aa_remark where accid=@accid and appkey=@appkey; "); strSql.Append(" select @oid; "); strSql.Append(" end "); strSql.Append(" else "); strSql.Append(" begin "); strSql.Append(" insert into t_App_Au(aa_Status,accid,appkey,appName,stattime,endtime,aa_time,aa_remark) "); strSql.Append(" values (@aa_Status,@accid,@appkey,@appName,@stattime,@endtime,@aa_time,@aa_remark) ; "); strSql.Append(" select @@IDENTITY; "); strSql.Append(" end "); object id = HelperForFrontend.ExecuteScalar(strSql.ToString(), model); if (id != null) { return(Convert.ToInt32(id)); } else { return(0); } }
/// <summary> /// 新增加 /// </summary> /// <param name="model"></param> /// <returns></returns> public static int Add(t_App_Au model) { t_App_AuDAL dal = new t_App_AuDAL(); return(dal.Add(model)); }
/// <summary> /// 开通店铺权限 /// </summary> /// <param name="accid">店铺ID</param> /// <param name="appKey">权限KEY</param> /// <param name="operId">操作人ID</param> /// <returns></returns> public static int AddAccountApp(int accid, int appKey, int operId) { t_App_Au model = new t_App_Au(); model.accid = accid; model.appkey = appKey; model.appName = Enum.GetName(typeof(Model.Enum.AppAuEnum.AppName), appKey); model.stattime = DateTime.Now; model.endtime = DateTime.Now.AddMonths(6); model.aa_time = DateTime.Now; model.aa_remark = "(后台" + operId + "授权)"; model.aa_Status = 0; if (appKey == 1 || appKey == 2) { string rm = CommonLib.Helper.CreateUUID(); T_AccountBLL.UpdateRandomNumber(accid, rm); tb_user_inforBLL.InitializeUserInfor(accid); } if (appKey == 7) { #region 颜色尺码 List <DapperWhere> whereList = new List <DapperWhere>(); whereList.Add(new DapperWhere("accId", accid)); whereList.Add(new DapperWhere("gaType", 1)); List <T_Goods_Attribute> attributeList = new List <T_Goods_Attribute>(); attributeList = BLL.Base.T_Goods_AttributeBaseBLL.GetList(whereList); if (attributeList.Count < 2) { Dictionary <string, int> attr = new Dictionary <string, int>(); attr["颜色"] = 0; attr["尺码"] = 0; foreach (T_Goods_Attribute item in attributeList) { attr[item.gaName] = 1; } foreach (KeyValuePair <string, int> ik in attr) { if (ik.Value == 0) { T_Goods_Attribute addModel = new T_Goods_Attribute(); addModel.gaName = ik.Key; addModel.gaType = 1; addModel.gaRemark = ""; addModel.gaTime = DateTime.Now; addModel.gaAlive = 1; addModel.accId = accid; T_Goods_AttributeBLL.Add(addModel); } } } #endregion } if (appKey == 21) { #region 手机串号 List <DapperWhere> whereList = new List <DapperWhere>(); whereList.Add(new DapperWhere("accId", accid)); whereList.Add(new DapperWhere("gaType", 2)); List <T_Goods_Attribute> attributeList = new List <T_Goods_Attribute>(); attributeList = BLL.Base.T_Goods_AttributeBaseBLL.GetList(whereList); if (attributeList.Count < 2) { Dictionary <string, int> attr = new Dictionary <string, int>(); attr["串号"] = 0; foreach (T_Goods_Attribute item in attributeList) { attr[item.gaName] = 1; } foreach (KeyValuePair <string, int> ik in attr) { if (ik.Value == 0) { T_Goods_Attribute addModel = new T_Goods_Attribute(); addModel.gaName = ik.Key; addModel.gaType = 2; addModel.gaRemark = ""; addModel.gaTime = DateTime.Now; addModel.gaAlive = 0; addModel.accId = accid; T_Goods_AttributeBLL.Add(addModel); } } } #endregion } return(t_App_AuBLL.Add(model)); }