Esempio n. 1
0
    public static string Edit(string KeyID, string HidFfileName, string UserID)
    {
        Common.ResultMessage   Msg     = new Common.ResultMessage();
        Hi.Model.YZT_FirstCamp fcmodel = new Hi.BLL.YZT_FirstCamp().GetModel(KeyID.ToInt(0));

        if (fcmodel != null)
        {
            //医疗器械经营许可证
            Hi.Model.YZT_Annex annexModel = new Hi.Model.YZT_Annex();
            annexModel.fcID         = fcmodel.ID;
            annexModel.type         = 2;
            annexModel.fileName     = HidFfileName;
            annexModel.fileAlias    = "2";
            annexModel.validDate    = DateTime.MinValue;
            annexModel.CreateDate   = DateTime.Now;
            annexModel.dr           = 0;
            annexModel.ts           = DateTime.Now;
            annexModel.modifyuser   = UserID.ToInt(0);
            annexModel.CreateUserID = UserID.ToInt(0);

            if (new Hi.BLL.YZT_Annex().Add(annexModel) > 0)
            {
                Msg.result = true;
            }
        }
        else
        {
            Msg.code = "未查找到数据";
        }
        return(new JavaScriptSerializer().Serialize(Msg));
    }
Esempio n. 2
0
    public static string RejectEdit(string KeyID, string Remark)
    {
        Common.ResultMessage   Msg     = new Common.ResultMessage();
        Hi.Model.YZT_FirstCamp fcmodel = new Hi.BLL.YZT_FirstCamp().GetModel(KeyID.ToInt(0));

        if (fcmodel != null)
        {
            fcmodel.Remark = Remark;
            fcmodel.State  = 1;
            fcmodel.ts     = DateTime.Now;

            if (new Hi.BLL.YZT_FirstCamp().Update(fcmodel))
            {
                Msg.result = true;

                Hi.Model.SYS_Users  usersModel = new Hi.BLL.SYS_Users().GetModel(fcmodel.CreateUserID);
                string              Phone      = usersModel == null ? "" : usersModel.Phone;
                Hi.Model.BD_Company comp       = new Hi.BLL.BD_Company().GetModel(fcmodel.CompID);
                string              compName   = comp == null ? "" : comp.CompName;

                GetPhoneCode pc = new GetPhoneCode();
                pc.SendReject(Phone, compName, Remark);
            }
        }
        else
        {
            Msg.code = "未查找到数据";
        }
        return(new JavaScriptSerializer().Serialize(Msg));
    }
Esempio n. 3
0
    /// <summary>
    /// 绑定数据
    /// </summary>
    public void bind()
    {
        if (KeyID != 0)
        {
            Hi.Model.YZT_FirstCamp fcmodel = new Hi.BLL.YZT_FirstCamp().GetModel(KeyID);

            if (fcmodel != null)
            {
                this.txtDisCode.Value     = Common.GetDis(fcmodel.DisID, "DisCode");
                this.txtDisName.Value     = Common.GetDis(fcmodel.DisID, "DisName");
                this.txtInvalidDate.Value = fcmodel.InvalidDate == DateTime.MinValue ? "" : fcmodel.InvalidDate.ToString("yyyy-MM-dd");
                this.txtForceDate.Value   = fcmodel.ForceDate == DateTime.MinValue ? "" : fcmodel.ForceDate.ToString("yyyy-MM-dd");
            }
        }
    }
Esempio n. 4
0
    /// <summary>
    /// 首营信息提交
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btn_Edit(object sender, EventArgs e)
    {
        if (this.KeyID > 0)
        {
            Hi.Model.YZT_FirstCamp fcmodel = new Hi.BLL.YZT_FirstCamp().GetModel(KeyID);

            if (fcmodel != null)
            {
                fcmodel.State      = 0;
                fcmodel.ts         = DateTime.Now;
                fcmodel.modifyuser = this.UserID;
                if (new Hi.BLL.YZT_FirstCamp().Update(fcmodel))
                {
                    Response.Redirect("FirstCampInfo.aspx?KeyID=" + Common.DesEncrypt(KeyID.ToString(), Common.EncryptKey));
                }
            }
        }
    }
Esempio n. 5
0
    /// <summary>
    /// 招商信息
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void bind()
    {
        if (KeyID != 0)
        {
            Hi.Model.YZT_FirstCamp fcmodel = new Hi.BLL.YZT_FirstCamp().GetModel(KeyID);

            if (fcmodel != null)
            {
                //需要上传的资料
                string ProvideData = new Hi.BLL.YZT_CMerchants().GetModel(fcmodel.CMID).ProvideData;
                this.hidProvideData.Value = ProvideData;
                hidcompID.Value           = fcmodel.CompID.ToString();

                this.txtHtname.Value      = new Hi.BLL.SYS_Hospital().GetModel(fcmodel.HtID).HospitalName;
                this.txtInvalidDate.Value = fcmodel.InvalidDate == DateTime.MinValue ? "" : fcmodel.InvalidDate.ToString("yyyy-MM-dd");
                this.txtForceDate.Value   = fcmodel.ForceDate == DateTime.MinValue ? "" : fcmodel.ForceDate.ToString("yyyy-MM-dd");
                this.txtApplyRemark.Value = fcmodel.Applyremark;
            }
        }
    }
Esempio n. 6
0
    public static string Edit(string KeyID, string CompID, string DisID, string UserID, string HtID, string ForceDate, string InvalidDate, string HidFfileName1, string validDate1, string HidFfileName2, string validDate2, string HidFfileName3, string validDate3, string HidFfileName4, string validDate4, string ApplyRemark)
    {
        //
        Common.ResultMessage    Msg       = new Common.ResultMessage();
        Hi.Model.YZT_CMerchants cmModel   = new Hi.BLL.YZT_CMerchants().GetModel(KeyID.ToInt(0));
        Hi.Model.YZT_FirstCamp  firstcamp = new Hi.Model.YZT_FirstCamp();

        //判断是否是该厂商的代理商
        List <Hi.Model.SYS_CompUser> compulist = new Hi.BLL.SYS_CompUser().GetList("", " UserID=" + UserID + " and CompID=" + CompID + " and DisID=" + DisID + "", "");

        Hi.Model.SYS_Users usersModel = new Hi.BLL.SYS_Users().GetModel(UserID);

        //首营信息
        string    sql = "select an.*,fc.ID from YZT_Annex an left join YZT_FCmaterials fc  on an.fcID =fc.ID and an.fileAlias in (4) and an.type in(5,7,8,9) where fc.DisID=" + DisID + " and ISNULL(fc.dr,0)=0 and fc.type=2 and ISNULL(an.dr,0)=0";
        DataTable dt  = SqlHelper.GetTable(SqlHelper.LocalSqlServer, sql);

        LoginModel uModel = null;

        if (HttpContext.Current.Session["UserModel"] is LoginModel)
        {
            uModel = HttpContext.Current.Session["UserModel"] as LoginModel;
        }

        SqlTransaction Tran = null;

        try
        {
            Tran = DBUtility.SqlHelper.CreateStoreTranSaction();

            if (DisID == "0")
            {
                Hi.Model.BD_Distributor Distributor = new Hi.Model.BD_Distributor();
                Distributor.CompID       = 0;
                Distributor.DisName      = uModel.CompName;
                Distributor.IsEnabled    = 1;
                Distributor.Paypwd       = Util.md5("123456");
                Distributor.Phone        = uModel.Phone;
                Distributor.AuditState   = 0;
                Distributor.CreateDate   = DateTime.Now;
                Distributor.CreateUserID = uModel.UserID;
                Distributor.ts           = DateTime.Now;
                Distributor.modifyuser   = uModel.UserID;
                Distributor.IsCheck      = 0;
                Distributor.CreditType   = 0;
                Distributor.pic          = "";
                //Distributor.creditCode = txt_creditCode;
                Distributor.Leading = "";
                Distributor.Licence = "";
                int DistributorID = 0;
                if ((DistributorID = new Hi.BLL.BD_Distributor().Add(Distributor, Tran)) > 0)
                {
                    DisID = DistributorID.ToString();

                    //代理商账户登录
                    Hi.Model.SYS_CompUser compuser = new Hi.Model.SYS_CompUser();
                    compuser.UserID       = UserID.ToInt(0);
                    compuser.CompID       = CompID.ToInt(0);
                    compuser.DisID        = DisID.ToInt(0);
                    compuser.AreaID       = 0;
                    compuser.RoleID       = usersModel == null ? 0 : usersModel.RoleID;
                    compuser.CType        = 2;
                    compuser.UType        = 5;
                    compuser.IsAudit      = 0;
                    compuser.IsEnabled    = 1;
                    compuser.ts           = DateTime.Now;
                    compuser.CreateUserID = UserID.ToInt(0);
                    compuser.modifyuser   = UserID.ToInt(0);
                    compuser.CreateDate   = DateTime.Now;

                    if (new Hi.BLL.SYS_CompUser().Add(compuser, Tran) <= 0)
                    {
                        Tran.Rollback();
                        Msg.code = "用户信息添加失败";
                        return(new JavaScriptSerializer().Serialize(Msg));
                    }
                }
                else
                {
                    Tran.Rollback();
                    Msg.code = "用户信息添加失败";
                    return(new JavaScriptSerializer().Serialize(Msg));
                }
            }
            else
            {
                if (compulist != null && compulist.Count <= 0)
                {
                    //代理商账户登录
                    Hi.Model.SYS_CompUser compuser = new Hi.Model.SYS_CompUser();
                    compuser.UserID       = UserID.ToInt(0);
                    compuser.CompID       = CompID.ToInt(0);
                    compuser.DisID        = DisID.ToInt(0);
                    compuser.AreaID       = 0;
                    compuser.RoleID       = usersModel == null ? 0 : usersModel.RoleID;
                    compuser.CType        = 2;
                    compuser.UType        = 5;
                    compuser.IsAudit      = 0;
                    compuser.IsEnabled    = 1;
                    compuser.ts           = DateTime.Now;
                    compuser.CreateUserID = UserID.ToInt(0);
                    compuser.modifyuser   = UserID.ToInt(0);
                    compuser.CreateDate   = DateTime.Now;

                    if (new Hi.BLL.SYS_CompUser().Add(compuser, Tran) <= 0)
                    {
                        Tran.Rollback();
                        Msg.code = "用户信息添加失败";
                        return(new JavaScriptSerializer().Serialize(Msg));
                    }
                }
            }

            List <Hi.Model.YZT_FirstCamp> fcamplist = new Hi.BLL.YZT_FirstCamp().GetList("", " CMID=" + KeyID + " and DisID=" + DisID + " and CompID=" + CompID + " and HtID=" + HtID, "");
            if (fcamplist != null && fcamplist.Count > 0)
            {
                Tran.Rollback();
                Msg.code = "已申请合作";
                return(new JavaScriptSerializer().Serialize(Msg));
            }

            firstcamp.CMID        = KeyID.ToInt(0);
            firstcamp.CompID      = CompID.ToInt(0);
            firstcamp.DisID       = DisID.ToInt(0);
            firstcamp.ForceDate   = ForceDate != "" ? Convert.ToDateTime(ForceDate) : DateTime.MinValue;
            firstcamp.InvalidDate = InvalidDate != "" ? Convert.ToDateTime(InvalidDate) : DateTime.MinValue;
            firstcamp.State       = 0;
            firstcamp.HtID        = HtID.ToInt(0);
            firstcamp.Applyremark = ApplyRemark;

            firstcamp.ts           = DateTime.Now;
            firstcamp.modifyuser   = UserID.ToInt(0);
            firstcamp.CreateDate   = DateTime.Now;
            firstcamp.CreateUserID = UserID.ToInt(0);

            int id = new Hi.BLL.YZT_FirstCamp().Add(firstcamp, Tran);

            if (id > 0)
            {
                //string annexdel = " fileAlias=1 and type in(5,7,9,8) and fcID=" + id;
                //new Hi.BLL.YZT_Annex().AnnexDelete(annexdel, Tran);

                List <Hi.Model.YZT_FCmaterials> fcmlist = new Hi.BLL.YZT_FCmaterials().GetList("", "DisID=" + DisID + " and type=2", "");
                int fcmid = 0;
                Hi.Model.YZT_FCmaterials fcmmodel = null;
                if (fcmlist != null && fcmlist.Count > 0)
                {
                    fcmmodel = fcmlist[0];
                    fcmid    = fcmmodel.ID;
                }
                else
                {
                    fcmmodel              = new Hi.Model.YZT_FCmaterials();
                    fcmmodel.CompID       = 0;
                    fcmmodel.DisID        = DisID.ToInt(0);
                    fcmmodel.type         = 2;
                    fcmmodel.ts           = DateTime.Now;
                    fcmmodel.modifyuser   = UserID.ToInt(0);
                    fcmmodel.CreateUserID = UserID.ToInt(0);
                    fcmmodel.CreateDate   = DateTime.Now;
                    fcmmodel.dr           = 0;
                    fcmid = new Hi.BLL.YZT_FCmaterials().Add(fcmmodel, Tran);
                }

                int    count       = id;
                string ProvideData = cmModel.ProvideData;
                if (ProvideData.IndexOf("1") > -1)
                {
                    //营业执照
                    Hi.Model.YZT_Annex annexModel1 = insertAnnex(id, 5, HidFfileName1, validDate1, UserID, "1");
                    count = new Hi.BLL.YZT_Annex().Add(annexModel1, Tran);

                    Hi.Model.YZT_Annex updateModel1 = UpFCmaterials(dt, 5, HidFfileName1, validDate1, UserID);
                    if (updateModel1 != null)
                    {
                        new Hi.BLL.YZT_Annex().Update(updateModel1, Tran);
                    }
                    else
                    {
                        Hi.Model.YZT_Annex annexModel11 = insertAnnex(fcmid, 5, HidFfileName1, validDate1, UserID, "4");
                        new Hi.BLL.YZT_Annex().Add(annexModel11, Tran);
                    }
                }
                if (ProvideData.IndexOf("2") > -1)
                {
                    //医疗器械经营许可证
                    Hi.Model.YZT_Annex annexModel2 = insertAnnex(id, 7, HidFfileName2, validDate2, UserID, "1");
                    count = new Hi.BLL.YZT_Annex().Add(annexModel2, Tran);

                    Hi.Model.YZT_Annex updateModel2 = UpFCmaterials(dt, 7, HidFfileName2, validDate2, UserID);
                    if (updateModel2 != null)
                    {
                        new Hi.BLL.YZT_Annex().Update(updateModel2, Tran);
                    }
                    else
                    {
                        Hi.Model.YZT_Annex annexModel11 = insertAnnex(fcmid, 7, HidFfileName2, validDate2, UserID, "4");
                        new Hi.BLL.YZT_Annex().Add(annexModel11, Tran);
                    }
                }
                if (ProvideData.IndexOf("3") > -1)
                {
                    //开户许可证
                    Hi.Model.YZT_Annex annexModel3 = insertAnnex(id, 9, HidFfileName3, validDate3, UserID, "1");
                    count = new Hi.BLL.YZT_Annex().Add(annexModel3, Tran);

                    Hi.Model.YZT_Annex updateModel3 = UpFCmaterials(dt, 9, HidFfileName3, validDate3, UserID);
                    if (updateModel3 != null)
                    {
                        new Hi.BLL.YZT_Annex().Update(updateModel3, Tran);
                    }
                    else
                    {
                        Hi.Model.YZT_Annex annexModel11 = insertAnnex(fcmid, 9, HidFfileName3, validDate3, UserID, "4");
                        new Hi.BLL.YZT_Annex().Add(annexModel11, Tran);
                    }
                }
                if (ProvideData.IndexOf("4") > -1)
                {
                    //医疗器械备案
                    Hi.Model.YZT_Annex annexModel4 = insertAnnex(id, 8, HidFfileName4, validDate4, UserID, "1");
                    count = new Hi.BLL.YZT_Annex().Add(annexModel4, Tran);

                    Hi.Model.YZT_Annex updateModel4 = UpFCmaterials(dt, 8, HidFfileName4, validDate4, UserID);
                    if (updateModel4 != null)
                    {
                        new Hi.BLL.YZT_Annex().Update(updateModel4, Tran);
                    }
                    else
                    {
                        Hi.Model.YZT_Annex annexModel11 = insertAnnex(fcmid, 8, HidFfileName4, validDate4, UserID, "4");
                        new Hi.BLL.YZT_Annex().Add(annexModel11, Tran);
                    }
                }
                if (count <= 0)
                {
                    Tran.Rollback();
                    Msg.code = "编辑异常!";
                    return(new JavaScriptSerializer().Serialize(Msg));
                }
                Tran.Commit();
                Msg.result = true;
            }
            else
            {
                Tran.Rollback();
                Msg.code = "编辑异常!";
            }
        }
        catch (Exception)
        {
            Msg.code = "编辑异常!";
            throw;
        }
        return(new JavaScriptSerializer().Serialize(Msg));
    }
Esempio n. 7
0
    public static string Edit(string KeyID, string UserID, string ForceDate, string InvalidDate, string HidFfileName1, string validDate1, string HidFfileName2, string validDate2, string HidFfileName3, string validDate3, string HidFfileName4, string validDate4, string ApplyRemark)
    {
        //
        Common.ResultMessage Msg = new Common.ResultMessage();

        Hi.Model.YZT_FirstCamp firstcamp = new Hi.BLL.YZT_FirstCamp().GetModel(KeyID.ToInt(0));

        string ProvideData = new Hi.BLL.YZT_CMerchants().GetModel(firstcamp.CMID).ProvideData;

        //首营信息
        string    sql = "select an.*,fc.ID from YZT_Annex an left join YZT_FCmaterials fc  on an.fcID =fc.ID and an.fileAlias in (4) and an.type in(5,7,8,9) where fc.DisID=" + firstcamp.DisID + " and ISNULL(fc.dr,0)=0 and fc.type=2 and ISNULL(an.dr,0)=0";
        DataTable dt  = SqlHelper.GetTable(SqlHelper.LocalSqlServer, sql);

        SqlTransaction Tran = null;

        try
        {
            Tran = DBUtility.SqlHelper.CreateStoreTranSaction();

            firstcamp.ForceDate   = ForceDate != "" ? Convert.ToDateTime(ForceDate) : DateTime.MinValue;
            firstcamp.InvalidDate = InvalidDate != "" ? Convert.ToDateTime(InvalidDate) : DateTime.MinValue;
            firstcamp.Applyremark = ApplyRemark;

            firstcamp.ts         = DateTime.Now;
            firstcamp.modifyuser = UserID.ToInt(0);

            bool id = new Hi.BLL.YZT_FirstCamp().Update(firstcamp, Tran);

            if (id)
            {
                string annexdel = " fileAlias=1 and type in(5,7,9,8) and fcID=" + KeyID;
                new Hi.BLL.YZT_Annex().AnnexDelete(annexdel, Tran);

                List <Hi.Model.YZT_FCmaterials> fcmlist = new Hi.BLL.YZT_FCmaterials().GetList("", " type=2 and DisID=" + firstcamp.DisID, "");
                int fcmid = 0;
                Hi.Model.YZT_FCmaterials fcmmodel = null;
                if (fcmlist != null && fcmlist.Count > 0)
                {
                    fcmmodel = fcmlist[0];
                    fcmid    = fcmmodel.ID;
                }
                else
                {
                    fcmmodel              = new Hi.Model.YZT_FCmaterials();
                    fcmmodel.CompID       = 0;
                    fcmmodel.DisID        = firstcamp.DisID;
                    fcmmodel.type         = 2;
                    fcmmodel.ts           = DateTime.Now;
                    fcmmodel.modifyuser   = UserID.ToInt(0);
                    fcmmodel.CreateUserID = UserID.ToInt(0);
                    fcmmodel.CreateDate   = DateTime.Now;
                    fcmmodel.dr           = 0;
                    fcmid = new Hi.BLL.YZT_FCmaterials().Add(fcmmodel, Tran);
                }

                bool count = id;
                if (ProvideData.IndexOf("1") > -1)
                {
                    //营业执照
                    Hi.Model.YZT_Annex annexModel1 = insertAnnex(KeyID.ToInt(0), 5, HidFfileName1, validDate1, UserID, "1");
                    count = new Hi.BLL.YZT_Annex().Add(annexModel1, Tran) > 0;

                    Hi.Model.YZT_Annex updateModel1 = UpFCmaterials(dt, 5, HidFfileName1, validDate1, UserID);
                    if (updateModel1 != null)
                    {
                        new Hi.BLL.YZT_Annex().Update(updateModel1, Tran);
                    }
                    else
                    {
                        Hi.Model.YZT_Annex annexModel11 = insertAnnex(fcmid, 5, HidFfileName1, validDate1, UserID, "4");
                        new Hi.BLL.YZT_Annex().Add(annexModel11, Tran);
                    }
                }
                if (ProvideData.IndexOf("2") > -1)
                {
                    //医疗器械经营许可证
                    Hi.Model.YZT_Annex annexModel2 = insertAnnex(KeyID.ToInt(0), 7, HidFfileName2, validDate2, UserID, "1");
                    count = new Hi.BLL.YZT_Annex().Add(annexModel2, Tran) > 0;

                    Hi.Model.YZT_Annex updateModel2 = UpFCmaterials(dt, 7, HidFfileName2, validDate2, UserID);
                    if (updateModel2 != null)
                    {
                        new Hi.BLL.YZT_Annex().Update(updateModel2, Tran);
                    }
                    else
                    {
                        Hi.Model.YZT_Annex annexModel11 = insertAnnex(fcmid, 7, HidFfileName2, validDate2, UserID, "4");
                        new Hi.BLL.YZT_Annex().Add(annexModel11, Tran);
                    }
                }
                if (ProvideData.IndexOf("3") > -1)
                {
                    //开户许可证
                    Hi.Model.YZT_Annex annexModel3 = insertAnnex(KeyID.ToInt(0), 9, HidFfileName3, validDate3, UserID, "1");
                    count = new Hi.BLL.YZT_Annex().Add(annexModel3, Tran) > 0;

                    Hi.Model.YZT_Annex updateModel3 = UpFCmaterials(dt, 9, HidFfileName3, validDate3, UserID);
                    if (updateModel3 != null)
                    {
                        new Hi.BLL.YZT_Annex().Update(updateModel3, Tran);
                    }
                    else
                    {
                        Hi.Model.YZT_Annex annexModel11 = insertAnnex(fcmid, 9, HidFfileName3, validDate3, UserID, "4");
                        new Hi.BLL.YZT_Annex().Add(annexModel11, Tran);
                    }
                }
                if (ProvideData.IndexOf("4") > -1)
                {
                    //医疗器械备案
                    Hi.Model.YZT_Annex annexModel4 = insertAnnex(KeyID.ToInt(0), 8, HidFfileName4, validDate4, UserID, "1");
                    count = new Hi.BLL.YZT_Annex().Add(annexModel4, Tran) > 0;

                    Hi.Model.YZT_Annex updateModel4 = UpFCmaterials(dt, 8, HidFfileName4, validDate4, UserID);
                    if (updateModel4 != null)
                    {
                        new Hi.BLL.YZT_Annex().Update(updateModel4, Tran);
                    }
                    else
                    {
                        Hi.Model.YZT_Annex annexModel11 = insertAnnex(fcmid, 8, HidFfileName4, validDate4, UserID, "4");
                        new Hi.BLL.YZT_Annex().Add(annexModel11, Tran);
                    }
                }
                if (count)
                {
                    Tran.Commit();
                    Msg.result = true;
                }
                else
                {
                    Tran.Rollback();
                    Msg.code = "编辑异常!";
                }
            }
            else
            {
                Tran.Rollback();
                Msg.code = "编辑异常!";
            }
        }
        catch (Exception)
        {
            Msg.code = "编辑异常!";
            throw;
        }
        return(new JavaScriptSerializer().Serialize(Msg));
    }
Esempio n. 8
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();
            }
        }
    }
Esempio n. 9
0
    public static string Edit(string KeyID, string Remark, string DisAreaID, string CompID, string UserID)
    {
        Common.ResultMessage   Msg     = new Common.ResultMessage();
        Hi.Model.YZT_FirstCamp fcmodel = new Hi.BLL.YZT_FirstCamp().GetModel(KeyID.ToInt(0));

        List <Hi.Model.YZT_Annex> annlist = new Hi.BLL.YZT_Annex().GetList("", " fcID=" + KeyID + " and type=2 and fileAlias='2' ", "");

        if (annlist != null && annlist.Count <= 0)
        {
            Msg.code = "请先上传授权书";
        }
        else
        {
            if (fcmodel != null)
            {
                //判断是否是该厂商的代理商
                List <Hi.Model.SYS_CompUser> compulist = new Hi.BLL.SYS_CompUser().GetList("", " UserID=" + fcmodel.CreateUserID + " and CompID=" + CompID + " and DisID=" + fcmodel.DisID + "", "");

                Hi.Model.BD_Company comp = new Hi.BLL.BD_Company().GetModel(CompID.ToInt(0));
                string compName          = comp == null ? "" : comp.CompName;

                SqlTransaction Tran = DBUtility.SqlHelper.CreateStoreTranSaction();

                fcmodel.AreaID = DisAreaID.ToInt(0);
                fcmodel.Remark = Remark;
                fcmodel.State  = 2;
                fcmodel.ts     = DateTime.Now;

                if (new Hi.BLL.YZT_FirstCamp().Update(fcmodel, Tran))
                {
                    if (compulist != null && compulist.Count <= 0)
                    {
                        Hi.Model.SYS_Users usersModel = new Hi.BLL.SYS_Users().GetModel(fcmodel.CreateUserID);
                        string             Phone      = usersModel == null ? "" : usersModel.Phone;
                        string             UserName   = usersModel == null ? "" : usersModel.UserName;

                        Hi.Model.SYS_CompUser compuser = new Hi.Model.SYS_CompUser();
                        compuser.UserID       = fcmodel.CreateUserID;
                        compuser.CompID       = CompID.ToInt(0);
                        compuser.DisID        = fcmodel.DisID;
                        compuser.AreaID       = DisAreaID.ToInt(0);
                        compuser.RoleID       = usersModel == null ? 0 : usersModel.RoleID;
                        compuser.CType        = 2;
                        compuser.UType        = 5;
                        compuser.IsAudit      = 2;
                        compuser.IsEnabled    = 1;
                        compuser.ts           = DateTime.Now;
                        compuser.CreateUserID = UserID.ToInt(0);
                        compuser.modifyuser   = UserID.ToInt(0);
                        compuser.CreateDate   = DateTime.Now;

                        if (new Hi.BLL.SYS_CompUser().Add(compuser, Tran) > 0)
                        {
                            Tran.Commit();
                            Msg.result = true;

                            GetPhoneCode pc = new GetPhoneCode();
                            pc.SendConfirm(Phone, compName, UserName);
                        }
                        else
                        {
                            Tran.Rollback();
                            Msg.code = "用户信息添加失败";
                        }
                    }
                    else
                    {
                        Hi.Model.SYS_CompUser compuser = compulist[0];
                        compuser.IsAudit    = 2;
                        compuser.AreaID     = DisAreaID.ToInt(0);
                        compuser.ts         = DateTime.Now;
                        compuser.modifyuser = UserID.ToInt(0);

                        if (new Hi.BLL.SYS_CompUser().Update(compuser, Tran))
                        {
                            Tran.Commit();
                            Msg.result = true;

                            Hi.Model.SYS_Users usersModel = new Hi.BLL.SYS_Users().GetModel(compulist[0].UserID);
                            string             Phone      = usersModel == null ? "" : usersModel.Phone;
                            string             UserName   = usersModel == null ? "" : usersModel.UserName;

                            GetPhoneCode pc = new GetPhoneCode();
                            pc.SendConfirm(Phone, compName, UserName);
                        }
                        else
                        {
                            Tran.Rollback();
                            Msg.code = "用户信息添加失败";
                        }
                    }
                }
                else
                {
                    Tran.Rollback();
                    Msg.code = "通过失败";
                }
            }
            else
            {
                Msg.code = "未查找到数据";
            }
        }
        return(new JavaScriptSerializer().Serialize(Msg));
    }