/// <summary> /// 生成代理商代理商html控件 /// </summary> /// <param name="userid">当前登陆帐号</param> /// <param name="updatecompanyid">修改时取得的id,用在下拉框选择</param> /// <returns></returns> public static string CreateCompanyHTML_Controls(int userid, int updatecompanyid) { string result = ""; if (userid <= 0) { return(""); } UserInfo userinfo = UsersBLL.GetModel(userid); if (userinfo == null || userinfo.UserID != userid) { return(""); } if (userinfo.UserType == Common.enumUserType.admin.ToString() || userinfo.UserType == Common.enumUserType.host.ToString()) { List <CompanysInfo> list = GetList(-1, "", ""); result += "<select name=\"companyid\" id=\"companyid\" class=\"select\">"; result += "<option value=\"0\">选择代理商</option>"; if (list != null) { foreach (CompanysInfo info in list) { string selected = ""; if (updatecompanyid == info.CompanyID) { selected = "selected=\"selected\""; } result += "<option value=\"" + info.CompanyID + "\" " + selected + " >" + info.CompanyName + "</option>"; } } //result += "<option value=\"s\">sss</option>" // + "<option value=\"a\" selected=\"selected\">aaa</option>"; result += "</select>"; } else { int companyid = UsersBLL.GetCompanyID(userid); if (companyid <= 0) { return(""); } CompanysInfo cinfo = GetModel(companyid); if (cinfo == null || cinfo.CompanyID != companyid) { return(""); } result = cinfo.CompanyName + "<input type=\"hidden\" name=\"companyid\" id=\"companyid\" value=\"" + companyid + "\" />"; } return(result); }
/// <summary> /// 充值 /// </summary> /// <param name="totalamount"></param> /// <param name="CompanyID"></param> /// <param name="resultMsg"></param> /// <returns></returns> public static int updatetotalamount(decimal totalamount, int CompanyID, int userid, ref string resultMsg) { if (userid <= 0) { resultMsg = "无效的操作员ID"; return(-1); } UserInfo userinfo = UsersBLL.GetModel(userid); if (userinfo == null || userinfo.UserID != userid) { resultMsg = "无效的操作员ID"; return(-1); } if (userinfo.UserType != Common.enumUserType.host.ToString() && userinfo.UserType != Common.enumUserType.admin.ToString()) { resultMsg = "当前帐号不是管理员帐号"; return(-1); } if (CompanyID <= 0) { resultMsg = "无效的代理商id"; return(-1); } if (totalamount == 0) { resultMsg = "充值金额不能为0"; return(-1); } if (totalamount > 100000) { resultMsg = "充值金额不能大于100000"; return(-1); } if (totalamount < -100000) { resultMsg = "充值金额不能小于-100000"; return(-1); } return(dal.updatetotalamount(totalamount, CompanyID, ref resultMsg)); }
public static int Update(int sellerid, string name, string address, string description , string ctype, string tel, string fax, string qq, string wx , string wxqrcode, string business , int curruserid , int category_id , bool islock , bool recommend , int orderby , int distid , string lng, string lat , ref string resultMsg) { if (curruserid <= 0) { resultMsg = "userid错误"; return(-1); } if (sellerid <= 0) { resultMsg = "sellerid错误"; return(-1); } if (name.Trim().Length == 0) { resultMsg = "商家名称不能为空"; return(-1); } if (tel.Trim().Length == 0) { resultMsg = "商家电话不能为空"; return(-1); } UserInfo userinfo = UsersBLL.GetModel(curruserid); if (userinfo == null || userinfo.UserID != curruserid) { resultMsg = "userid错误"; return(-1); } if (userinfo.UserType != Common.enumUserType.admin.ToString() && userinfo.UserType != Common.enumUserType.host.ToString() && userinfo.UserType != Common.enumUserType.company.ToString()) { resultMsg = "当前帐号不是系统管理员帐号"; return(-1); } //memberInfo minfo = memberBLL.GetModel(uid); //minfo.mobile = ""; //minfo.identitycard = ""; //minfo.email = ""; SellerInfo model = GetModel(sellerid); if (model == null || model.sellerid != sellerid) { resultMsg = "id error"; return(-1); } model.islock = islock; model.orderby = orderby; model.recommend = recommend; model.name = name; model.address = address; model.description = description; model.ctype = ctype; model.tel = tel; model.fax = fax; model.qq = qq; model.wx = wx; model.wxqrcode = wxqrcode; model.business = business; model.category_id = category_id; model.distid = distid; model.lng = lng; model.lat = lat; return(dal.UpdateTran(model, ref resultMsg)); }
/// <summary> /// 添加商家 /// </summary> /// <param name="uname">帐号</param> /// <param name="password">明码</param> /// <param name="name">商家名称</param> /// <param name="address">地址</param> /// <param name="ctype">商家类型</param> /// <param name="companyid">所属代理商</param> /// <param name="tel">电话</param> /// <param name="fax">传真</param> /// <param name="qq">QQ</param> /// <param name="wx">微信公众号</param> /// <param name="wxqrcode">公众号二维码</param> /// <param name="business">主要经营范围</param> /// <param name="curruserid">添加人userid</param> /// <param name="resultMsg"></param> /// <returns></returns> public static int AddTran(string uname, string password, string name, string address, string description , string ctype, int companyid, string tel, string fax, string qq, string wx , string wxqrcode, string business , int curruserid , int category_id , bool islock , bool recommend , int orderby , int distid , string lng, string lat , ref string resultMsg) { if (curruserid <= 0) { resultMsg = "userid错误"; return(-1); } UserInfo userinfo = UsersBLL.GetModel(curruserid); if (userinfo == null || userinfo.UserID != curruserid) { resultMsg = "userid错误"; return(-1); } if (userinfo.UserType != Common.enumUserType.admin.ToString() && userinfo.UserType != Common.enumUserType.host.ToString() && userinfo.UserType != Common.enumUserType.site.ToString()) { resultMsg = "只有系统管理员或者代理商管理员才可以操作"; return(-1); } //if (distid.Trim().Length == 0) //{ // resultMsg = "distid错误!"; // return 0; //} //if (companyid <= 0) //{ // resultMsg = "请选择对应的代理商代理商"; // return -1; //} if (uname.Trim().Length < 3) { resultMsg = "帐号必须为3位以上的英文或数字"; return(-1); } if (password.Trim().Length < 6) { resultMsg = "密码必须为6位以上"; return(-1); } if (name.Trim().Length == 0) { resultMsg = "商家名称不能为空"; return(-1); } if (tel.Trim().Length == 0) { resultMsg = "商家电话不能为空"; return(-1); } //memberInfo minfo = new memberInfo(); //minfo.companyid = companyid; //minfo.uname = uname; //minfo.password = Common.Utility.MD5Encrypt(password.Trim()); //minfo.mobile = ""; //minfo.identitycard = ""; //minfo.email = ""; //minfo.displayname = name; //minfo.addtime = DateTime.Now; //minfo.utype = (int)Common.enumutype.merchant; //minfo.address = ""; //minfo.tel = tel; SellerInfo info = new SellerInfo(); //info.uid = uid; info.uname = uname; info.password = Common.Utility.MD5Encrypt(password.Trim()); info.name = name; info.address = address; info.description = description; info.ctype = ctype; info.companyid = companyid; info.tel = tel; info.fax = fax; info.qq = qq; info.wx = wx; info.wxqrcode = wxqrcode; info.business = business; info.category_id = category_id; info.distid = distid; info.lng = lng; info.lat = lat; return(dal.AddTran(info, ref resultMsg)); }