/// <summary> /// 新增 /// </summary> /// <param name="model"></param> /// <returns></returns> public int Add(T_Goods_Attribute model) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into T_Goods_Attribute("); strSql.Append("gaName,gaType,gaRemark,gaTime,gaAlive,accId"); strSql.Append(") values ("); strSql.Append("@gaName,@gaType,@gaRemark,@gaTime,@gaAlive,@accId"); strSql.Append(") "); strSql.Append(";select @@IDENTITY"); object obj = HelperForFrontend.ExecuteScalar(strSql.ToString(), model); if (obj != null) { return(Convert.ToInt32(obj)); } else { return(0); } }
/// <summary> /// 新增加 /// </summary> /// <param name="model"></param> /// <returns></returns> public static int Add(T_Goods_Attribute model) { T_Goods_AttributeDAL dal = new T_Goods_AttributeDAL(); 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)); }