Exemple #1
0
    public string DelArea(string id)
    {
        string json = string.Empty;

        if (!string.IsNullOrEmpty(id))
        {
            List <Hi.Model.BD_DisArea> List = new Hi.BLL.BD_DisArea().GetList(null, " CompanyID=" + CompID + " and isnull(dr,0)=0  and   ParentId=" + id, null);
            if (List.Count > 0)
            {
                return("{\"result\":false,\"code\":\"此类别下还有子级类别,请先删除子级类别!\"}");
            }
            List <Hi.Model.BD_Distributor> Dis = new Hi.BLL.BD_Distributor().GetList(null, " CompID=" + CompID + " and isnull(dr,0)=0  and   AreaID=" + id, null);
            if (Dis.Count > 0)
            {
                return("{\"result\":false,\"code\":\"此区域已被使用,不允许删除!\"}");
            }
            List <Hi.Model.BD_DisPrice> disp = new Hi.BLL.BD_DisPrice().GetList(null, " CompID=" + CompID + " and type=" + 2 + " and( One=" + id + " or two=" + id + " or three=" + id + ") and dr=0", null);
            if (disp.Count > 0)
            {
                return("{\"result\":false,\"code\":\"此区域下有代理商价格,不允许删除!\"}");
            }
            Hi.Model.BD_DisArea area = new Hi.BLL.BD_DisArea().GetModel(id.ToInt(0));
            area.dr         = 1;
            area.ts         = DateTime.Now;
            area.modifyuser = UserID;
            if (new Hi.BLL.BD_DisArea().Update(area))
            {
                return("{\"result\":true,\"code\":\"操作成功\"}");
            }
        }
        return(json);
    }
Exemple #2
0
    public void DataBinds()
    {
        int pageCount = 0;
        int Counts    = 0;

        //每页显示的数据设置
        if (this.txtPageSize.Value.ToString() != "")
        {
            if (this.txtPageSize.Value.Trim().Length >= 5)
            {
                Pager.PageSize         = 100;
                this.txtPageSize.Value = "100";
            }
            else
            {
                Pager.PageSize = this.txtPageSize.Value.Trim().ToInt(0);
            }
        }

        List <Hi.Model.BD_DisArea> LArea = new Hi.BLL.BD_DisArea().GetList(Pager.PageSize, Pager.CurrentPageIndex, "SortIndex", false, " and CompanyID=" + CompID + " and ParentId=0  and isnull(dr,0)=0 ", out pageCount, out Counts);

        // LArea= LArea.OrderBy(L => L.SortIndex).ToList();
        this.rptDisAreaList.DataSource = LArea;
        this.rptDisAreaList.DataBind();
        Pager.RecordCount = Counts;
        page = Pager.CurrentPageIndex.ToString();
    }
Exemple #3
0
    /// <summary>
    ///
    /// </summary>
    /// <param name="ParentId"></param>
    /// <param name="str"></param>
    public void TreeData(int ParentId, string str = "")
    {
        chidString = str;
        List <Hi.Model.BD_DisArea> list = new Hi.BLL.BD_DisArea().GetList(null, "  CompanyId=" + Compid.ToInt(0) + "  and isnull(dr,0)=0  and ParentId=" + ParentId.ToString(), "sortindex");

        foreach (Hi.Model.BD_DisArea item in list)
        {
            chidString += "{ id :" + item.ID + ",pId:" + ParentId + ",name:\"" + item.AreaName + "\",isParent:\"" + (ParentId == 0 ? "true" : "false") + "\"},";
            TreeData(item.ID, chidString);
        }
    }
Exemple #4
0
    /// <summary>
    /// 判断属性值是否存在
    /// </summary>
    /// <param name="name"></param>
    /// <returns></returns>
    public bool IsExistsArea(string name, string value, string id)
    {
        bool bfg = false;

        if (!string.IsNullOrEmpty(name) && !string.IsNullOrEmpty(value))
        {
            List <Hi.Model.BD_DisArea> List = new Hi.BLL.BD_DisArea().GetList("", name + "='" + value + "' and id<>'" + id + "' and isnull(dr,0)=0 and CompanyID=" + CompID + "", "");
            if (List.Count > 0)
            {
                bfg = true;
            }
        }
        return(bfg);
    }
Exemple #5
0
    public void DataBinds()
    {
        string str = " CompanyID=" + this.CompID + " and isnull(dr,0)=0 and ParentId=0";

        if (!"".Equals(this.txtName.Value))
        {
            str += " and AreaName like '%" + this.txtName.Value + "%'";
        }

        List <Hi.Model.BD_DisArea> l = new Hi.BLL.BD_DisArea().GetList("", str, "");

        this.rptDisAreaList.DataSource = l;
        this.rptDisAreaList.DataBind();
    }
Exemple #6
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         if (!string.IsNullOrEmpty(areaid))
         {
             Hi.Model.BD_DisArea type = new Hi.BLL.BD_DisArea().GetModel(areaid.ToInt(0));
             if (type != null)
             {
                 txt_txtAreaname.Value = type.AreaName;
                 hid_AreaId.Value      = areaid;
             }
         }
     }
 }
Exemple #7
0
    /// <summary>
    /// 查询父类下所有子集
    /// </summary>
    /// <param name="ParentId">父Id</param>
    /// <returns></returns>
    public string FindChild(string ParentId, string Str = "")
    {
        ChildString = Str;
        List <Hi.Model.BD_DisArea> LArea = new Hi.BLL.BD_DisArea().GetList("", "  CompanyID=" + CompID + " and ParentId='" + ParentId + "' and isnull(dr,0)=0", " sortindex asc");

        foreach (Hi.Model.BD_DisArea model in LArea)
        {
            ChildString += "<tr id='" + model.ID + "' parentid='" + model.ParentID + "' bgcolor='#fcfeff' style='height: 26px;width: 100%;display: none;'>";
            ChildString += " <td><div class=\"tc\"><input type=\"checkbox\" class=\"\" value=\"" + model.ID + "\"/></div></td>";
            ChildString += "<td><div class=\"tcle\"><img id='Openimg' height='9' src='" + Simage(model.ID) + "' width='9' border='0' />&nbsp; <span class='span'>" + model.AreaName + "</span></div></td>";
            ChildString += "</tr>";
            FindChild(model.ID.ToString(), ChildString);
        }
        return(ChildString);
    }
Exemple #8
0
    public bool CheckDisLevel(string value, int index, out int AreaID)
    {
        List <Hi.Model.BD_DisArea> disList = new Hi.BLL.BD_DisArea().GetList("", "isnull(dr,0)=0 and CompanyID=" + this.CompID + " and AreaName ='" + value + "'", "");

        if (disList != null && disList.Count == 1)
        {
            AreaID = disList[0].ID;
            return(true);
        }
        else
        {
            Eroor       = true;
            TitleError += "Excel行号为:&nbsp;<i error>" + (index + TitleIndex + 1) + "</i> &nbsp;&nbsp;的数据有误。代理商区域:“" + value + "”不存在!请修改后重新导入。<br/>";
            AreaID      = 0;
            return(false);
        }
    }
Exemple #9
0
    protected void btnEdit_Click(object sender, EventArgs e)
    {
        string Areaname = Common.NoHTML(txtAreaNames.Value.Trim());
        string id       = Common.NoHTML(hideAreaIds.Value.Trim());
        string sortid   = Common.NoHTML(txtSortIndexs.Value.Trim());
        //string areacode = txtAreacodes.Value.Trim();
        int Result = 0;

        if (string.IsNullOrEmpty(Areaname))
        {
            JScript.AlertMethod(this, "分类名称不能为空", JScript.IconOption.错误, "function (){ location.replace('" + ("DisAreaList.aspx?page=" + Pager.CurrentPageIndex + "") + "'); }");
            return;
        }
        if (IsExistsArea("AreaName", Areaname, id))
        {
            JScript.AlertMethod(this, "此分类名已存在!", JScript.IconOption.错误, "function (){ location.replace('" + ("DisAreaList.aspx?page=" + Pager.CurrentPageIndex + "") + "'); }");
            return;
        }
        if (int.TryParse(id, out Result))
        {
            Hi.Model.BD_DisArea DisArea = new Hi.BLL.BD_DisArea().GetModel(Result);
            if (DisArea != null)
            {
                DisArea.AreaName  = Areaname;
                DisArea.SortIndex = sortid;
                //DisArea.Areacode = areacode;
                DisArea.ts         = DateTime.Now;
                DisArea.modifyuser = 0;
                if (new Hi.BLL.BD_DisArea().Update(DisArea))
                {
                    Page.ClientScript.RegisterStartupScript(this.GetType(), "Result", "<script>location.href='DisAreaList.aspx?page=" + Pager.CurrentPageIndex + "&lefttype=" + Request["lefttype"] + "&type=" + Request["type"] + "';</script>");
                }
            }
            else
            {
                JScript.AlertMethod(this, "此分类不存在!", JScript.IconOption.错误, "function (){ location.replace('" + ("DisAreaList.aspx?page=" + Pager.CurrentPageIndex + "") + "'); }");
                return;
            }
        }
        else
        {
            JScript.AlertMethod(this, "分类ID错误!", JScript.IconOption.错误, "function (){ location.replace('" + ("DisAreaList.aspx?page=" + Pager.CurrentPageIndex + "") + "'); }");
            return;
        }
    }
Exemple #10
0
    protected string Simage(object obj)
    {
        string image = "../images/menu_plus.gif";

        if (obj != null)
        {
            List <Hi.Model.BD_DisArea> l = new Hi.BLL.BD_DisArea().GetList(null, " CompanyID='" + CompID + "' and isnull(dr,0)=0 and  ParentId=" + obj.ToString(), null);
            if (l.Count > 0)
            {
                image = "../images/menu_plus.gif";
            }
            else
            {
                image = "../images/menu_minus.gif";
            }
            return(image);
        }
        return(image);
    }
Exemple #11
0
    /// <summary>
    /// 查询父类下所有子集
    /// </summary>
    /// <param name="ParentId">父Id</param>
    /// <returns></returns>
    public string FindChild(string ParentId, string Str = "")
    {
        ChildString = Str;
        List <Hi.Model.BD_DisArea> LArea = new Hi.BLL.BD_DisArea().GetList("", "  CompanyID=" + CompID + " and ParentId='" + ParentId + "' and isnull(dr,0)=0", " sortindex asc");

        foreach (Hi.Model.BD_DisArea model in LArea)
        {
            ChildString += "<tr id='" + model.ID + "' parentid='" + model.ParentID + "' bgcolor='#fcfeff' style='height: 26px;width: 100%;display: none;'>";
            ChildString += "<td><div class=\"tcle\"><img id='Openimg' height='9' src='" + Simage(model.ID) + "' width='9' border='0' />&nbsp; <span class='span'>" + model.AreaName + "</span></div></td>";
            //ChildString += "<td>" + model.Areacode + "</td>";
            ChildString += "<td><div class=\"tcle\"> " + model.SortIndex + "</div></td>";

            ChildString += Str == "" ? "<td><div class=\"tcle\"> <a href='javascript:;' tip='" + model.ID + "' Pname='" + model.AreaName + @"' class='AreaChildAdd'>添加下级</a> |" : "<td><div class=\"tcle\"> ";

            ChildString += "<a class='AreaEdit' href='javascript:;' tip='" + model.ID + "' sortid ='" + model.SortIndex + "'   Pname='" + model.AreaName + @"' >编辑</a> |
                <a href='javascript:;'  tip='" + model.ID + @"'  class='AreaDel'>移除</a>
                </div></td>";
            ChildString += "</tr>";
            FindChild(model.ID.ToString(), ChildString);
        }
        return(ChildString);
    }
Exemple #12
0
    /// <summary>
    ///核心企业修改经销商信息
    /// </summary>
    /// <param name="JSon"></param>
    /// <returns></returns>
    public ReseltResellerEdit EditReseller(string JSon)
    {
        string UserID = string.Empty;
        string CompID = string.Empty;
        string DisID  = string.Empty;

        try
        {
            #region//JSon取值
            JsonData JInfo = JsonMapper.ToObject(JSon);
            if (JInfo["UserID"].ToString().Trim() == "" || JInfo["CompID"].ToString().Trim() == "" || JInfo["Reseller"].ToString().Trim() == "")
            {
                return new ReseltResellerEdit()
                       {
                           Result = "F", Description = "参数异常"
                       }
            }
            ;
            UserID = JInfo["UserID"].ToString();
            CompID = JInfo["CompID"].ToString();
            JsonData Reseller = JInfo["Reseller"];
            //判断登录信息是否异常
            Hi.Model.SYS_Users one = new Hi.Model.SYS_Users();
            if (!new Common().IsLegitUser(int.Parse(UserID), out one, Int32.Parse(CompID)))
            {
                return(new ReseltResellerEdit()
                {
                    Result = "F", Description = "登录信息异常"
                });
            }
            //判断核心企业信息是否异常
            Hi.Model.BD_Company comp = new Hi.BLL.BD_Company().GetModel(Int32.Parse(CompID));
            if (comp == null || comp.dr == 1 || comp.IsEnabled == 0 || comp.AuditState == 0)
            {
                return new ReseltResellerEdit()
                       {
                           Result = "F", Description = "核心企业信息异常"
                       }
            }
            ;
            #endregion
            //判断经销商信息是否正常
            DisID = Reseller["ResellerID"].ToString();
            Hi.BLL.BD_Distributor   bll_dis = new Hi.BLL.BD_Distributor();
            Hi.Model.BD_Distributor dis     = bll_dis.GetModel(Int32.Parse(DisID));
            if (dis == null)
            {
                return new ReseltResellerEdit()
                       {
                           Result = "F", Description = "经销商信息异常"
                       }
            }
            ;
            if (dis.dr == 1)
            {
                return new ReseltResellerEdit()
                       {
                           Result = "F", Description = "经销商已被删除"
                       }
            }
            ;
            if (Reseller["ts"].ToString() != dis.ts.ToString())
            {
                return new ReseltResellerEdit()
                       {
                           Result = "F", Description = "经销商信息已被他人修改,请稍后再试"
                       }
            }
            ;
            string resellername = Common.NoHTML(Reseller["ResellerName"].ToString().Trim());
            string resellercode = Common.NoHTML(Reseller["ResellerCode"].ToString().Trim());
            string address      = Common.NoHTML(Reseller["Address"].ToString().Trim());
            //判断经销商修改的必填项
            if (resellername == "")
            {
                return new ReseltResellerEdit()
                       {
                           Result = "F", Description = "请输入经销商名称"
                       }
            }
            ;
            //判断经销商名字是否已存在
            //if (Common.DisExistsAttribute("DisName", Reseller["ResellerName"].ToString(), CompID.ToString()))
            //List<Hi.Model.BD_Distributor> list_dis = bll_dis.GetList("", "DisName = '" + resellername + "' and ID <> " + dis.ID + "", "");
            //if(list_dis!=null&&list_dis.Count>0)
            if (Common.DisExistsAttribute("DisName", resellername, CompID.ToString(), dis.ID.ToString()))
            {
                return new ReseltResellerEdit()
                       {
                           Result = "F", Description = "经销商名称已经存在"
                       }
            }
            ;
            if (Reseller["ResellerProvince"].ToString().Trim() == "")
            {
                return new ReseltResellerEdit()
                       {
                           Result = "F", Description = "请选择经销商地址中的省"
                       }
            }
            ;
            if (Reseller["ResellerCity"].ToString().Trim() == "")
            {
                return new ReseltResellerEdit()
                       {
                           Result = "F", Description = "请选择经销商地址中的市"
                       }
            }
            ;
            if (Reseller["ResellerArea"].ToString().Trim() == "")
            {
                return new ReseltResellerEdit()
                       {
                           Result = "F", Description = "请选择经销商地址中的区"
                       }
            }
            ;
            if (address == "")
            {
                return new ReseltResellerEdit()
                       {
                           Result = "F", Description = "请输入经销商地址中的详细地址"
                       }
            }
            ;
            //修改经销商信息
            dis.ts         = DateTime.Now;
            dis.modifyuser = one.ID;
            dis.DisCode    = resellercode;
            dis.DisName    = resellername;
            //Int32 classifyid= Reseller["ResellerClassifyID"].ToString().Trim() == "" ? 0 : Int32.Parse(Reseller["ResellerClassifyID"].ToString().Trim());
            //传入分类ID的话,判断分类ID是否正确
            if (Reseller["ResellerClassifyID"].ToString().Trim() != "" && Reseller["ResellerClassifyID"].ToString() != "0")
            {
                Hi.Model.BD_DisType distpye = new Hi.BLL.BD_DisType().GetModel(Int32.Parse(Reseller["ResellerClassifyID"].ToString().Trim()));

                if (distpye == null || distpye.CompID != comp.ID)
                {
                    return new ReseltResellerEdit()
                           {
                               Result = "F", Description = "经销商分类异常"
                           }
                }
                ;
                if (distpye.dr == 1)
                {
                    return new ReseltResellerEdit()
                           {
                               Result = "F", Description = "此经销商分类已被删除"
                           }
                }
                ;
                //if (distpye.IsEnabled !=0)
                //    return new ReseltResellerEdit() { Result = "F", Description = "此经销商分类已被禁用" };

                dis.DisTypeID = distpye.ID;
            }
            else
            {
                dis.DisTypeID = 0;
            }
            //dis.AreaID = Reseller["AreaID"].ToString().Trim() == "" ? 0 : Int32.Parse(Reseller["AreaID"].ToString().Trim());
            //传入区域ID的话,判断区域ID是否正确
            if (Reseller["AreaID"].ToString().Trim() != "" && Reseller["AreaID"].ToString() != "0")
            {
                Hi.Model.BD_DisArea disarea = new Hi.BLL.BD_DisArea().GetModel(Int32.Parse(Reseller["AreaID"].ToString().Trim()));
                if (disarea == null || disarea.CompanyID != comp.ID)
                {
                    return new ReseltResellerEdit()
                           {
                               Result = "F", Description = "经销商区域异常"
                           }
                }
                ;
                if (disarea.dr == 1)
                {
                    return new ReseltResellerEdit()
                           {
                               Result = "F", Description = "此经销商区域已被删除"
                           }
                }
                ;
                dis.AreaID = disarea.ID;
            }
            else
            {
                dis.AreaID = 0;
            }
            dis.Province = Reseller["ResellerProvince"].ToString();
            dis.City     = Reseller["ResellerCity"].ToString();
            dis.Area     = Reseller["ResellerArea"].ToString();
            dis.Address  = address;
            dis.Zip      = Common.NoHTML(Reseller["Zip"].ToString());
            dis.Tel      = Common.NoHTML(Reseller["Tel"].ToString());
            dis.Fax      = Common.NoHTML(Reseller["Fax"].ToString());
            string principal = Common.NoHTML(Reseller["Principal"].ToString().Trim());
            string phone     = Common.NoHTML(Reseller["Phone"].ToString().Trim());
            //如果联系人或联系人手机没输入,需要将登陆信息的联系人或手机号,赋值给联系人或手机
            if (principal == "" || phone == "")
            {
                //先获取sys_compuser表中disid对应的数据,一对一关系
                List <Hi.Model.SYS_CompUser> compuser = new Hi.BLL.SYS_CompUser().GetList("UserID",
                                                                                          "DisID=" + dis.ID + " and UType = 5 and isnull(dr,0)=0 and isnull(IsEnabled,0)=1 and isnull(IsAudit,0)=2", "");
                //通过Userid获取sys_users表数据
                Hi.Model.SYS_Users user = new Hi.BLL.SYS_Users().GetModel(compuser[0].ID);
                if (user != null && user.AuditState == 2 && user.IsEnabled == 1 && user.dr == 0)
                {
                    //需要判断到底是传入的联系人为空,还是手机为空
                    if (principal == "")
                    {
                        dis.Principal = user.TrueName;
                    }
                    else
                    {
                        dis.Principal = principal;
                    }
                    if (phone == "")
                    {
                        dis.Phone = user.Phone;
                    }
                    else
                    {
                        dis.Phone = phone;
                    }
                }
            }
            else
            {
                dis.Principal = principal;
                dis.Phone     = phone;
            }
            //更新数据库
            if (bll_dis.Update(dis))
            {
                return new ReseltResellerEdit()
                       {
                           Result = "T", Description = "修改成功"
                       }
            }
            ;
            else
            {
                return new ReseltResellerEdit()
                       {
                           Result = "F", Description = "修改失败"
                       }
            };
        }
        catch (Exception ex)
        {
            Common.CatchInfo(ex.Message + ":" + ex.StackTrace, "EditReseller:" + JSon);
            return(new ReseltResellerEdit()
            {
                Result = "F", Description = "修改失败"
            });
        }
    }
Exemple #13
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!(Session["UserModel"] as LoginModel).IsExistRole)
        {
            Response.Redirect("~/Distributor/UserEdit.aspx", true);
        }

        //获取当前时间
        DateTime date = DateTime.Now;
        //当天0点0分
        DateTime day0 = new DateTime(date.Year, date.Month, date.Day, 0, 0, 0);
        //获取当前时间加一天
        DateTime Sday = day0.AddDays(1);

        //当月第一天
        DateTime day1 = new DateTime(date.Year, date.Month, 1);
        //本月  最后一天  多加一天
        DateTime mothday = day1.AddMonths(1);

        user = new Hi.BLL.SYS_Users().GetModel(this.UserID);

        orderl = new Hi.BLL.DIS_Order().GetList("", " isnull(dr,0)=0 and Otype<>9 and OState<>6  and CompID=" + this.CompID + " and DisID=" + this.DisID, " CreateDate desc");
        if (orderl != null)
        {
            #region

            //当天订单数
            dayOrderCount = orderl.FindAll(
                p => (p.OState == 2 || p.OState == 3 || p.OState == 4 || p.OState == 5 || p.OState == 7) && p.CreateDate >= day0 && p.CreateDate < Sday).Count;

            //本月订单数
            orderCount = orderl.FindAll(
                p => (p.OState == 2 || p.OState == 3 || p.OState == 4 || p.OState == 5 || p.OState == 7) && p.CreateDate >= day1 && p.CreateDate < mothday).Count;

            #endregion
            orderll = orderl.FindAll(p => (p.PayState == 0 || p.PayState == 1));
        }
        List <Hi.Model.DIS_Suggest> suggest = new Hi.BLL.DIS_Suggest().GetList("", " isnull(dr,0)=0 and Stype=0 and isanswer=1 and DisUserID=" + this.UserID, "");
        message = suggest.Count;
        if (message == 0)
        {
            //imessage.Attributes.Add("style", "display:none");
        }
        price = Convert.ToDecimal(new Hi.BLL.PAY_PrePayment().sums(this.DisID, this.CompID)).ToString("0.00");
        dis   = new Hi.BLL.BD_Distributor().GetModel(this.DisID);
        if (dis != null)//add by hgh  出现为null值
        {
            //if ( dis.CreditType == 0)
            //{
            //lisalesorder.Attributes.Add("style", "background-color:#fbfbfb");
            //}

            Hi.Model.BD_DisType distypemodel = new Hi.BLL.BD_DisType().GetModel(dis.DisTypeID);
            if (distypemodel != null)
            {
                disType = distypemodel.TypeName;
            }
            Hi.Model.BD_DisArea disaddrmodel = new Hi.BLL.BD_DisArea().GetModel(dis.AreaID);
            if (disaddrmodel != null)
            {
                disAreaID = disaddrmodel.AreaName;
            }
        }
        #region 促销商品

        string    Cx_sql = string.Format(@"SELECT count(1) num from BD_Goods
where ID in (SELECT GoodsID from BD_PromotionDetail where ProID in
(SELECT ID from BD_Promotion where compID={0} and ProStartTime<=getdate() 
and ProStartTime<=GETDATE() and DATEADD(D,1,ProEndTime)>= getDate() and IsEnabled=1	))and ID not in (	
select GoodsID from BD_GoodsAreas where	compID={0} and DisID={1} and isnull(dr,0)=0)
and compid= {0} and ISNULL(dr,0)=0 and IsEnabled = 1 and IsOffLine=1 ", this.CompID, this.DisID);
        DataTable Cx_Dt  = SqlHelper.Query(SqlHelper.LocalSqlServer, Cx_sql).Tables[0];
        if (Cx_Dt != null)
        {
            if (Cx_Dt.Rows.Count > 0)
            {
                decimal sum_CX = Convert.ToDecimal(Cx_Dt.Rows[0]["num"]);
                Cx_Sum = sum_CX.ToString();
            }
        }

        #endregion

        #region  快过期商品 goods_Sum
        //当前时间
        DateTime now = DateTime.Now;
        //快到期时间
        DateTime today = now.AddDays(30);

        string goods_sql = string.Format(@"select * from YZT_GoodsStock s where s.validDate<='" + today + "'" + " and DisID=" + DisID + " and dr=0 ");

        DataTable goods_Dt = SqlHelper.Query(SqlHelper.LocalSqlServer, goods_sql).Tables[0];
        if (goods_Dt != null && goods_Dt.Rows.Count > 0)
        {
            goods_Sum = goods_Dt.Rows.Count.ToString();
        }
        #endregion

        #region 当天订购额
        //add by hgh  //包含已退订单金额、退单处理
        string daysql = "SELECT SUM(AuditAmount) as AuditAmount FROM [dbo].[DIS_Order] where ostate in (2,3,4,5,7) and DisID=" +
                        this.DisID + " and CompID=" + this.CompID + " and CreateDate>='" + day0 + "' and CreateDate<'" + Sday + "'";
        DataTable dayDt = SqlHelper.Query(SqlHelper.LocalSqlServer, daysql).Tables[0];
        if (dayDt != null)
        {
            if (dayDt.Rows.Count > 0)
            {
                decimal sumAmount = dayDt.Rows[0]["AuditAmount"].ToString() == ""
                    ? sum.ToString().ToDecimal()
                    : Convert.ToDecimal(dayDt.Rows[0]["AuditAmount"]);
                DaySum = (sumAmount).ToString("N");
            }
        }
        #endregion

        #region 本月订购额
        string    monthsql = "SELECT SUM(AuditAmount) as AuditAmount FROM DIS_Order where OState in (2,3,4,5,7) and isnull(dr,0)=0 and Otype<>9 and DisID=" + this.DisID + " and CompID=" + this.CompID + " and CreateDate>='" + day1 + "' and CreateDate<'" + mothday + "'";
        DataTable monthDt  = SqlHelper.Query(SqlHelper.LocalSqlServer, monthsql).Tables[0];
        if (monthDt != null)
        {
            if (monthDt.Rows.Count > 0)
            {
                decimal sumAmount = monthDt.Rows[0]["AuditAmount"].ToString() == "" ? sum.ToString().ToDecimal() : Convert.ToDecimal(monthDt.Rows[0]["AuditAmount"]);
                MonthSum = (sumAmount).ToString("N");
            }
        }
        #endregion

        #region 当天付款额
        //付款额    add by hgh  CompCollection_view 状态   and status!=3
        string daypaggersql = "SELECT SUM(Price) as Price FROM [dbo].[CompCollection_view] where DisID=" + this.DisID +
                              "and CompID=" + this.CompID + " and status!=3 and Date>='" + day0 + "' and Date<'" + Sday + "' AND vedf9=1 ";

        DataTable daypaggerdt = SqlHelper.Query(SqlHelper.LocalSqlServer, daypaggersql).Tables[0];
        if (daypaggerdt != null)
        {
            if (daypaggerdt.Rows.Count > 0)
            {
                decimal Price = daypaggerdt.Rows[0]["Price"].ToString() == ""
                    ? sum.ToString().ToDecimal()
                    : Convert.ToDecimal(daypaggerdt.Rows[0]["Price"]);
                DayPaymentSum = (Price).ToString("N");
            }
        }

        #endregion

        #region 本月付款额
        //本月付款额    add by hgh  CompCollection_view 状态   and status!=3
        string paggersql = "SELECT SUM(Price) as Price FROM [dbo].[CompCollection_view] where OrderID not in (select ID from Dis_Order where ISNULL(dr,0)=0 and Otype=9) and DisID=" + this.DisID + "  and status!=3 and CompID=" + this.CompID + " and Date>='" + day1 + "' and Date<'" + mothday + "' AND vedf9=1 ";

        DataTable paggerdt = SqlHelper.Query(SqlHelper.LocalSqlServer, paggersql).Tables[0];
        if (paggerdt != null)
        {
            if (paggerdt.Rows.Count > 0)
            {
                decimal Price = paggerdt.Rows[0]["Price"].ToString() == "" ? sum.ToString().ToDecimal() : Convert.ToDecimal(paggerdt.Rows[0]["Price"]);
                PaymentSum = (Price).ToString("N");
            }
        }
        #endregion

        #region 本月应付额
        //本月应付额

        decimal AuditAmount = 0;
        decimal payAmount   = 0;
        decimal payyzf      = 0;

        //赊销订单  未支付的
        //string ArrearageSql = "SELECT SUM(AuditAmount) as AuditAmount FROM [dbo].[ArrearageRpt_view] where DisID=" + user.DisID + "and CompID=" + user.CompID + " and CreateDate>='" + day1 + "' and CreateDate<='" + Sday + "'";

        //DataTable ArrearageDt = SqlHelper.Query(SqlHelper.LocalSqlServer, ArrearageSql).Tables[0];
        //if (ArrearageDt != null)
        //{
        //    if (ArrearageDt.Rows.Count > 0)
        //    {
        //        AuditAmount = ArrearageDt.Rows[0]["AuditAmount"].ToString() == "" ? sum.ToString().ToDecimal() : Convert.ToDecimal(ArrearageDt.Rows[0]["AuditAmount"]);
        //    }
        //}

        //未支付订单金额
        //string paysql = "  select SUM(AuditAmount) as AuditAmount from DIS_Order where (( Otype=1 and OState not in (-1,0,1)  and PayState in (0,1) ) or( Otype<>1 and OState=2   and PayState in (0,1) )) and OState<>6 and ReturnState=0 and isnull(dr,0)=0 and Otype!=9 and CompID=" + this.CompID + " and DisID=" + this.DisID + " and CreateDate>='" + day1 + "' and CreateDate<='" + Sday + "'";

        //DataTable payDt = SqlHelper.Query(SqlHelper.LocalSqlServer, paysql).Tables[0];
        //if (payDt != null && payDt.Rows.Count > 0)
        //{
        //    payAmount = payDt.Rows[0]["AuditAmount"].ToString() == "" ? 0 : payDt.Rows[0]["AuditAmount"].ToString().ToDecimal(0);
        //}
        //paysql = "  select SUM(PayedAmount) as PayedAmount from DIS_Order where (( Otype=1 and OState not in (-1,0,1)  and PayState in (0,1) ) or( Otype<>1 and OState=2   and PayState in (0,1) )) and OState<>6 and ReturnState=0 and isnull(dr,0)=0 and Otype!=9 and CompID=" + this.CompID + " and DisID=" + this.DisID + " and CreateDate>='" + day1 + "' and CreateDate<='" + Sday + "'";
        //payDt = SqlHelper.Query(SqlHelper.LocalSqlServer, paysql).Tables[0];
        //if (payDt != null && payDt.Rows.Count > 0)
        //{
        //    payyzf = payDt.Rows[0]["PayedAmount"].ToString() == "" ? 0 : payDt.Rows[0]["PayedAmount"].ToString().ToDecimal(0);
        //}
        //PayableSum = (payAmount - payyzf + AuditAmount).ToString("N");


        //edit by hgh   正常合同 总额-已付
        string    paysql = "  select SUM(AuditAmount)-SUM(PayedAmount) as AuditAmount from DIS_Order where OState in(2,3,5) and isnull(dr,0)=0 and Otype!=9 and CompID=" + this.CompID + " and DisID=" + this.DisID + " and CreateDate>='" + day1 + "' and CreateDate<'" + Sday + "'";
        DataTable payDt  = SqlHelper.Query(SqlHelper.LocalSqlServer, paysql).Tables[0];
        if (payDt != null && payDt.Rows.Count > 0)
        {
            payAmount = payDt.Rows[0]["AuditAmount"].ToString() == "" ? 0 : payDt.Rows[0]["AuditAmount"].ToString().ToDecimal(0);
        }
        PayableSum = payAmount.ToString("N");
        #endregion

        #region 商家公告

        List <Hi.Model.BD_CompNews> LNew = new Hi.BLL.BD_CompNews().GetList("top 3 *", "isnull(dr,0)=0 and IsEnabled=1 and Compid=" + this.CompID + " ", " istop desc,createdate desc");
        string Html = "";
        if (LNew.Count > 0)
        {
            for (int i = 0; i < LNew.Count; i++)
            {
                if (LNew[i].ShowType == null)
                {
                    LNew[i].ShowType = "";
                }

                if (i <= 4)
                {
                    string type = LNew[i].ShowType == "1" ? "top" : LNew[i].ShowType == "2" ? "red" : LNew[i].ShowType == "1,2" ? "top red" : "";
                    Html += "<li class='" + type + "'><a title='" + LNew[i].NewsTitle + "' href=\"CompNewInfo.aspx?KeyID=" + Common.DesEncrypt(LNew[i].ID.ToString(), Common.EncryptKey) + "&Type=3\">【" + Common.GetCPNewStateName(LNew[i].NewsType) + "】" + (LNew[i].NewsTitle.Length > 16 ? LNew[i].NewsTitle.Substring(0, 16) + "..." : LNew[i].NewsTitle) + "</a>" + IsEnd(LNew[i].PmID) + (LNew[i].ShowType.IndexOf("1") >= 0 ? "<i class='newIcon'></i>" : "") + "<i class='date1'>" + LNew[i].CreateDate.ToString("yyyy-MM-dd") + "</i></li>";
                }
            }
            ULNewList.InnerHtml = Html;
        }
        else
        {
            //ULNewList.InnerHtml = "<li style='text-align:center'><span>暂无公告</span></li>";
            ULNewList.InnerHtml = "<div class='nomh-box'><i class='nomh-i'></i>暂无公告</div>";
        }
        #endregion

        if (!IsPostBack)
        {
            if (IsDisAdmin(this.UserID))
            {
                if (user.UserPwd == Util.md5("123456"))
                {
                    DisImport.Attributes.Add("style", "display:block");
                    zzc.Attributes.Add("style", "display:block");
                    return;
                }
            }
        }
    }
Exemple #14
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if ((HttpContext.Current.Session["UserModel"] as LoginModel) != null)
        {
            CompID = (HttpContext.Current.Session["UserModel"] as LoginModel).CompID;
        }

        object obj2 = Request["action"];

        if (obj2 != null)
        {
            if (obj2.ToString() == "yanz")//验证是否还存在下级分类
            {
                int id = 0;
                if (Request["id"] != null)
                {
                    id = Convert.ToInt32(Request["id"]);
                }
                Response.Write(GetMinCategory(id));
                Response.End();
            }
        }
        if (!IsPostBack)
        {
            object obj = Request.QueryString["type"];
            if (obj != null)
            {
                type = obj.ToString();
                if (!Util.IsEmpty(type))
                {
                    if (Request.QueryString["disId"] != null)
                    {
                        disID = Request.QueryString["disId"];
                    }
                    else
                    {
                        disID = "0";
                    }

                    if (type == "1")//商品分类
                    {
                        IsExepand = Common.RsertFolding(type, CompID);
                        string strwhere = string.Empty;
                        List <Hi.Model.SYS_GType> FindList = new List <Hi.Model.SYS_GType>();
                        List <Hi.Model.SYS_GType> l        = new Hi.BLL.SYS_GType().GetList("id,TypeName,ParentId", "isnull(dr,0)=0 and isenabled=1 ", " id");
                        if (string.IsNullOrWhiteSpace(Request["val"]))
                        {
                            FindList = l.Where(T => T.ParentId == 0).ToList();
                        }
                        else
                        {
                            string SearchValue = Request["val"].Replace("'", "''");
                            List <Hi.Model.SYS_GType> ParentList = new List <Hi.Model.SYS_GType>();
                            strwhere += " isnull(dr,0)=0 and isenabled=1 and TypeName like '%" + SearchValue + "%'";
                            FindList  = new Hi.BLL.SYS_GType().GetList("id,TypeName,ParentId", strwhere, " id");
                            foreach (Hi.Model.SYS_GType model in FindList)
                            {
                                //string NewName = model.CategoryName.Replace(SearchValue, "<i style='color:red'>" + SearchValue + "</i>");
                                string NewName     = model.TypeName;
                                var    ParentModel = l.Where(T => T.ID == model.ParentId).ToList();
                                if (ParentModel.Count > 0)
                                {
                                    NewName = ParentModel[0].TypeName + " > " + NewName;
                                }
                                model.TypeName = NewName;
                                ParentList.Add(model);
                            }
                            FindList = ParentList;
                        }
                        if (l.Count > 0 && FindList.Count > 0)
                        {
                            BindHTML(l, FindList, type);
                        }
                    }
                    else if (type == "2")//代理商区域
                    {
                        List <Hi.Model.BD_DisArea> FindList = new List <Hi.Model.BD_DisArea>();
                        List <Hi.Model.BD_DisArea> ll       = new Hi.BLL.BD_DisArea().GetList("id,AreaName,ParentId", "CompanyID=" + this.CompID + " and isnull(dr,0)=0 ", "");
                        FindList = ll.Where(T => T.ParentID == 0).ToList();
                        if (ll.Count > 0 && FindList.Count > 0)
                        {
                            BindHTML(ll, FindList, type);
                        }
                    }
                    else if (type == "3")//代理商分类
                    {
                        List <Hi.Model.BD_DisType> FindList = new List <Hi.Model.BD_DisType>();
                        List <Hi.Model.BD_DisType> lll      = new Hi.BLL.BD_DisType().GetList("id,ParentId,TypeName", "compid=" + this.CompID + " and isnull(dr,0)=0 ", "");
                        FindList = lll.Where(T => T.ParentId == 0).ToList();
                        if (lll.Count > 0 && FindList.Count > 0)
                        {
                            BindHTML(lll, FindList, type);
                        }
                    }
                    else if (type == "4")//代理商地址
                    {
                        List <Hi.Model.BD_DisAddr> llll = new Hi.BLL.BD_DisAddr().GetList("id,Address", "disid=" + disID + " and isnull(dr,0)=0", "");
                        if (llll.Count > 0)
                        {
                            BindHTML(llll, llll, type);
                        }
                    }
                    else if (type == "5")
                    {//代理商管理员
                        List <Hi.Model.BD_Distributor> lllll = new Hi.BLL.BD_Distributor().GetList("id,DisName", "compid=" + this.CompID + " and isnull(dr,0)=0", "Id desc");
                        if (lllll.Count > 0)
                        {
                            BindHTML(lllll, lllll, type);
                        }
                    }
                    else if (type == "6")
                    {//代理商管理员
                        List <Hi.Model.BD_Distributor> lllll = new Hi.BLL.BD_Distributor().GetList("id,DisName", "compid=" + this.CompID + " and isnull(dr,0)=0 and AuditState=2 and IsEnabled=1", "Id asc");
                        if (lllll.Count > 0)
                        {
                            BindHTML(lllll, lllll, type);
                        }
                    }
                }
            }
        }
    }
Exemple #15
0
    /// <summary>
    /// 获取经销商详情
    /// </summary>
    /// <param name="JSon"></param>
    /// <returns></returns>
    public ResultResellerDetail GetResellerDetail(string JSon)
    {
        string UserID = string.Empty;
        string CompID = string.Empty;
        string DisID  = string.Empty;

        try
        {
            #region//JSon取值
            JsonData JInfo = JsonMapper.ToObject(JSon);
            if (JInfo["UserID"].ToString().Trim() == "" || JInfo["CompID"].ToString().Trim() == "" || JInfo["ResellerID"].ToString().Trim() == "")
            {
                return new ResultResellerDetail()
                       {
                           Result = "F", Description = "参数异常"
                       }
            }
            ;
            UserID = JInfo["UserID"].ToString();
            CompID = JInfo["CompID"].ToString();
            DisID  = JInfo["ResellerID"].ToString();
            //判断登录信息是否异常
            Hi.Model.SYS_Users one = new Hi.Model.SYS_Users();
            if (!new Common().IsLegitUser(int.Parse(UserID), out one, Int32.Parse(CompID)))
            {
                return(new ResultResellerDetail()
                {
                    Result = "F", Description = "登录信息异常"
                });
            }
            //判断核心企业信息是否异常
            Hi.Model.BD_Company comp = new Hi.BLL.BD_Company().GetModel(Int32.Parse(CompID));
            if (comp == null || comp.dr == 1 || comp.IsEnabled == 0 || comp.AuditState == 0)
            {
                return new ResultResellerDetail()
                       {
                           Result = "F", Description = "核心企业信息异常"
                       }
            }
            ;
            //判断经销商信息是否异常
            Hi.Model.BD_Distributor dis = new Hi.BLL.BD_Distributor().GetModel(Int32.Parse(DisID));
            if (dis == null)
            {
                return new ResultResellerDetail()
                       {
                           Result = "F", Description = "经销商信息异常"
                       }
            }
            ;
            if (dis.dr == 1)
            {
                return new ResultResellerDetail()
                       {
                           Result = "F", Description = "经销商已被删除"
                       }
            }
            ;
            if (dis.AuditState == 0)
            {
                return new ResultResellerDetail()
                       {
                           Result = "F", Description = "经销商未审核"
                       }
            }
            ;
            #endregion
            //获取经销商的返回信息
            class_ver3.Reseller res = new class_ver3.Reseller();
            res.ResellerID   = dis.ID.ToString();
            res.ResellerName = dis.DisName;
            //拼接经销商地址
            string area = string.Empty;
            area += dis.Province;
            if (dis.City != "市辖区")
            {
                area += dis.City;
            }
            area                  += dis.Area;
            area                  += dis.Address;
            res.ResellerAddr       = area;
            res.ResellerProvince   = dis.Province;
            res.ResellerCity       = dis.City;
            res.ResellerArea       = dis.Area;
            res.Address            = dis.Address;
            res.ResellerCode       = dis.DisCode;
            res.ResellerClassifyID = dis.DisTypeID.ToString();
            //根据经销商分类ID获取分类名称
            Hi.Model.BD_DisType dis_type = new Hi.BLL.BD_DisType().GetModel(dis.DisTypeID);
            if (dis_type != null)
            {
                res.ResellerClassify = dis_type.TypeName;
            }
            else
            {
                res.ResellerClassify = "";
            }
            res.Zip       = dis.Zip;
            res.Tel       = dis.Tel;
            res.Fax       = dis.Fax;
            res.Principal = dis.Principal;
            res.Phone     = dis.Phone;
            res.AreaID    = dis.AreaID.ToString();
            //根据经销商区域ID获取区域名称
            Hi.Model.BD_DisArea dis_area = new Hi.BLL.BD_DisArea().GetModel(dis.AreaID);
            if (dis_area != null)
            {
                res.AreaName = dis_area.AreaName;
            }
            else
            {
                res.AreaName = "";
            }
            res.IsEnabled = dis.IsEnabled.ToString();
            res.ts        = dis.ts.ToString();
            #region //获取此经销商的开票信息
            List <Hi.Model.BD_DisAccount> list_disinvoce = new Hi.BLL.BD_DisAccount().GetList("", "DisID=" + dis.ID + " and isnull(dr,0)=0", "CreateDate desc");
            List <class_ver3.Invoce>      list_invoce    = new List <class_ver3.Invoce>();
            if (list_disinvoce != null && list_disinvoce.Count > 0)
            {
                //循环赋值开票信息的返回信息
                foreach (Hi.Model.BD_DisAccount dis_invoce in list_disinvoce)
                {
                    class_ver3.Invoce invoce = new class_ver3.Invoce();
                    invoce.InvoceID   = dis_invoce.ID.ToString();
                    invoce.TRNumber   = ClsSystem.gnvl(dis_invoce.TRNumber, "");
                    invoce.InvoceType = invoce.TRNumber == "" ? "普通发票" : "增值税发票";
                    invoce.Rise       = dis_invoce.Rise;
                    invoce.Content    = dis_invoce.Content;
                    invoce.OBank      = dis_invoce.OBank;
                    invoce.OAccount   = dis_invoce.OAccount;
                    list_invoce.Add(invoce);
                }
            }
            #endregion

            #region//获取经销商的管理员登录账号
            //先从SYS_CompUser表中取出对应sys_user表的ID
            List <Hi.Model.SYS_CompUser> list_compuser = new Hi.BLL.SYS_CompUser().GetList("UserID",
                                                                                           "DisID=" + dis.ID + " and UType = 5 and isnull(dr,0)=0 and isnull(IsEnabled,0)=1 and isnull(IsAudit,0)=2", "");
            //根据userid取出sys_user表数据,赋值给返回信息
            Hi.Model.SYS_Users user    = new Hi.BLL.SYS_Users().GetModel(list_compuser[0].UserID);
            class_ver3.Account account = new class_ver3.Account();
            if (user != null && user.AuditState == 2 && user.IsEnabled == 1 && user.dr == 0)
            {
                account.AccountID = user.ID.ToString();
                account.UserName  = user.UserName;
                account.TrueName  = user.TrueName;
                account.Phone     = user.Phone;
                account.ts        = user.ts.ToString();
            }
            #endregion
            res.InvoceList = list_invoce;
            res.Account    = account;


            string  sqlstr = string.Format(@"select b.DisID, a.type, a.validDate, a.fileName 
                    from YZT_Annex a, YZT_FCmaterials b where b.dr=0 and a.dr=0 and
                    b.DisID={0} and b.ID=a.fcID and a.fileAlias=4", DisID);
            DataSet ds     = SqlHelper.Query(SqlHelper.LocalSqlServer, sqlstr);
            if (ds.Tables.Count > 0)
            {
                List <class_ver3.FCMaterial> materials = new List <class_ver3.FCMaterial>();
                foreach (DataRow r in ds.Tables[0].Rows)
                {
                    class_ver3.FCMaterial fcMaterial = new class_ver3.FCMaterial();

                    fcMaterial.category  = Common.GetAnnexDescription(SqlHelper.GetInt(r["type"]));
                    fcMaterial.validDate = SqlHelper.GetString(r["validDate"]);

                    DateTime expireDate = SqlHelper.GetDateTime(r["validDate"]);
                    if (expireDate != null && !string.IsNullOrEmpty(fcMaterial.validDate))
                    {
                        fcMaterial.dateDiff = (expireDate - DateTime.Now).Days;
                    }

                    fcMaterial.fileUrl = SqlHelper.GetString(r["fileName"]);
                    if (!string.IsNullOrEmpty(fcMaterial.fileUrl))
                    {
                        fcMaterial.fileUrl = ConfigurationManager.AppSettings["OssImgPath"] + "/UploadFile/" + fcMaterial.fileUrl;
                    }
                    fcMaterial.DisID = SqlHelper.GetInt(r["DisID"]);
                    materials.Add(fcMaterial);
                }
                res.FCMaterialList = materials;
            }

            return(new ResultResellerDetail()
            {
                Result = "T", Description = "获取成功", Reseller = res
            });
        }
        catch (Exception ex)
        {
            Common.CatchInfo(ex.Message + ":" + ex.StackTrace, "GetResellerDetail:" + JSon);
            return(new ResultResellerDetail()
            {
                Result = "F", Description = "获取失败"
            });
        }
    }
Exemple #16
0
    public string DisArea = string.Empty;//代理商区域数据源
    /// <summary>
    ///
    /// </summary>
    public void bind()
    {
        if (KeyID != 0)
        {
            Hi.Model.YZT_FirstCamp fcmodel = new Hi.BLL.YZT_FirstCamp().GetModel(KeyID);

            if (fcmodel != null)
            {
                //string htid = Request["htid"] + "";
                //if (QrFC(fcmodel.CMID.ToString(), htid) > 0)
                //{
                //    this.btnConfirm.Visible = false;
                //    this.liDisArea.Visible = false;
                //}
            }

            //绑定区域
            StringBuilder sbare            = new StringBuilder();
            List <Hi.Model.BD_DisArea> are = new Hi.BLL.BD_DisArea().GetList("top 12 * ", "isnull(dr,0)=0 and  ParentId=0  and CompanyID=" + this.CompID, " SortIndex");
            if (are.Count > 0)
            {
                sbare.Append("[");
                int num = 0;
                foreach (var model in are)
                {
                    num++;
                    sbare.Append("{code:'" + model.ID + "',value: '" + model.ID + "',label: '" + model.AreaName + "'");
                    List <Hi.Model.BD_DisArea> aret1 = new Hi.BLL.BD_DisArea().GetList("Areacode,ID,AreaName", "isnull(dr,0)=0  and ParentId=" + model.ID, "");
                    if (aret1.Count > 0)
                    {
                        sbare.Append(",children: [");
                        int num2 = 0;
                        foreach (var model2 in aret1)
                        {
                            num2++;
                            sbare.Append("{code:'" + model2.ID + "',value: '" + model2.ID + "',label: '" + model2.AreaName + "'");
                            List <Hi.Model.BD_DisArea> are3 = new Hi.BLL.BD_DisArea().GetList("Areacode,ID,AreaName", "isnull(dr,0)=0  and ParentId=" + model2.ID, "");
                            if (are3.Count > 0)
                            {
                                sbare.Append(",children: [");
                                int num3 = 0;
                                foreach (var item3 in are3)
                                {
                                    num3++;
                                    if (num3 == are3.Count)
                                    {
                                        sbare.Append("{code:'" + item3.ID + "',value: '" + item3.ID + "',label: '" + item3.AreaName + "'}");
                                    }
                                    else
                                    {
                                        sbare.Append("{code:'" + item3.ID + "',value: '" + item3.ID + "',label: '" + item3.AreaName + "'},");
                                    }
                                }
                                sbare.Append("]");
                            }

                            if (num2 == aret1.Count)
                            {
                                sbare.Append("}");
                            }
                            else
                            {
                                sbare.Append("},");
                            }
                        }
                        sbare.Append("]");
                    }
                    if (num == are.Count)
                    {
                        sbare.Append("}");
                    }
                    else
                    {
                        sbare.Append("},");
                    }
                }
                sbare.Append("]");
                DisArea = sbare.ToString();
            }
        }
    }
Exemple #17
0
    /// <summary>
    /// 经销商获取个人信息
    /// </summary>
    /// <param name="JSon"></param>
    /// <returns></returns>
    public ResultDisInfo GetResellerInfo(string JSon)
    {
        try
        {
            #region JSon取值

            string userID = string.Empty;
            string disID  = string.Empty;

            JsonData JInfo = JsonMapper.ToObject(JSon);
            if (JInfo.Count > 0 && JInfo["UserID"].ToString() != "" && JInfo["ResellerID"].ToString() != "")
            {
                userID = JInfo["UserID"].ToString();

                disID = JInfo["ResellerID"].ToString();
                //"{"LoginName":"def","PassWord":"******","OpenID":"def"}"
            }
            else
            {
                return(new ResultDisInfo()
                {
                    Result = "F", Description = "参数异常"
                });
            }

            #endregion

            Hi.Model.SYS_Users user = new Hi.BLL.SYS_Users().GetModel(int.Parse(userID));
            if (user == null || user.IsEnabled == 0 || user.dr == 1)
            {
                return new ResultDisInfo()
                       {
                           Result = "F", Description = "用户异常"
                       }
            }
            ;
            Hi.Model.BD_Distributor dis = new Hi.BLL.BD_Distributor().GetModel(int.Parse(disID));
            if (dis == null)
            {
                return new ResultDisInfo()
                       {
                           Result = "F", Description = "经销商异常"
                       }
            }
            ;
            Hi.Model.BD_DisType disType = new Hi.BLL.BD_DisType().GetModel(dis.DisTypeID);
            string DisTypeName          = string.Empty;
            if (disType != null)
            {
                DisTypeName = disType.TypeName;
            }
            Hi.Model.BD_DisArea area = new Hi.BLL.BD_DisArea().GetModel(dis.AreaID);
            string AreaName          = string.Empty;
            if (area != null)
            {
                AreaName = area.AreaName;
            }
            return(new ResultDisInfo()
            {
                Result = "T",
                Description = "获取成功",
                DisName = dis.DisName,
                DisTypeName = DisTypeName,
                AreaName = AreaName,
                DisPrincipal = dis.Principal,
                DisPhone = dis.Phone,
                IsCheck = dis.IsCheck.ToString(),
                CreditType = dis.CreditType.ToString(),
                UserName = user.UserName,
                UserSex = user.Sex,
                UserPhone = user.Phone,
                PrePaymentMoney = new Hi.BLL.PAY_PrePayment().sums(dis.ID, dis.CompID).ToString()
            });
        }
        catch
        {
            Common.CatchInfo(JSon, "GetResellerInfo");
            return(new ResultDisInfo()
            {
                Result = "F", Description = "参数异常"
            });
        }
    }
Exemple #18
0
    /// <summary>
    /// 获取经销商区域
    /// </summary>
    /// <param name="JSon"></param>
    /// <returns></returns>
    public ResultResellerArea GetResellerAreaList(string JSon)
    {
        string UserID = string.Empty;
        string CompID = string.Empty;

        try
        {
            #region//JSon取值
            JsonData JInfo = JsonMapper.ToObject(JSon);
            if (JInfo["UserID"].ToString().Trim() == "" || JInfo["CompID"].ToString().Trim() == "")
            {
                return new ResultResellerArea()
                       {
                           Result = "F", Description = "参数异常"
                       }
            }
            ;
            UserID = JInfo["UserID"].ToString();
            CompID = JInfo["CompID"].ToString();
            //判断登录信息是否异常
            Hi.Model.SYS_Users one = new Hi.Model.SYS_Users();
            if (!new Common().IsLegitUser(int.Parse(UserID), out one, Int32.Parse(CompID)))
            {
                return(new ResultResellerArea()
                {
                    Result = "F", Description = "登录信息异常"
                });
            }
            //判断核心企业信息是否异常
            Hi.Model.BD_Company comp = new Hi.BLL.BD_Company().GetModel(Int32.Parse(CompID));
            if (comp == null || comp.dr == 1 || comp.IsEnabled == 0 || comp.AuditState == 0)
            {
                return new ResultResellerArea()
                       {
                           Result = "F", Description = "核心企业信息异常"
                       }
            }
            ;
            #endregion
            //赋值返回值
            List <class_ver3.Area> list_area = new List <class_ver3.Area>();
            //根据核心企业ID获取其经销商区域list
            List <Hi.Model.BD_DisArea> list_areamodel = new Hi.BLL.BD_DisArea().GetList("", "CompanyID=" + comp.ID + " and isnull(dr,0)=0", "SortIndex");
            if (list_areamodel != null && list_areamodel.Count > 0)
            {
                foreach (Hi.Model.BD_DisArea disarea in list_areamodel)
                {
                    class_ver3.Area area = new class_ver3.Area();
                    area.AreaID    = disarea.ID.ToString();
                    area.AreaName  = disarea.AreaName;
                    area.AreaCode  = disarea.Areacode;
                    area.ParentID  = disarea.ParentID.ToString();
                    area.SortIndex = disarea.SortIndex;
                    list_area.Add(area);
                }
            }
            return(new ResultResellerArea()
            {
                Result = "T", Description = "获取成功", AreaList = list_area
            });
        }
        catch (Exception ex)
        {
            Common.CatchInfo(ex.Message + ":" + ex.StackTrace, "GetResellerAreaList:" + JSon);
            return(new ResultResellerArea()
            {
                Result = "F", Description = "获取失败"
            });
        }
    }
Exemple #19
0
    public void bind()
    {
        //绑定区域
        StringBuilder sbare            = new StringBuilder();
        List <Hi.Model.BD_DisArea> are = new Hi.BLL.BD_DisArea().GetList("top 12 * ", "isnull(dr,0)=0 and  ParentId=0  and CompanyID=" + this.CompID, " SortIndex");

        if (are.Count > 0)
        {
            sbare.Append("[");
            int num = 0;
            foreach (var model in are)
            {
                num++;
                sbare.Append("{code:'" + model.ID + "',value: '" + model.ID + "',label: '" + model.AreaName + "'");
                List <Hi.Model.BD_DisArea> aret1 = new Hi.BLL.BD_DisArea().GetList("Areacode,ID,AreaName", "isnull(dr,0)=0  and ParentId=" + model.ID, "");
                if (aret1.Count > 0)
                {
                    sbare.Append(",children: [");
                    int num2 = 0;
                    foreach (var model2 in aret1)
                    {
                        num2++;
                        sbare.Append("{code:'" + model2.ID + "',value: '" + model2.ID + "',label: '" + model2.AreaName + "'");
                        List <Hi.Model.BD_DisArea> are3 = new Hi.BLL.BD_DisArea().GetList("Areacode,ID,AreaName", "isnull(dr,0)=0  and ParentId=" + model2.ID, "");
                        if (are3.Count > 0)
                        {
                            sbare.Append(",children: [");
                            int num3 = 0;
                            foreach (var item3 in are3)
                            {
                                num3++;
                                if (num3 == are3.Count)
                                {
                                    sbare.Append("{code:'" + item3.ID + "',value: '" + item3.ID + "',label: '" + item3.AreaName + "'}");
                                }
                                else
                                {
                                    sbare.Append("{code:'" + item3.ID + "',value: '" + item3.ID + "',label: '" + item3.AreaName + "'},");
                                }
                            }
                            sbare.Append("]");
                        }

                        if (num2 == aret1.Count)
                        {
                            sbare.Append("}");
                        }
                        else
                        {
                            sbare.Append("},");
                        }
                    }
                    sbare.Append("]");
                }
                if (num == are.Count)
                {
                    sbare.Append("}");
                }
                else
                {
                    sbare.Append("},");
                }
            }
            sbare.Append("]");
            DisArea = sbare.ToString();
        }
    }
Exemple #20
0
    /// <summary>
    ///核心企业新增经销商
    /// </summary>
    /// <param name="JSon"></param>
    /// <returns></returns>
    public ReseltResellerEdit AddReseller(string JSon)
    {
        string UserID = string.Empty;
        string CompID = string.Empty;

        try
        {
            #region//JSon取值
            JsonData JInfo = JsonMapper.ToObject(JSon);
            if (JInfo["UserID"].ToString().Trim() == "" || JInfo["CompID"].ToString().Trim() == "" || JInfo["Reseller"].ToString().Trim() == "")
            {
                return new ReseltResellerEdit()
                       {
                           Result = "F", Description = "参数异常"
                       }
            }
            ;
            UserID = JInfo["UserID"].ToString();
            CompID = JInfo["CompID"].ToString();
            JsonData Reseller = JInfo["Reseller"];
            //判断登录信息是否异常
            Hi.Model.SYS_Users one = new Hi.Model.SYS_Users();
            if (!new Common().IsLegitUser(int.Parse(UserID), out one, Int32.Parse(CompID)))
            {
                return(new ReseltResellerEdit()
                {
                    Result = "F", Description = "登录信息异常"
                });
            }
            //判断核心企业信息是否异常
            Hi.Model.BD_Company comp = new Hi.BLL.BD_Company().GetModel(Int32.Parse(CompID));
            if (comp == null || comp.dr == 1 || comp.IsEnabled == 0 || comp.AuditState == 0)
            {
                return new ReseltResellerEdit()
                       {
                           Result = "F", Description = "核心企业信息异常"
                       }
            }
            ;
            #endregion
            #region//判断传入的经销商信息是否正确
            string resellername = Common.NoHTML(Reseller["ResellerName"].ToString().Trim());
            string resellercode = Common.NoHTML(Reseller["ResellerCode"].ToString().Trim());
            string address      = Common.NoHTML(Reseller["Address"].ToString().Trim());
            if (resellername == "")
            {
                return new ReseltResellerEdit()
                       {
                           Result = "F", Description = "请输入经销商名称"
                       }
            }
            ;
            //判断经销商名字是否已存在
            if (Common.DisExistsAttribute("DisName", resellername, CompID.ToString()))
            {
                return new ReseltResellerEdit()
                       {
                           Result = "F", Description = "经销商名称已经存在"
                       }
            }
            ;
            if (Reseller["ResellerProvince"].ToString().Trim() == "")
            {
                return new ReseltResellerEdit()
                       {
                           Result = "F", Description = "请选择经销商地址中的省"
                       }
            }
            ;
            if (Reseller["ResellerCity"].ToString().Trim() == "")
            {
                return new ReseltResellerEdit()
                       {
                           Result = "F", Description = "请选择经销商地址中的市"
                       }
            }
            ;
            if (Reseller["ResellerArea"].ToString().Trim() == "")
            {
                return new ReseltResellerEdit()
                       {
                           Result = "F", Description = "请选择经销商地址中的区"
                       }
            }
            ;
            if (address == "")
            {
                return new ReseltResellerEdit()
                       {
                           Result = "F", Description = "请输入经销商地址中的详细地址"
                       }
            }
            ;
            #endregion
            #region//判断登录信息的正确信
            JsonData account  = Reseller["Account"];
            string   username = Common.NoHTML(account["UserName"].ToString().Trim());
            string   truename = Common.NoHTML(account["TrueName"].ToString().Trim());
            if (account["UserName"].ToString().Trim() == "")
            {
                return new ReseltResellerEdit()
                       {
                           Result = "F", Description = "请输入登录账号"
                       }
            }
            ;
            //判断登录账号是否已经存在
            if (Common.GetUserExists(username))
            {
                return new ReseltResellerEdit()
                       {
                           Result = "F", Description = "该登录账号已存在"
                       }
            }
            ;
            if (truename == "")
            {
                return new ReseltResellerEdit()
                       {
                           Result = "F", Description = "请输入姓名"
                       }
            }
            ;
            if (account["Phone"].ToString().Trim() == "")
            {
                return new ReseltResellerEdit()
                       {
                           Result = "F", Description = "请登录信息中的手机号码"
                       }
            }
            ;
            //判断手机号有没被注册过
            Regex Phonereg = new Regex("^0?(13[0-9]|15[012356789]|18[0-9]|14[57]|17[7])[0-9]{8}$");
            if (!Phonereg.IsMatch(account["Phone"].ToString()))
            {
                return new ReseltResellerEdit()
                       {
                           Result = "F", Description = "登录信息中的手机号格式错误"
                       }
            }
            ;
            if (Common.GetUserExists("Phone", account["Phone"].ToString()))
            {
                return new ReseltResellerEdit()
                       {
                           Result = "F", Description = "登录信息中的手机号已被注册"
                       }
            }
            ;
            #endregion
            //创建需要导入的经销商实体
            Hi.Model.BD_Distributor disModel = new Hi.Model.BD_Distributor();
            disModel.CompID  = comp.ID;
            disModel.DisCode = resellercode;
            disModel.DisName = resellername;
            //传入分类ID的话,判断分类ID是否正确
            if (Reseller["ResellerClassifyID"].ToString().Trim() != "" && Reseller["ResellerClassifyID"].ToString() != "0")
            {
                Hi.Model.BD_DisType distpye = new Hi.BLL.BD_DisType().GetModel(Int32.Parse(Reseller["ResellerClassifyID"].ToString().Trim()));

                if (distpye == null || distpye.CompID != comp.ID)
                {
                    return new ReseltResellerEdit()
                           {
                               Result = "F", Description = "经销商分类异常"
                           }
                }
                ;
                if (distpye.dr == 1)
                {
                    return new ReseltResellerEdit()
                           {
                               Result = "F", Description = "此经销商分类已被删除"
                           }
                }
                ;
                //if (distpye.IsEnabled != 0)
                //    return new ReseltResellerEdit() { Result = "F", Description = "此经销商分类已被禁用" };

                disModel.DisTypeID = distpye.ID;
            }
            else
            {
                disModel.DisTypeID = 0;
            }
            //传入区域ID的话,判断区域ID是否正确
            if (Reseller["AreaID"].ToString().Trim() != "" && Reseller["AreaID"].ToString() != "0")
            {
                Hi.Model.BD_DisArea disarea = new Hi.BLL.BD_DisArea().GetModel(Int32.Parse(Reseller["AreaID"].ToString().Trim()));
                if (disarea == null || disarea.CompanyID != comp.ID)
                {
                    return new ReseltResellerEdit()
                           {
                               Result = "F", Description = "经销商区域异常"
                           }
                }
                ;
                if (disarea.dr == 1)
                {
                    return new ReseltResellerEdit()
                           {
                               Result = "F", Description = "此经销商区域已被删除"
                           }
                }
                ;
                disModel.AreaID = disarea.ID;
            }
            else
            {
                disModel.AreaID = 0;
            }
            disModel.DisLevel = "";
            disModel.Province = Reseller["ResellerProvince"].ToString();
            disModel.City     = Reseller["ResellerCity"].ToString();
            disModel.Area     = Reseller["ResellerArea"].ToString();
            disModel.Address  = address;
            //没输入经销商中的联系人,需要将登录信息的姓名赋值给联系人
            string principal = Common.NoHTML(Reseller["Principal"].ToString().Trim());
            string phone     = Common.NoHTML(Reseller["Phone"].ToString().Trim());
            if (principal == "")
            {
                disModel.Principal = truename;
            }
            else
            {
                disModel.Principal = principal;
            }
            //没输入联系人手机号,需要将登录信息中的手机号赋值给联系人手机号
            if (phone == "")
            {
                disModel.Phone = account["Phone"].ToString();
            }
            else
            {
                disModel.Phone = phone;
            }
            disModel.Leading      = "";
            disModel.LeadingPhone = "";
            disModel.Licence      = "";
            disModel.Tel          = Common.NoHTML(Reseller["Tel"].ToString());
            disModel.Zip          = Common.NoHTML(Reseller["Zip"].ToString());
            disModel.Fax          = Common.NoHTML(Reseller["Fax"].ToString());
            disModel.Remark       = "";
            disModel.DisAccount   = 0;
            disModel.IsCheck      = 1;
            disModel.CreditType   = 0;
            disModel.CreditAmount = 0;
            disModel.Paypwd       = Common.md5("123456");
            disModel.AuditState   = 2;
            disModel.IsEnabled    = 1;
            disModel.CreateUserID = one.ID;
            disModel.CreateDate   = DateTime.Now;
            disModel.ts           = DateTime.Now;
            disModel.dr           = 0;
            disModel.modifyuser   = one.ID;
            //开启事务,并将dismodel插入经销商表中
            SqlConnection conn = new SqlConnection(SqlHelper.LocalSqlServer);
            //开启数据库连接
            if (conn.State.ToString().ToLower() != "open")
            {
                conn.Open();
            }
            //开启事务
            SqlTransaction mytran = conn.BeginTransaction();
            int            DisID  = 0;
            try
            {
                //在经销商表中插入一条数据
                if ((DisID = new Hi.BLL.BD_Distributor().Add(disModel, mytran)) > 0)
                {
                    //经销商表插入成功的话继续新增角色
                    List <Hi.Model.SYS_Role> list_role = new Hi.BLL.SYS_Role().GetList("", "isnull(dr,0)=0 and isenabled=1 and DisID=" + DisID + " and RoleName='企业管理员'", "");

                    if (list_role == null || list_role.Count == 0)
                    {
                        //新增角色(企业管理员)
                        Hi.Model.SYS_Role role = new Hi.Model.SYS_Role();
                        role.CompID       = comp.ID;
                        role.DisID        = DisID;
                        role.RoleName     = "企业管理员";
                        role.IsEnabled    = 1;
                        role.SortIndex    = "1";
                        role.CreateDate   = DateTime.Now;
                        role.CreateUserID = one.ID;
                        role.ts           = DateTime.Now;
                        role.modifyuser   = one.ID;
                        role.dr           = 0;
                        int Roid = new Hi.BLL.SYS_Role().Add(role, mytran);
                        //新增管理员用户和角色
                        Hi.Model.SYS_Users user = new Hi.Model.SYS_Users();
                        user.UserName = username;
                        // user.CompID = CompID;
                        // user.Type = 5;
                        // user.RoleID = Roid;
                        user.TrueName     = truename;
                        user.UserPwd      = Common.md5("123456");
                        user.Phone        = account["Phone"].ToString();
                        user.AuditState   = 2;
                        user.IsEnabled    = 1;
                        user.CreateUserID = one.ID;
                        user.CreateDate   = DateTime.Now;
                        user.ts           = DateTime.Now;
                        user.modifyuser   = one.ID;
                        int AddUserid = new Hi.BLL.SYS_Users().Add(user, mytran);
                        ///用户明细表
                        Hi.Model.SYS_CompUser CompUser = new Hi.Model.SYS_CompUser();
                        CompUser.CompID       = comp.ID;
                        CompUser.DisID        = DisID;
                        CompUser.CreateDate   = DateTime.Now;
                        CompUser.CreateUserID = one.ID;
                        CompUser.modifyuser   = one.ID;
                        CompUser.CType        = 2;
                        CompUser.UType        = 5;
                        CompUser.IsEnabled    = 1;
                        CompUser.IsAudit      = 2;
                        CompUser.RoleID       = 0;
                        CompUser.ts           = DateTime.Now;
                        CompUser.dr           = 0;
                        CompUser.UserID       = AddUserid;
                        int compuserid = new Hi.BLL.SYS_CompUser().Add(CompUser, mytran);
                        //新增角色用户
                        Hi.Model.SYS_RoleUser RoleUser = new Hi.Model.SYS_RoleUser();
                        RoleUser.FunType    = 1;
                        RoleUser.UserID     = AddUserid;
                        RoleUser.RoleID     = Roid;
                        RoleUser.IsEnabled  = true;
                        RoleUser.CreateUser = UserID;
                        RoleUser.CreateDate = DateTime.Now;
                        RoleUser.ts         = DateTime.Now;
                        RoleUser.dr         = 0;
                        int roleuserid = new Hi.BLL.SYS_RoleUser().Add(RoleUser, mytran);
                        //新增角色权限表
                        Hi.Model.SYS_RoleSysFun    rolesys = null;
                        List <Hi.Model.SYS_SysFun> funList = new Hi.BLL.SYS_SysFun().GetList("", " Type=2", "");
                        foreach (Hi.Model.SYS_SysFun sys in funList)
                        {
                            rolesys              = new Hi.Model.SYS_RoleSysFun();
                            rolesys.CompID       = comp.ID;
                            rolesys.DisID        = DisID;
                            rolesys.RoleID       = Roid;
                            rolesys.FunCode      = sys.FunCode;
                            rolesys.FunName      = sys.FunName;
                            rolesys.IsEnabled    = 1;
                            rolesys.CreateUserID = one.ID;
                            rolesys.CreateDate   = DateTime.Now;
                            rolesys.ts           = DateTime.Now;
                            rolesys.modifyuser   = one.ID;
                            if (new Hi.BLL.SYS_RoleSysFun().Add(rolesys, mytran) <= 0)
                            {
                                mytran.Rollback();
                                return(new ReseltResellerEdit()
                                {
                                    Result = "F", Description = "新增失败"
                                });
                            }
                        }
                        //新增收货地址
                        Hi.Model.BD_DisAddr addr = new Hi.Model.BD_DisAddr();
                        addr.Province     = disModel.Province;
                        addr.City         = disModel.City;
                        addr.Area         = disModel.Area;
                        addr.DisID        = DisID;
                        addr.Principal    = disModel.Principal;
                        addr.Phone        = disModel.Phone;
                        addr.Address      = disModel.Province + disModel.City + disModel.Area + disModel.Address;
                        addr.IsDefault    = 1;
                        addr.ts           = DateTime.Now;
                        addr.CreateDate   = DateTime.Now;
                        addr.CreateUserID = one.ID;
                        addr.modifyuser   = one.ID;
                        int addrid = new Hi.BLL.BD_DisAddr().Add(addr, mytran);
                        //判断所有表是否都插入成功了吗
                        if (Roid <= 0 || AddUserid <= 0 || compuserid <= 0 || roleuserid <= 0 || addrid <= 0)
                        {
                            mytran.Rollback();
                            return(new ReseltResellerEdit()
                            {
                                Result = "F", Description = "新增失败"
                            });
                        }
                    }
                    else
                    {
                        mytran.Rollback();
                        return(new ReseltResellerEdit()
                        {
                            Result = "F", Description = "新增失败"
                        });
                    }
                }
                else
                {
                    mytran.Rollback();
                    return(new ReseltResellerEdit()
                    {
                        Result = "F", Description = "新增失败"
                    });
                }
                mytran.Commit();
            }
            catch (Exception ex)
            {
                mytran.Rollback();
                Common.CatchInfo(ex.Message + ":" + ex.StackTrace, "AddReseller:" + JSon);
                return(new ReseltResellerEdit()
                {
                    Result = "F", Description = "新增失败"
                });
            }
            finally
            {
                conn.Close();
                mytran.Dispose();
            }
            return(new ReseltResellerEdit()
            {
                Result = "T", Description = "新增成功"
            });
        }
        catch (Exception ex)
        {
            Common.CatchInfo(ex.Message + ":" + ex.StackTrace, "AddReseller:" + JSon);
            return(new ReseltResellerEdit()
            {
                Result = "F", Description = "新增失败"
            });
        }
    }
Exemple #21
0
    /// <summary>
    /// 通过OpenID获取经销商个人信息
    /// </summary>
    /// <param name="JSon"></param>
    /// <returns></returns>
    public ResultDisInfo GetUserInfo(string JSon)
    {
        try
        {
            JsonData JInfo = JsonMapper.ToObject(JSon);
            if (JInfo.Count == 0 && JInfo["OpenID"].ToString().Trim() == "")
            {
                return(new ResultDisInfo()
                {
                    Result = "F", Description = "参数异常"
                });
            }

            Hi.Model.SYS_Users user = new Common().GetUserByOpenID(JInfo["OpenID"].ToString());
            if (user == null || user.IsEnabled == 0 || user.dr == 1)
            {
                return new ResultDisInfo()
                       {
                           Result = "T", Description = "用户异常"
                       }
            }
            ;
            Hi.Model.BD_Distributor dis = new Hi.BLL.BD_Distributor().GetModel(Convert.ToInt32(JInfo["DisID"].ToString()));
            if (dis == null || dis.IsEnabled == 0 || dis.dr == 1)
            {
                return new ResultDisInfo()
                       {
                           Result = "T", Description = "经销商异常"
                       }
            }
            ;
            Hi.Model.BD_DisType disType = new Hi.BLL.BD_DisType().GetModel(dis.DisTypeID);
            string DisTypeName          = string.Empty;
            if (disType != null)
            {
                DisTypeName = disType.TypeName;
            }
            Hi.Model.BD_DisArea area = new Hi.BLL.BD_DisArea().GetModel(dis.AreaID);
            string AreaName          = string.Empty;
            if (area != null)
            {
                AreaName = area.AreaName;
            }
            return(new ResultDisInfo()
            {
                Result = "T",
                Description = "获取成功",
                DisName = dis.DisName,
                DisTypeName = DisTypeName,
                AreaName = AreaName,
                DisPrincipal = dis.Principal,
                DisPhone = dis.Phone,
                IsCheck = dis.IsCheck.ToString(),
                CreditType = dis.CreditType.ToString(),
                UserName = user.UserName,
                UserSex = user.Sex,
                UserPhone = user.Phone,
                PrePaymentMoney = new Hi.BLL.PAY_PrePayment().sums(dis.ID, dis.CompID).ToString()
            });
        }
        catch
        {
            Common.CatchInfo(JSon, "GetResellerInfo");
            return(new ResultDisInfo()
            {
                Result = "F", Description = "参数异常"
            });
        }
    }
Exemple #22
0
    /// <summary>
    /// 招商信息
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void bind()
    {
        if (KeyID != 0)
        {
            Hi.Model.YZT_CMerchants cmModel = new Hi.BLL.YZT_CMerchants().GetModel(this.KeyID);

            this.txtCMCode.Value      = cmModel.CMCode;
            this.txtCMName.Value      = cmModel.CMName;
            this.txtGoodsCode.Value   = Common.GetGoodsName(cmModel.GoodsID.ToString(), "GoodsCode");
            this.txtGoodsName.Value   = Common.GetGoodsName(cmModel.GoodsID.ToString(), "GoodsName");
            this.txtRemark.Value      = cmModel.Remark;
            this.txtValueInfo.Value   = Common.GetGoodsInfo(cmModel.GoodsID.ToString());
            this.txtInvalidDate.Value = cmModel.InvalidDate == DateTime.MinValue ? "" : cmModel.InvalidDate.ToString("yyyy-MM-dd");
            this.txtForceDate.Value   = cmModel.ForceDate == DateTime.MinValue ? "" : cmModel.ForceDate.ToString("yyyy-MM-dd");
            this.txtCategoryID.Value  = Common.GetCategoryName(Common.GetGoodsName(cmModel.GoodsID.ToString(), "CategoryID"));
            this.ddrtype.Value        = cmModel.Type.ToString();

            if (cmModel.ProvideData.IndexOf("1") > -1)
            {
                this.chk1.Checked    = true;
                this.lblchk1.Visible = true;
            }
            if (cmModel.ProvideData.IndexOf("2") > -1)
            {
                this.lblchk2.Visible = true;
                this.chk2.Checked    = true;
            }
            if (cmModel.ProvideData.IndexOf("3") > -1)
            {
                this.lblchk3.Visible = true;
                this.chk3.Checked    = true;
            }
            if (cmModel.ProvideData.IndexOf("4") > -1)
            {
                this.lblchk4.Visible = true;
                this.chk4.Checked    = true;
            }

            string strwhere = "";
            if (ViewState["strwhere"] != null)
            {
                strwhere = ViewState["strwhere"].ToString();
            }

            string    sql = @"select fc.*,dis.DisName,dis.Principal,dis.Phone,ht.HospitalCode,ht.HospitalName from YZT_FirstCamp fc left join BD_Distributor dis on fc.DisID=dis.ID left join SYS_Hospital ht on fc.HtID=ht.ID where fc.dr=0 and dis.DisName<>'' and fc.CMID=" + this.KeyID + strwhere + " order by State";
            DataTable dt  = SqlHelper.Query(SqlHelper.LocalSqlServer, sql).Tables[0];
            if (dt != null && dt.Rows.Count > 0)
            {
                this.rptFc.DataSource = dt;
                this.rptFc.DataBind();
            }
            else
            {
                this.rptFc.DataSource = null;
                this.rptFc.DataBind();
            }


            //绑定区域
            StringBuilder sbare            = new StringBuilder();
            List <Hi.Model.BD_DisArea> are = new Hi.BLL.BD_DisArea().GetList("top 12 * ", "isnull(dr,0)=0 and  ParentId=0  and CompanyID=" + this.CompID, " SortIndex");
            if (are.Count > 0)
            {
                sbare.Append("[");
                int num = 0;
                foreach (var model in are)
                {
                    num++;
                    sbare.Append("{code:'" + model.ID + "',value: '" + model.ID + "',label: '" + model.AreaName + "'");
                    List <Hi.Model.BD_DisArea> aret1 = new Hi.BLL.BD_DisArea().GetList("Areacode,ID,AreaName", "isnull(dr,0)=0  and ParentId=" + model.ID, "");
                    if (aret1.Count > 0)
                    {
                        sbare.Append(",children: [");
                        int num2 = 0;
                        foreach (var model2 in aret1)
                        {
                            num2++;
                            sbare.Append("{code:'" + model2.ID + "',value: '" + model2.ID + "',label: '" + model2.AreaName + "'");
                            List <Hi.Model.BD_DisArea> are3 = new Hi.BLL.BD_DisArea().GetList("Areacode,ID,AreaName", "isnull(dr,0)=0  and ParentId=" + model2.ID, "");
                            if (are3.Count > 0)
                            {
                                sbare.Append(",children: [");
                                int num3 = 0;
                                foreach (var item3 in are3)
                                {
                                    num3++;
                                    if (num3 == are3.Count)
                                    {
                                        sbare.Append("{code:'" + item3.ID + "',value: '" + item3.ID + "',label: '" + item3.AreaName + "'}");
                                    }
                                    else
                                    {
                                        sbare.Append("{code:'" + item3.ID + "',value: '" + item3.ID + "',label: '" + item3.AreaName + "'},");
                                    }
                                }
                                sbare.Append("]");
                            }

                            if (num2 == aret1.Count)
                            {
                                sbare.Append("}");
                            }
                            else
                            {
                                sbare.Append("},");
                            }
                        }
                        sbare.Append("]");
                    }
                    if (num == are.Count)
                    {
                        sbare.Append("}");
                    }
                    else
                    {
                        sbare.Append("},");
                    }
                }
                sbare.Append("]");
                DisArea = sbare.ToString();
            }
        }
    }