Esempio n. 1
0
    public static string Edit(string KeyID, string bill, string IsBill)
    {
        Common.ResultMessage Msg = new Common.ResultMessage();
        KeyID = Common.DesDecrypt(KeyID, Common.EncryptKey);
        List <Hi.Model.DIS_OrderExt> oextl = new Hi.BLL.DIS_OrderExt().GetList("", "OrderID=" + KeyID, "");

        if (oextl != null && oextl.Count > 0)
        {
            //if (oextl[0].IsBill == 0)
            //{
            oextl[0].BillNo = bill;
            oextl[0].IsBill = IsBill.ToInt(0);
            if (new Hi.BLL.DIS_OrderExt().Update(oextl[0]))
            {
                Msg.result = true;
            }
            //}
            //else
            //{
            //    Msg.code = "发票已开完";
            //}
        }
        else
        {
            Msg.code = "未查找到数据";
        }
        return(new JavaScriptSerializer().Serialize(Msg));
    }
Esempio n. 2
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. 3
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. 4
0
    public static string QrFC(string cmID, string compID, string htid)
    {
        Common.ResultMessage Msg = new Common.ResultMessage();
        string sql = "select * from YZT_FirstCamp fc where isnull(fc.dr,0)=0 and fc.State=2 and fc.CMID=" + cmID + " and HtID=" + htid + " and fc.CompID=" + compID;

        DataTable htDt = SqlHelper.Query(SqlHelper.LocalSqlServer, sql).Tables[0];

        if (htDt != null && htDt.Rows.Count <= 0)
        {
            Msg.result = true;
        }
        else
        {
            Msg.code = "此医院已存在通过的代理商,是否确定处理!";
        }
        return(new JavaScriptSerializer().Serialize(Msg));
    }
Esempio n. 5
0
    public static string Edit(string KeyID, string type, string remark)
    {
        remark = Common.NoHTML(remark);
        Common.ResultMessage Msg = new Common.ResultMessage();

        if (type == "0")
        {
            Hi.BLL.DIS_Order OrderBll = new Hi.BLL.DIS_Order();
            int oID = Common.DesDecrypt(KeyID, Common.EncryptKey).ToInt(0);
            Hi.Model.DIS_Order OrderModel = OrderBll.GetModel(oID);
            if (OrderModel != null)
            {
                OrderModel.Remark = Common.NoHTML(remark);
                OrderModel.ts     = DateTime.Now;
                if (OrderBll.Update(OrderModel))
                {
                    Msg.result = true;
                    Msg.code   = OrderModel.ts.ToString("yyyy-MM-dd HH:mm");
                }
            }
            else
            {
                Msg.code = "未查找到数据";
            }
        }
        else if (type == "1")
        {
            Hi.BLL.DIS_OrderDetail   OrderBllDetail   = new Hi.BLL.DIS_OrderDetail();
            Hi.Model.DIS_OrderDetail OrderModelDetail = OrderBllDetail.GetModel(KeyID.ToInt(0));
            if (OrderModelDetail != null)
            {
                OrderModelDetail.Remark = Common.NoHTML(remark);
                OrderModelDetail.ts     = DateTime.Now;
                if (OrderBllDetail.Update(OrderModelDetail))
                {
                    Msg.result = true;
                }
            }
        }
        else
        {
            Msg.result = true;
        }
        return(new JavaScriptSerializer().Serialize(Msg));
    }
Esempio n. 6
0
    public static string Edit(string KeyID, string type, string tip)
    {
        Common.ResultMessage Msg        = new Common.ResultMessage();
        Hi.BLL.DIS_Order     OrderBll   = new Hi.BLL.DIS_Order();
        Hi.Model.DIS_Order   OrderModel = OrderBll.GetModel(Common.DesDecrypt(KeyID, Common.EncryptKey).ToInt(0));
        if (OrderModel != null)
        {
            if (OrderModel.OState == -1 || OrderModel.OState == 0 || OrderModel.OState == 1 || OrderModel.OState == 2)
            {
                if (type == "0")
                {
                    if (tip != "")
                    {
                        OrderModel.ArriveDate = tip.ToDateTime();
                    }
                    else
                    {
                        OrderModel.ArriveDate = DateTime.MinValue;
                    }
                    OrderModel.ts = DateTime.Now;
                    if (OrderBll.Update(OrderModel))
                    {
                        Msg.result = true;
                    }
                }

                else
                {
                    OrderModel.GiveMode = tip;
                    OrderModel.ts       = DateTime.Now;
                    if (OrderBll.Update(OrderModel))
                    {
                        Msg.result = true;
                    }
                }
            }
        }
        else
        {
            Msg.code = "未查找到数据";
        }
        return(new JavaScriptSerializer().Serialize(Msg));
    }
Esempio n. 7
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. 8
0
    public static string Edit(string KeyID, string logistics, string logisticsNo, string carUser, string carNo, string car)
    {
        logistics   = Common.NoHTML(logistics);
        logisticsNo = Common.NoHTML(logisticsNo);
        carUser     = Common.NoHTML(carUser);
        carNo       = Common.NoHTML(carNo);
        car         = Common.NoHTML(car);
        Common.ResultMessage Msg = new Common.ResultMessage();
        Hi.BLL.DIS_Logistics OrderBllLogistics = new Hi.BLL.DIS_Logistics();
        KeyID = Common.DesDecrypt(KeyID, Common.EncryptKey);

        List <Hi.Model.DIS_Logistics> logist = new Hi.BLL.DIS_Logistics().GetList("*", "  Isnull(dr,0)=0 and OrderOutID=" + KeyID, "");

        //Hi.Model.DIS_Logistics OrderModelLogistics = logist;
        if (KeyID != null)
        {
            if (logist != null)
            {
                logist[0].ComPName    = logistics;
                logist[0].LogisticsNo = logisticsNo;


                if (logistics != "" && logisticsNo != "")
                {
                    string ApiKey  = "4088ed72ed034b61b4b5adf05870aeba";
                    string typeCom = logistics;
                    typeCom = Information.TypeCom(typeCom);
                    string       nu       = logisticsNo;
                    string       apiurl   = "http://www.aikuaidi.cn/rest/?key=" + ApiKey + "&order=" + nu + "&id=" + typeCom + "&ord=asc&show=json";
                    WebRequest   request  = WebRequest.Create(@apiurl);
                    WebResponse  response = request.GetResponse();
                    Stream       stream   = response.GetResponseStream();
                    Encoding     encode   = Encoding.UTF8;
                    StreamReader reader   = new StreamReader(stream, encode);
                    string       detail   = reader.ReadToEnd();
                    Logistics    logis    = JsonConvert.DeserializeObject <Logistics>(detail);
                    if (logis.errCode == "0")
                    {
                        List <Information> information = logis.data;
                        logist[0].Context = JsonConvert.SerializeObject(information);
                    }
                    else
                    {
                        logist[0].Context = "";
                    }
                }

                logist[0].CarUser = carUser;
                logist[0].CarNo   = carNo;
                logist[0].Car     = car;
                logist[0].ts      = DateTime.Now;
                if (OrderBllLogistics.Update(logist[0]))
                {
                    Msg.result = true;
                }
            }
        }
        else
        {
            Msg.code = "未查找到数据";
        }
        return(new JavaScriptSerializer().Serialize(Msg));
    }
Esempio n. 9
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. 10
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));
    }