Beispiel #1
0
    /// <summary>
    /// 获取页面数据Model
    /// </summary>
    /// <returns></returns>
    private Hi.Model.YZT_FCmaterials getfCmaterialsModel(Hi.Model.YZT_FCmaterials fCmaterialsModel)
    {
        fCmaterialsModel.CompID     = CompID;
        fCmaterialsModel.DisID      = 0;
        fCmaterialsModel.type       = 1;
        fCmaterialsModel.Rise       = this.txtRise.Value.Trim();
        fCmaterialsModel.Content    = this.txtContent.Value.Trim();
        fCmaterialsModel.OBank      = this.txtOBank.Value.Trim();
        fCmaterialsModel.OAccount   = this.txtOAccount.Value.Trim();
        fCmaterialsModel.TRNumber   = this.txtTRNumber.Value.Trim();
        fCmaterialsModel.ts         = DateTime.Now;
        fCmaterialsModel.modifyuser = UserID;

        return(fCmaterialsModel);
    }
Beispiel #2
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(Hi.Model.YZT_FCmaterials model, System.Data.SqlClient.SqlTransaction Tran)
 {
     return(dal.Update(model, Tran));
 }
Beispiel #3
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int Add(Hi.Model.YZT_FCmaterials model, System.Data.SqlClient.SqlTransaction Tran)
 {
     return(dal.Add(model, Tran));
 }
Beispiel #4
0
    /// <summary>
    /// 确认按钮单击事件
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btnAdd_Click(object sender, EventArgs e)
    {
        string HidFfileNameNew = this.HidFfileName.Value.Trim();   //营业执照 附件名称
        string HidFfileNameOld = "";                               //营业执照 附件旧名称(更新后 需要删除的旧附件)

        string HidFfileNameNew2 = this.HidFfileName2.Value.Trim(); //生产许可证 附件名称
        string HidFfileNameOld2 = "";                              //生产许可证 附件旧名称(更新后 需要删除的旧附件)

        string HidFfileNameNew3 = this.HidFfileName3.Value.Trim(); // 附件名称
        string HidFfileNameOld3 = "";

        string HidFfileNameNew4 = this.HidFfileName4.Value.Trim();// 附件名称
        string HidFfileNameOld4 = "";

        string HidFfileNameNew5 = this.HidFfileName5.Value.Trim();// 附件名称
        string HidFfileNameOld5 = "";

        string HidFfileNameNew6 = this.HidFfileName6.Value.Trim();// 附件名称
        string HidFfileNameOld6 = "";

        string HidFfileNameNew7 = this.HidFfileName7.Value.Trim();// 附件名称
        string HidFfileNameOld7 = "";

        string HidFfileNameNew8 = this.HidFfileName8.Value.Trim();// 附件名称
        string HidFfileNameOld8 = "";

        string HidFfileNameNew9 = this.HidFfileName9.Value.Trim();// 附件名称
        string HidFfileNameOld9 = "";

        string HidFfileNameNew10 = this.HidFfileName10.Value.Trim();// 附件名称
        string HidFfileNameOld10 = "";


        Hi.Model.YZT_FCmaterials fCmaterialsModel = null;
        string         id   = Request.QueryString["id"];
        SqlTransaction Tran = null;

        try
        {
            Tran = DBUtility.SqlHelper.CreateStoreTranSaction();
            int fid = 0;
            //新增
            if (string.IsNullOrWhiteSpace(id))
            {
                fCmaterialsModel = new Hi.Model.YZT_FCmaterials();
                fCmaterialsModel = getfCmaterialsModel(fCmaterialsModel);
                fCmaterialsModel.CreateUserID = UserID;
                fCmaterialsModel.CreateDate   = DateTime.Now;
                fCmaterialsModel.dr           = 0;
                fid = new Hi.BLL.YZT_FCmaterials().Add(fCmaterialsModel, Tran);
                if (fid > 0)
                {
                    DateTime time  = DateTime.Now;
                    int      count = 0;
                    try
                    {
                        count = 1;
                        //新增营业执照附件表
                        if (!string.IsNullOrWhiteSpace(this.HidFfileName.Value.Trim()))
                        {
                            Hi.Model.YZT_Annex annexModel = insertAnnex(Convert.ToInt32(fid), 5, this.HidFfileName.Value.Trim(), this.validDate.Value.Trim());
                            count = new Hi.BLL.YZT_Annex().Add(annexModel, Tran);
                        }
                        if (!string.IsNullOrWhiteSpace(this.HidFfileName2.Value.Trim()))
                        {
                            //新增生产许可证表
                            Hi.Model.YZT_Annex annexModel2 = insertAnnex(Convert.ToInt32(fid), 6, this.HidFfileName2.Value.Trim(), this.validDate2.Value.Trim());
                            count = new Hi.BLL.YZT_Annex().Add(annexModel2, Tran);
                        }
                        if (!string.IsNullOrWhiteSpace(this.HidFfileName3.Value.Trim()))
                        {
                            //新增税务登记证
                            Hi.Model.YZT_Annex annexModel2 = insertAnnex(Convert.ToInt32(fid), 12, this.HidFfileName3.Value.Trim(), this.validDate3.Value.Trim());
                            count = new Hi.BLL.YZT_Annex().Add(annexModel2, Tran);
                        }
                        if (!string.IsNullOrWhiteSpace(this.HidFfileName4.Value.Trim()))
                        {
                            //新增开户银行许可证
                            Hi.Model.YZT_Annex annexModel2 = insertAnnex(Convert.ToInt32(fid), 13, this.HidFfileName4.Value.Trim(), this.validDate4.Value.Trim());
                            count = new Hi.BLL.YZT_Annex().Add(annexModel2, Tran);
                        }
                        if (!string.IsNullOrWhiteSpace(this.HidFfileName5.Value.Trim()))
                        {
                            //新增质量管理体系调查表
                            Hi.Model.YZT_Annex annexModel2 = insertAnnex(Convert.ToInt32(fid), 14, this.HidFfileName5.Value.Trim(), this.validDate5.Value.Trim());
                            count = new Hi.BLL.YZT_Annex().Add(annexModel2, Tran);
                        }
                        if (!string.IsNullOrWhiteSpace(this.HidFfileName6.Value.Trim()))
                        {
                            //新增GSP/GMP证书
                            Hi.Model.YZT_Annex annexModel2 = insertAnnex(Convert.ToInt32(fid), 15, this.HidFfileName6.Value.Trim(), this.validDate6.Value.Trim());
                            count = new Hi.BLL.YZT_Annex().Add(annexModel2, Tran);
                        }

                        if (!string.IsNullOrWhiteSpace(this.HidFfileName7.Value.Trim()))
                        {
                            //新增开票信息
                            Hi.Model.YZT_Annex annexModel2 = insertAnnex(Convert.ToInt32(fid), 16, this.HidFfileName7.Value.Trim(), this.validDate7.Value.Trim());
                            count = new Hi.BLL.YZT_Annex().Add(annexModel2, Tran);
                        }
                        if (!string.IsNullOrWhiteSpace(this.HidFfileName8.Value.Trim()))
                        {
                            //新增企业年报
                            Hi.Model.YZT_Annex annexModel2 = insertAnnex(Convert.ToInt32(fid), 17, this.HidFfileName8.Value.Trim(), this.validDate8.Value.Trim());
                            count = new Hi.BLL.YZT_Annex().Add(annexModel2, Tran);
                        }
                        if (!string.IsNullOrWhiteSpace(this.HidFfileName9.Value.Trim()))
                        {
                            //新增银行收付款帐号资料
                            Hi.Model.YZT_Annex annexModel2 = insertAnnex(Convert.ToInt32(fid), 18, this.HidFfileName9.Value.Trim(), this.validDate9.Value.Trim());
                            count = new Hi.BLL.YZT_Annex().Add(annexModel2, Tran);
                        }
                        if (!string.IsNullOrWhiteSpace(this.HidFfileName10.Value.Trim()))
                        {
                            //新增购销合同
                            Hi.Model.YZT_Annex annexModel2 = insertAnnex(Convert.ToInt32(fid), 19, this.HidFfileName10.Value.Trim(), this.validDate10.Value.Trim());
                            count = new Hi.BLL.YZT_Annex().Add(annexModel2, Tran);
                        }
                    }
                    catch (Exception)
                    {
                        count = 0;
                    }
                    if (count > 0)
                    {
                        Tran.Commit();
                        Response.Redirect("FCmaterialsInfo.aspx?id=" + fid, true);
                    }
                    else
                    {
                        throw new Exception("新增异常!");
                    }
                }
                else
                {
                    throw new Exception("新增异常!");
                }
            }
            else
            {
                //修改
                fCmaterialsModel = new Hi.BLL.YZT_FCmaterials().GetModel(Convert.ToInt32(id));
                fCmaterialsModel = getfCmaterialsModel(fCmaterialsModel);
                if (new Hi.BLL.YZT_FCmaterials().Update(fCmaterialsModel, Tran))
                {
                    DateTime time = DateTime.Now;
                    List <Hi.Model.YZT_Annex> annexList = new Hi.BLL.YZT_Annex().GetList("", " fcID=" + id + " and dr=0", "");
                    foreach (Hi.Model.YZT_Annex item in annexList)
                    {
                        item.ts         = time;
                        item.modifyuser = UserID;
                        if (item.type == 5)
                        {
                            //营业执照修改
                            HidFfileNameOld = item.fileName;
                            item.fileName   = HidFfileNameNew;
                            if (!string.IsNullOrWhiteSpace(this.validDate.Value.Trim()))
                            {
                                item.validDate = Convert.ToDateTime(this.validDate.Value.Trim());
                            }
                        }
                        else if (item.type == 6)
                        {
                            //生产许可证修改
                            HidFfileNameOld2 = item.fileName;
                            item.fileName    = HidFfileNameNew2;
                            if (!string.IsNullOrWhiteSpace(this.validDate2.Value.Trim()))
                            {
                                item.validDate = Convert.ToDateTime(this.validDate2.Value.Trim());
                            }
                        }
                        else if (item.type == 12)
                        {
                            //税务登记证修改
                            HidFfileNameOld3 = item.fileName;
                            item.fileName    = HidFfileNameNew3;
                            if (!string.IsNullOrWhiteSpace(this.validDate3.Value.Trim()))
                            {
                                item.validDate = Convert.ToDateTime(this.validDate3.Value.Trim());
                            }
                        }
                        else if (item.type == 13)
                        {
                            //开户银行许可证修改
                            HidFfileNameOld4 = item.fileName;
                            item.fileName    = HidFfileNameNew4;
                            if (!string.IsNullOrWhiteSpace(this.validDate4.Value.Trim()))
                            {
                                item.validDate = Convert.ToDateTime(this.validDate4.Value.Trim());
                            }
                        }
                        else if (item.type == 14)
                        {
                            //质量管理体系调查表修改
                            HidFfileNameOld5 = item.fileName;
                            item.fileName    = HidFfileNameNew5;
                            if (!string.IsNullOrWhiteSpace(this.validDate5.Value.Trim()))
                            {
                                item.validDate = Convert.ToDateTime(this.validDate5.Value.Trim());
                            }
                        }
                        else if (item.type == 15)
                        {
                            //GSP/GMP证书修改
                            HidFfileNameOld6 = item.fileName;
                            item.fileName    = HidFfileNameNew6;
                            if (!string.IsNullOrWhiteSpace(this.validDate6.Value.Trim()))
                            {
                                item.validDate = Convert.ToDateTime(this.validDate6.Value.Trim());
                            }
                        }
                        else if (item.type == 16)
                        {
                            //开票信息修改
                            HidFfileNameOld7 = item.fileName;
                            item.fileName    = HidFfileNameNew7;
                            if (!string.IsNullOrWhiteSpace(this.validDate7.Value.Trim()))
                            {
                                item.validDate = Convert.ToDateTime(this.validDate7.Value.Trim());
                            }
                        }
                        else if (item.type == 17)
                        {
                            //企业年报修改
                            HidFfileNameOld8 = item.fileName;
                            item.fileName    = HidFfileNameNew8;
                            if (!string.IsNullOrWhiteSpace(this.validDate8.Value.Trim()))
                            {
                                item.validDate = Convert.ToDateTime(this.validDate8.Value.Trim());
                            }
                        }
                        else if (item.type == 18)
                        {
                            //银行收付款帐号资料修改
                            HidFfileNameOld9 = item.fileName;
                            item.fileName    = HidFfileNameNew9;
                            if (!string.IsNullOrWhiteSpace(this.validDate9.Value.Trim()))
                            {
                                item.validDate = Convert.ToDateTime(this.validDate9.Value.Trim());
                            }
                        }
                        else if (item.type == 19)
                        {
                            //购销合同修改
                            HidFfileNameOld10 = item.fileName;
                            item.fileName     = HidFfileNameNew10;
                            if (!string.IsNullOrWhiteSpace(this.validDate10.Value.Trim()))
                            {
                                item.validDate = Convert.ToDateTime(this.validDate10.Value.Trim());
                            }
                        }

                        if (!new Hi.BLL.YZT_Annex().Update(item, Tran))
                        {
                            break;
                            throw new Exception("修改异常!");
                        }
                    }


                    List <Hi.Model.YZT_Annex> annex1 = annexList.Where(a => a.type == 5).ToList();
                    if (annex1.Count <= 0 && !string.IsNullOrWhiteSpace(this.HidFfileName.Value.Trim()))
                    {
                        //新增营业执照附件表
                        Hi.Model.YZT_Annex annexModel = insertAnnex(Convert.ToInt32(id), 5, this.HidFfileName.Value.Trim(), this.validDate.Value.Trim());
                        int count = new Hi.BLL.YZT_Annex().Add(annexModel, Tran);
                    }

                    List <Hi.Model.YZT_Annex> annex2 = annexList.Where(a => a.type == 6).ToList();
                    if (annex2.Count <= 0 && !string.IsNullOrWhiteSpace(this.HidFfileName2.Value.Trim()))
                    {
                        //新增生产许可证表
                        Hi.Model.YZT_Annex annexModel2 = insertAnnex(Convert.ToInt32(id), 6, this.HidFfileName2.Value.Trim(), this.validDate2.Value.Trim());
                        int count = new Hi.BLL.YZT_Annex().Add(annexModel2, Tran);
                    }

                    List <Hi.Model.YZT_Annex> annex3 = annexList.Where(a => a.type == 12).ToList();
                    if (annex3.Count <= 0 && !string.IsNullOrWhiteSpace(this.HidFfileName3.Value.Trim()))
                    {
                        Hi.Model.YZT_Annex annexModel2 = insertAnnex(Convert.ToInt32(id), 12, this.HidFfileName3.Value.Trim(), this.validDate3.Value.Trim());
                        int count = new Hi.BLL.YZT_Annex().Add(annexModel2, Tran);
                    }

                    List <Hi.Model.YZT_Annex> annex4 = annexList.Where(a => a.type == 13).ToList();
                    if (annex4.Count <= 0 && !string.IsNullOrWhiteSpace(this.HidFfileName4.Value.Trim()))
                    {
                        Hi.Model.YZT_Annex annexModel2 = insertAnnex(Convert.ToInt32(id), 13, this.HidFfileName4.Value.Trim(), this.validDate4.Value.Trim());
                        int count = new Hi.BLL.YZT_Annex().Add(annexModel2, Tran);
                    }

                    List <Hi.Model.YZT_Annex> annex5 = annexList.Where(a => a.type == 14).ToList();
                    if (annex5.Count <= 0 && !string.IsNullOrWhiteSpace(this.HidFfileName5.Value.Trim()))
                    {
                        Hi.Model.YZT_Annex annexModel2 = insertAnnex(Convert.ToInt32(id), 14, this.HidFfileName5.Value.Trim(), this.validDate5.Value.Trim());
                        int count = new Hi.BLL.YZT_Annex().Add(annexModel2, Tran);
                    }

                    List <Hi.Model.YZT_Annex> annex6 = annexList.Where(a => a.type == 15).ToList();
                    if (annex6.Count <= 0 && !string.IsNullOrWhiteSpace(this.HidFfileName6.Value.Trim()))
                    {
                        Hi.Model.YZT_Annex annexModel2 = insertAnnex(Convert.ToInt32(id), 15, this.HidFfileName6.Value.Trim(), this.validDate6.Value.Trim());
                        int count = new Hi.BLL.YZT_Annex().Add(annexModel2, Tran);
                    }

                    List <Hi.Model.YZT_Annex> annex7 = annexList.Where(a => a.type == 16).ToList();
                    if (annex7.Count <= 0 && !string.IsNullOrWhiteSpace(this.HidFfileName7.Value.Trim()))
                    {
                        Hi.Model.YZT_Annex annexModel2 = insertAnnex(Convert.ToInt32(id), 16, this.HidFfileName7.Value.Trim(), this.validDate7.Value.Trim());
                        int count = new Hi.BLL.YZT_Annex().Add(annexModel2, Tran);
                    }

                    List <Hi.Model.YZT_Annex> annex8 = annexList.Where(a => a.type == 17).ToList();
                    if (annex8.Count <= 0 && !string.IsNullOrWhiteSpace(this.HidFfileName8.Value.Trim()))
                    {
                        Hi.Model.YZT_Annex annexModel2 = insertAnnex(Convert.ToInt32(id), 17, this.HidFfileName8.Value.Trim(), this.validDate8.Value.Trim());
                        int count = new Hi.BLL.YZT_Annex().Add(annexModel2, Tran);
                    }

                    List <Hi.Model.YZT_Annex> annex9 = annexList.Where(a => a.type == 18).ToList();
                    if (annex9.Count <= 0 && !string.IsNullOrWhiteSpace(this.HidFfileName9.Value.Trim()))
                    {
                        Hi.Model.YZT_Annex annexModel2 = insertAnnex(Convert.ToInt32(id), 18, this.HidFfileName9.Value.Trim(), this.validDate9.Value.Trim());
                        int count = new Hi.BLL.YZT_Annex().Add(annexModel2, Tran);
                    }

                    List <Hi.Model.YZT_Annex> annex10 = annexList.Where(a => a.type == 19).ToList();
                    if (annex10.Count <= 0 && !string.IsNullOrWhiteSpace(this.HidFfileName10.Value.Trim()))
                    {
                        Hi.Model.YZT_Annex annexModel2 = insertAnnex(Convert.ToInt32(id), 19, this.HidFfileName10.Value.Trim(), this.validDate10.Value.Trim());
                        int count = new Hi.BLL.YZT_Annex().Add(annexModel2, Tran);
                    }

                    //删除旧的营业执照附件
                    if (HidFfileNameOld != HidFfileNameNew)
                    {
                        FileInfo file = new FileInfo(HttpContext.Current.Server.MapPath("../../UploadFile/") + HidFfileNameOld);
                        if (file.Exists)
                        {
                            file.Delete();
                        }
                    }
                    //删除旧的生产许可证 附加
                    if (HidFfileNameOld2 != HidFfileNameNew2)
                    {
                        FileInfo file = new FileInfo(HttpContext.Current.Server.MapPath("../../UploadFile/") + HidFfileNameOld2);
                        if (file.Exists)
                        {
                            file.Delete();
                        }
                    }
                    if (HidFfileNameOld3 != HidFfileNameNew3)
                    {
                        FileInfo file = new FileInfo(HttpContext.Current.Server.MapPath("../../UploadFile/") + HidFfileNameOld3);
                        if (file.Exists)
                        {
                            file.Delete();
                        }
                    }
                    if (HidFfileNameOld4 != HidFfileNameNew4)
                    {
                        FileInfo file = new FileInfo(HttpContext.Current.Server.MapPath("../../UploadFile/") + HidFfileNameOld4);
                        if (file.Exists)
                        {
                            file.Delete();
                        }
                    }
                    if (HidFfileNameOld5 != HidFfileNameNew5)
                    {
                        FileInfo file = new FileInfo(HttpContext.Current.Server.MapPath("../../UploadFile/") + HidFfileNameOld5);
                        if (file.Exists)
                        {
                            file.Delete();
                        }
                    }
                    if (HidFfileNameOld6 != HidFfileNameNew6)
                    {
                        FileInfo file = new FileInfo(HttpContext.Current.Server.MapPath("../../UploadFile/") + HidFfileNameOld6);
                        if (file.Exists)
                        {
                            file.Delete();
                        }
                    }
                    if (HidFfileNameOld7 != HidFfileNameNew7)
                    {
                        FileInfo file = new FileInfo(HttpContext.Current.Server.MapPath("../../UploadFile/") + HidFfileNameOld7);
                        if (file.Exists)
                        {
                            file.Delete();
                        }
                    }
                    if (HidFfileNameOld8 != HidFfileNameNew8)
                    {
                        FileInfo file = new FileInfo(HttpContext.Current.Server.MapPath("../../UploadFile/") + HidFfileNameOld8);
                        if (file.Exists)
                        {
                            file.Delete();
                        }
                    }
                    if (HidFfileNameOld9 != HidFfileNameNew9)
                    {
                        FileInfo file = new FileInfo(HttpContext.Current.Server.MapPath("../../UploadFile/") + HidFfileNameOld9);
                        if (file.Exists)
                        {
                            file.Delete();
                        }
                    }
                    if (HidFfileNameOld10 != HidFfileNameNew10)
                    {
                        FileInfo file = new FileInfo(HttpContext.Current.Server.MapPath("../../UploadFile/") + HidFfileNameOld10);
                        if (file.Exists)
                        {
                            file.Delete();
                        }
                    }

                    Tran.Commit();
                    Response.Redirect("FCmaterialsInfo.aspx?id=" + id, true);
                }
                else
                {
                    throw new Exception("修改异常!");
                }
            }
        }
        catch (Exception ex)
        {
            if (Tran != null)
            {
                if (Tran.Connection != null)
                {
                    Tran.Rollback();
                }
            }
            JScript.AlertMethod(this, ex.Message, JScript.IconOption.错误, "function (){ window.location.href=window.location.href; }");
        }
        finally
        {
            DBUtility.SqlHelper.ConnectionClose();
        }
    }
Beispiel #5
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));
    }
Beispiel #6
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));
    }
Beispiel #7
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(Hi.Model.YZT_FCmaterials model)
 {
     return(dal.Update(model));
 }
Beispiel #8
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int Add(Hi.Model.YZT_FCmaterials model)
 {
     return(dal.Add(model));
 }
Beispiel #9
0
    /// <summary>
    /// 页面数据绑定
    /// </summary>
    public void bind()
    {
        List <Hi.Model.YZT_FCmaterials> fCmaterialsList = new Hi.BLL.YZT_FCmaterials().GetList("", " CompID =" + CompID + " and dr=0 ", "");

        if (fCmaterialsList.Count > 0)
        {
            //修改
            Hi.Model.YZT_FCmaterials fCmaterialsModel = fCmaterialsList[0];
            fid = fCmaterialsModel.ID;
            this.txtRise.Value     = fCmaterialsModel.Rise;
            this.txtContent.Value  = fCmaterialsModel.Content;
            this.txtOBank.Value    = fCmaterialsModel.OBank;
            this.txtOAccount.Value = fCmaterialsModel.OAccount;
            this.txtTRNumber.Value = fCmaterialsModel.TRNumber;
            List <Hi.Model.YZT_Annex> annexList = new Hi.BLL.YZT_Annex().GetList("", " fcID=" + fCmaterialsModel.ID + " and dr=0 and fileAlias='4'", "");
            foreach (Hi.Model.YZT_Annex item in annexList)
            {
                if (item.type == 5)
                {
                    if (!string.IsNullOrWhiteSpace(item.fileName))
                    {
                        //营业执照绑定
                        this.HidFfileName.InnerHtml = item.fileName;
                        this.validDate.Value        = item.validDate.ToString("yyyy/MM/dd");
                    }
                }
                else if (item.type == 6)
                {
                    if (!string.IsNullOrWhiteSpace(item.fileName))
                    {
                        //生产许可证绑定
                        this.HidFfileName2.InnerHtml = item.fileName;
                        this.validDate2.Value        = item.validDate.ToString("yyyy/MM/dd");
                    }
                }
                else if (item.type == 12)
                {
                    if (!string.IsNullOrWhiteSpace(item.fileName))
                    {
                        this.HidFfileName3.InnerHtml = item.fileName;
                        this.validDate3.Value        = item.validDate.ToString("yyyy/MM/dd");
                    }
                }
                else if (item.type == 13)
                {
                    if (!string.IsNullOrWhiteSpace(item.fileName))
                    {
                        this.HidFfileName4.InnerHtml = item.fileName;
                        this.validDate4.Value        = item.validDate.ToString("yyyy/MM/dd");
                    }
                }
                else if (item.type == 14)
                {
                    if (!string.IsNullOrWhiteSpace(item.fileName))
                    {
                        this.HidFfileName5.InnerHtml = item.fileName;
                        this.validDate5.Value        = item.validDate.ToString("yyyy/MM/dd");
                    }
                }
                else if (item.type == 15)
                {
                    if (!string.IsNullOrWhiteSpace(item.fileName))
                    {
                        this.HidFfileName6.InnerHtml = item.fileName;
                        this.validDate6.Value        = item.validDate.ToString("yyyy/MM/dd");
                    }
                }
                else if (item.type == 16)
                {
                    if (!string.IsNullOrWhiteSpace(item.fileName))
                    {
                        this.HidFfileName7.InnerHtml = item.fileName;
                        this.validDate7.Value        = item.validDate.ToString("yyyy/MM/dd");
                    }
                }
                else if (item.type == 17)
                {
                    if (!string.IsNullOrWhiteSpace(item.fileName))
                    {
                        this.HidFfileName8.InnerHtml = item.fileName;
                        this.validDate8.Value        = item.validDate.ToString("yyyy/MM/dd");
                    }
                }
                else if (item.type == 18)
                {
                    if (!string.IsNullOrWhiteSpace(item.fileName))
                    {
                        this.HidFfileName9.InnerHtml = item.fileName;
                        this.validDate9.Value        = item.validDate.ToString("yyyy/MM/dd");
                    }
                }
                else if (item.type == 19)
                {
                    if (!string.IsNullOrWhiteSpace(item.fileName))
                    {
                        this.HidFfileName10.InnerHtml = item.fileName;
                        this.validDate10.Value        = item.validDate.ToString("yyyy/MM/dd");
                    }
                }
            }
        }
        else
        {
            fid = 0;
        }
    }