Esempio n. 1
0
    /// <summary>
    /// 附件绑定
    /// </summary>
    public void DataBindLink()
    {
        List <Hi.Model.YZT_FCmaterials> fCmaterialsList = new Hi.BLL.YZT_FCmaterials().GetList("", " CompID =" + CompID + " and dr=0 ", "");

        if (fCmaterialsList.Count > 0)
        {
            List <Hi.Model.YZT_Annex> annexList = new Hi.BLL.YZT_Annex().GetList("", " fcID=" + fCmaterialsList[0].ID + " and dr=0 and fileAlias='4'", "");
            foreach (Hi.Model.YZT_Annex item in annexList)
            {
                if (!string.IsNullOrEmpty(item.fileName))
                {
                    LinkButton linkFile = new LinkButton();
                    linkFile.Click += new EventHandler(Download_Click);

                    if (item.fileName.LastIndexOf("_") != -1)
                    {
                        string text = item.fileName.Substring(0, item.fileName.LastIndexOf("_")) + Path.GetExtension(item.fileName);
                        if (text.Length < 15)
                        {
                            linkFile.Text = text;
                        }
                        else
                        {
                            linkFile.Text = text.Substring(0, 15) + "...";
                        }
                        linkFile.Attributes.Add("title", text);
                    }
                    else
                    {
                        string text = item.fileName.Substring(0, item.fileName.LastIndexOf("-")) + Path.GetExtension(item.fileName);
                        if (text.Length < 15)
                        {
                            linkFile.Text = text;
                        }
                        else
                        {
                            linkFile.Text = text.Substring(0, 15) + "...";
                        }
                        linkFile.Attributes.Add("title", text);
                    }
                    linkFile.Style.Add("text-decoration", "underline");
                    linkFile.Attributes.Add("fileName", item.fileName);
                    HtmlGenericControl div = new HtmlGenericControl("div");
                    div.Controls.Add(linkFile);
                    if (item.type == 5)
                    {
                    }
                    else
                    {
                    }
                }
            }
        }
    }
Esempio n. 2
0
    /// <summary>
    /// 页面数据绑定
    /// </summary>
    public void bind()
    {
        string fid = Request.QueryString["id"];

        if (!string.IsNullOrWhiteSpace(fid))
        {
            DataTable fCmaterialsModel = new Hi.BLL.YZT_FCmaterials().getDataModel(fid);
            if (fCmaterialsModel.Rows.Count > 0)
            {
                this.txtDisCode.Value = fCmaterialsModel.Rows[0]["DisCode"].ToString();
                this.txtDisName.Value = fCmaterialsModel.Rows[0]["DisName"].ToString();
            }
        }
    }
Esempio n. 3
0
    /// <summary>
    /// 数据绑定
    /// </summary>
    public void DataBinds()
    {
        int    pageCount = 0;
        int    Counts    = 0;
        string disName   = this.txtDisName.Value.Trim();

        Pager.PageSize = txtPageSize.Value.ToInt(0);

        DataTable dt = new Hi.BLL.YZT_FCmaterials().getDataTable(Pager.PageSize, Pager.CurrentPageIndex, CompID.ToString(), disName, out pageCount, out Counts);

        this.Rpt_Distribute.DataSource = dt;
        this.Rpt_Distribute.DataBind();
        Pager.RecordCount = dt.Rows.Count;
        page = Pager.CurrentPageIndex.ToString();
    }
Esempio n. 4
0
    /// <summary>
    /// 绑定
    /// </summary>
    public void Bind()
    {
        int    pageCount = 0;
        int    Counts    = 0;
        string strWhere  = string.Empty;

        if (!string.IsNullOrWhiteSpace(this.textName.Value.Trim()))
        {
            strWhere += string.Format(" and CompName like '%{0}%'  ", this.textName.Value.Trim());
        }

        Pager.PageSize = this.txtPager.Value.ToInt(0);

        DataTable table = new Hi.BLL.YZT_FCmaterials().getCompDataTable(Pager.PageSize, Pager.CurrentPageIndex, DisID.ToString(), strWhere, out pageCount, out Counts);

        this.rptOrder.DataSource = table;
        this.rptOrder.DataBind();

        Pager.RecordCount = Counts;
        page = Pager.CurrentPageIndex.ToString();
    }
Esempio n. 5
0
    public void databind()
    {
        if (!string.IsNullOrEmpty(Request["DisID"]))
        {
            DisID = (Request["DisID"] + "").ToInt(0);
        }

        hidDisID.Value = DisID.ToString();

        if ((Request["val"] + "") != "0")
        {
            int val = Request["val"].ToString().ToInt(0);

            if (val == 0)
            {
                this.checkbox_2_1.Checked = true;
            }
            else if (val == 1)
            {
                this.checkbox_2_2.Checked = true;
            }
            else if (val == 2)
            {
                this.checkbox_2_3.Checked = true;
            }

            this.txtLookUp.Value  = Common.NoHTML(Request["Rise"].ToString());
            this.txtContext.Value = Common.NoHTML(Request["Context"].ToString());
            this.txtBank.Value    = Common.NoHTML(Request["Bank"].ToString());
            this.txtAccount.Value = Common.NoHTML(Request["Account"].ToString());
            this.txtRegNo.Value   = Common.NoHTML(Request["RegNo"].ToString());
        }
        else
        {
            //List<Hi.Model.BD_DisAccount> l = new Hi.BLL.BD_DisAccount().GetList("", " DisID=" + DisID + "and isnull(dr,0)=0", "");
            List <Hi.Model.YZT_FCmaterials> fCmaterialsList = new Hi.BLL.YZT_FCmaterials().GetList("", " DisID =" + DisID + " and dr=0 ", "");

            this.checkbox_2_1.Checked = true;

            if (fCmaterialsList != null && fCmaterialsList.Count > 0)
            {
                //hidDisAccID.Value = Common.NoHTML(l[0].ID.ToString());
                txtLookUp.Value  = Common.NoHTML(fCmaterialsList[0].Rise.ToString());
                txtContext.Value = Common.NoHTML(fCmaterialsList[0].Content.ToString());

                DataTable dt = new Hi.BLL.PAY_PrePayment().GetDate("BankCode ,BankName", "PAY_BankInfo", "BankCode=" + fCmaterialsList[0].OBank);
                if (dt.Rows.Count > 0)
                {
                    txtBank.Value = Common.NoHTML(dt.Rows[0]["BankName"].ToString());
                }

                txtAccount.Value = Common.NoHTML(fCmaterialsList[0].OAccount.ToString());
                txtRegNo.Value   = Common.NoHTML(fCmaterialsList[0].TRNumber.ToString());
            }
            else
            {
                Hi.Model.BD_Distributor disModel = new Hi.BLL.BD_Distributor().GetModel(DisID);

                txtLookUp.Value  = disModel.DisName;
                txtContext.Value = "商品明细";
            }
        }
    }
Esempio n. 6
0
    /// <summary>
    /// 页面数据绑定
    /// </summary>
    public void bind()
    {
        string id = Request.QueryString["id"];

        if (!string.IsNullOrWhiteSpace(id))
        {
            //修改
            Hi.Model.YZT_FCmaterials fCmaterialsModel = new Hi.BLL.YZT_FCmaterials().GetModel(Convert.ToInt32(id));
            if (fCmaterialsModel != null)
            {
                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=" + id + " and dr=0 and fileAlias='4'", "");
                foreach (Hi.Model.YZT_Annex item in annexList)
                {
                    if (item.type == 5)
                    {
                        //营业执照绑定
                        this.HidFfileName.Value = item.fileName;
                        this.validDate.Value    = item.validDate.ToString("yyyy/MM/dd");
                    }
                    else if (item.type == 6)
                    {
                        //生产许可证绑定
                        this.HidFfileName2.Value = item.fileName;
                        this.validDate2.Value    = item.validDate.ToString("yyyy/MM/dd");
                    }
                    else if (item.type == 12)
                    {
                        this.HidFfileName3.Value = item.fileName;
                        this.validDate3.Value    = item.validDate.ToString("yyyy/MM/dd");
                    }
                    else if (item.type == 13)
                    {
                        this.HidFfileName4.Value = item.fileName;
                        this.validDate4.Value    = item.validDate.ToString("yyyy/MM/dd");
                    }
                    else if (item.type == 14)
                    {
                        this.HidFfileName5.Value = item.fileName;
                        this.validDate5.Value    = item.validDate.ToString("yyyy/MM/dd");
                    }
                    else if (item.type == 15)
                    {
                        this.HidFfileName6.Value = item.fileName;
                        this.validDate6.Value    = item.validDate.ToString("yyyy/MM/dd");
                    }
                    else if (item.type == 16)
                    {
                        this.HidFfileName7.Value = item.fileName;
                        this.validDate7.Value    = item.validDate.ToString("yyyy/MM/dd");
                    }
                    else if (item.type == 17)
                    {
                        this.HidFfileName8.Value = item.fileName;
                        this.validDate8.Value    = item.validDate.ToString("yyyy/MM/dd");
                    }
                    else if (item.type == 18)
                    {
                        this.HidFfileName9.Value = item.fileName;
                        this.validDate9.Value    = item.validDate.ToString("yyyy/MM/dd");
                    }
                    else if (item.type == 19)
                    {
                        this.HidFfileName10.Value = item.fileName;
                        this.validDate10.Value    = item.validDate.ToString("yyyy/MM/dd");
                    }
                }
            }
        }
    }
Esempio n. 7
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();
        }
    }
Esempio n. 8
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. 9
0
    /// <summary>
    /// 附件绑定
    /// </summary>
    public void DataBindLink()
    {
        List <Hi.Model.YZT_FCmaterials> fCmaterialsList = new Hi.BLL.YZT_FCmaterials().GetList("", " DisID =" + DisID + " and dr=0 ", "");

        this.li1.Visible  = false;
        this.li2.Visible  = false;
        this.li3.Visible  = false;
        this.li4.Visible  = false;
        this.li5.Visible  = false;
        this.li6.Visible  = false;
        this.li7.Visible  = false;
        this.li8.Visible  = false;
        this.li9.Visible  = false;
        this.li10.Visible = false;
        this.li11.Visible = false;
        this.li12.Visible = false;
        if (fCmaterialsList.Count > 0)
        {
            fid = fCmaterialsList[0].ID;

            this.txtRise.Value     = fCmaterialsList[0].Rise;
            this.txtContent.Value  = fCmaterialsList[0].Content;
            this.txtOBank.Value    = fCmaterialsList[0].OBank;
            this.txtOAccount.Value = fCmaterialsList[0].OAccount;
            this.txtTRNumber.Value = fCmaterialsList[0].TRNumber;

            List <Hi.Model.YZT_Annex> annexList = new Hi.BLL.YZT_Annex().GetList("", " fcID=" + fCmaterialsList[0].ID + " and dr=0 and fileAlias='4'", "");
            foreach (Hi.Model.YZT_Annex item in annexList)
            {
                if (!string.IsNullOrEmpty(item.fileName))
                {
                    LinkButton linkFile = new LinkButton();
                    linkFile.Click += new EventHandler(Download_Click);

                    if (item.fileName.LastIndexOf("_") != -1)
                    {
                        string text = item.fileName.Substring(0, item.fileName.LastIndexOf("_")) + Path.GetExtension(item.fileName);
                        if (text.Length < 15)
                        {
                            linkFile.Text = text;
                        }
                        else
                        {
                            linkFile.Text = text.Substring(0, 15) + "...";
                        }
                        linkFile.Attributes.Add("title", text);
                    }
                    else
                    {
                        string text = item.fileName.Substring(0, item.fileName.LastIndexOf("-")) + Path.GetExtension(item.fileName);
                        if (text.Length < 15)
                        {
                            linkFile.Text = text;
                        }
                        else
                        {
                            linkFile.Text = text.Substring(0, 15) + "...";
                        }
                        linkFile.Attributes.Add("title", text);
                    }
                    linkFile.Style.Add("text-decoration", "underline");
                    linkFile.Attributes.Add("fileName", item.fileName);
                    HtmlGenericControl div = new HtmlGenericControl("div");
                    div.Controls.Add(linkFile);
                    if (item.type == 5)
                    {
                        if (!string.IsNullOrWhiteSpace(item.fileName))
                        {
                            this.li1.Visible = true;
                            UpFileText.Controls.Add(div);
                            validDate.Value = item.validDate.ToString("yyyy/MM/dd");
                        }
                    }
                    else if (item.type == 7)
                    {
                        if (!string.IsNullOrWhiteSpace(item.fileName))
                        {
                            this.li2.Visible = true;
                            UpFileText2.Controls.Add(div);
                            validDate2.Value = item.validDate.ToString("yyyy/MM/dd");
                        }
                    }
                    else if (item.type == 8)
                    {
                        if (!string.IsNullOrWhiteSpace(item.fileName))
                        {
                            this.li3.Visible = true;
                            UpFileText3.Controls.Add(div);
                            validDate3.Value = item.validDate.ToString("yyyy/MM/dd");
                        }
                    }
                    else if (item.type == 9)
                    {
                        if (!string.IsNullOrWhiteSpace(item.fileName))
                        {
                            this.li4.Visible = true;
                            UpFileText4.Controls.Add(div);
                            validDate4.Value = item.validDate.ToString("yyyy/MM/dd");
                        }
                    }
                    else if (item.type == 12)
                    {
                        if (!string.IsNullOrWhiteSpace(item.fileName))
                        {
                            this.li5.Visible         = true;
                            this.HidFfileName3.Value = item.fileName;
                            this.validDate3.Value    = item.validDate.ToString("yyyy/MM/dd");
                        }
                    }
                    else if (item.type == 13)
                    {
                        if (!string.IsNullOrWhiteSpace(item.fileName))
                        {
                            this.li6.Visible         = true;
                            this.HidFfileName4.Value = item.fileName;
                            this.validDate4.Value    = item.validDate.ToString("yyyy/MM/dd");
                        }
                    }
                    else if (item.type == 14)
                    {
                        if (!string.IsNullOrWhiteSpace(item.fileName))
                        {
                            this.li7.Visible         = true;
                            this.HidFfileName5.Value = item.fileName;
                            this.validDate5.Value    = item.validDate.ToString("yyyy/MM/dd");
                        }
                    }
                    else if (item.type == 15)
                    {
                        if (!string.IsNullOrWhiteSpace(item.fileName))
                        {
                            this.li8.Visible         = true;
                            this.HidFfileName6.Value = item.fileName;
                            this.validDate6.Value    = item.validDate.ToString("yyyy/MM/dd");
                        }
                    }
                    else if (item.type == 16)
                    {
                        if (!string.IsNullOrWhiteSpace(item.fileName))
                        {
                            this.li9.Visible         = true;
                            this.HidFfileName7.Value = item.fileName;
                            this.validDate7.Value    = item.validDate.ToString("yyyy/MM/dd");
                        }
                    }
                    else if (item.type == 17)
                    {
                        if (!string.IsNullOrWhiteSpace(item.fileName))
                        {
                            this.li10.Visible        = true;
                            this.HidFfileName8.Value = item.fileName;
                            this.validDate8.Value    = item.validDate.ToString("yyyy/MM/dd");
                        }
                    }
                    else if (item.type == 18)
                    {
                        if (!string.IsNullOrWhiteSpace(item.fileName))
                        {
                            this.li11.Visible        = true;
                            this.HidFfileName9.Value = item.fileName;
                            this.validDate9.Value    = item.validDate.ToString("yyyy/MM/dd");
                        }
                    }
                    else if (item.type == 19)
                    {
                        if (!string.IsNullOrWhiteSpace(item.fileName))
                        {
                            this.li12.Visible         = true;
                            this.HidFfileName10.Value = item.fileName;
                            this.validDate10.Value    = item.validDate.ToString("yyyy/MM/dd");
                        }
                    }
                }
            }
        }
        else
        {
            this.btnUpdate.InnerHtml = "<span><img src = '../../Company/images/t02.png'/></span><font>添加</font> ";
        }
    }
Esempio n. 10
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. 11
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;
        }
    }
Esempio n. 12
0
    /// <summary>
    /// 附件绑定
    /// </summary>
    public void DataBindLink()
    {
        string id = Request.QueryString["id"];

        if (!string.IsNullOrWhiteSpace(id))
        {
            //修改
            Hi.Model.YZT_FCmaterials fCmaterialsModel = new Hi.BLL.YZT_FCmaterials().GetModel(Convert.ToInt32(id));
            if (fCmaterialsModel != null)
            {
                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=" + id + " and dr=0 and fileAlias='4'", "");
            foreach (Hi.Model.YZT_Annex item in annexList)
            {
                if (!string.IsNullOrEmpty(item.fileName))
                {
                    LinkButton linkFile = new LinkButton();
                    linkFile.Click += new EventHandler(Download_Click);
                    if (item.fileName.LastIndexOf("_") != -1)
                    {
                        string text = item.fileName.Substring(0, item.fileName.LastIndexOf("_")) + Path.GetExtension(item.fileName);
                        if (text.Length < 15)
                        {
                            linkFile.Text = text;
                        }
                        else
                        {
                            linkFile.Text = text.Substring(0, 15) + "...";
                        }
                        linkFile.Attributes.Add("title", text);
                    }
                    else
                    {
                        string text = item.fileName.Substring(0, item.fileName.LastIndexOf("-")) + Path.GetExtension(item.fileName);
                        if (text.Length < 15)
                        {
                            linkFile.Text = text;
                        }
                        else
                        {
                            linkFile.Text = text.Substring(0, 15) + "...";
                        }
                        linkFile.Attributes.Add("title", text);
                    }
                    linkFile.Style.Add("margin-right", "5px");
                    linkFile.Style.Add("text-decoration", "underline");
                    linkFile.Attributes.Add("fileName", item.fileName);
                    HtmlGenericControl div = new HtmlGenericControl("div");
                    div.Controls.Add(linkFile);
                    HtmlImage img = new HtmlImage();
                    img.Src = "../../images/icon_del.png";
                    img.Attributes.Add("title", "删除附件");
                    img.Attributes.Add("onclick", "AnnexDelete()");
                    img.Attributes.Add("class", "AnnexDelete");
                    div.Controls.Add(img);
                    if (item.type == 5)
                    {
                        validDate.Value    = item.validDate.ToString("yyyy/MM/dd");
                        HidFfileName.Value = item.fileName;
                        UpFileText.Controls.Add(div);
                    }
                    else if (item.type == 7)
                    {
                        HidFfileName2.Value = item.fileName;
                        validDate2.Value    = item.validDate.ToString("yyyy/MM/dd");
                        UpFileText2.Controls.Add(div);
                    }
                    else if (item.type == 8)
                    {
                        HidFfileName3.Value = item.fileName;
                        validDate3.Value    = item.validDate.ToString("yyyy/MM/dd");
                        UpFileText3.Controls.Add(div);
                    }
                    else if (item.type == 9)
                    {
                        HidFfileName4.Value = item.fileName;
                        validDate4.Value    = item.validDate.ToString("yyyy/MM/dd");
                        UpFileText4.Controls.Add(div);
                    }
                    else if (item.type == 12)
                    {
                        this.HidFfileName11.Value = item.fileName;
                        this.validDate11.Value    = item.validDate.ToString("yyyy/MM/dd");
                        UpFileText11.Controls.Add(div);
                    }
                    else if (item.type == 13)
                    {
                        this.HidFfileName12.Value = item.fileName;
                        this.validDate12.Value    = item.validDate.ToString("yyyy/MM/dd");
                        UpFileText12.Controls.Add(div);
                    }
                    else if (item.type == 14)
                    {
                        this.HidFfileName5.Value = item.fileName;
                        this.validDate5.Value    = item.validDate.ToString("yyyy/MM/dd");
                    }
                    else if (item.type == 15)
                    {
                        this.HidFfileName6.Value = item.fileName;
                        this.validDate6.Value    = item.validDate.ToString("yyyy/MM/dd");
                        UpFileText6.Controls.Add(div);
                    }
                    else if (item.type == 16)
                    {
                        this.HidFfileName7.Value = item.fileName;
                        this.validDate7.Value    = item.validDate.ToString("yyyy/MM/dd");
                        UpFileText7.Controls.Add(div);
                    }
                    else if (item.type == 17)
                    {
                        this.HidFfileName8.Value = item.fileName;
                        this.validDate8.Value    = item.validDate.ToString("yyyy/MM/dd");
                        UpFileText8.Controls.Add(div);
                    }
                    else if (item.type == 18)
                    {
                        this.HidFfileName9.Value = item.fileName;
                        this.validDate9.Value    = item.validDate.ToString("yyyy/MM/dd");
                        UpFileText9.Controls.Add(div);
                    }
                    else if (item.type == 19)
                    {
                        this.HidFfileName10.Value = item.fileName;
                        this.validDate10.Value    = item.validDate.ToString("yyyy/MM/dd");
                        UpFileText10.Controls.Add(div);
                    }
                }
            }
        }
    }
Esempio n. 13
0
    /// <summary>
    /// 页面数据绑定
    /// </summary>
    public void bind()
    {
        this.li1.Visible  = false;
        this.li2.Visible  = false;
        this.li3.Visible  = false;
        this.li4.Visible  = false;
        this.li5.Visible  = false;
        this.li6.Visible  = false;
        this.li7.Visible  = false;
        this.li8.Visible  = false;
        this.li9.Visible  = false;
        this.li10.Visible = false;

        string fid = Request.QueryString["fid"];

        if (!string.IsNullOrWhiteSpace(fid))
        {
            string CompID = Request.QueryString["CompID"];
            Hi.Model.YZT_FCmaterials fCmaterialsModel = new Hi.BLL.YZT_FCmaterials().GetModel(Convert.ToInt32(fid));
            if (fCmaterialsModel != null)
            {
                DataTable table = new Hi.BLL.YZT_FCmaterials().getDataModel(fCmaterialsModel.DisID.ToString(), "and f.ID=" + fid + " and d.ID=" + CompID);
                if (table != null && table.Rows.Count > 0)
                {
                    this.txtComCode.Value = table.Rows[0]["CompCode"].ToString();
                    this.txtComName.Value = table.Rows[0]["CompName"].ToString();

                    dataBindGoods(table.Rows[0]["CompID"].ToString());
                }

                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.li1.Visible = true;

                            //营业执照绑定
                            this.HidFfileName.Value = item.fileName;
                            this.validDate.Value    = item.validDate.ToString("yyyy/MM/dd");
                        }
                    }
                    else if (item.type == 6)
                    {
                        if (!string.IsNullOrWhiteSpace(item.fileName))
                        {
                            this.li2.Visible = true;

                            //生产许可证绑定
                            this.HidFfileName2.Value = item.fileName;
                            this.validDate2.Value    = item.validDate.ToString("yyyy/MM/dd");
                        }
                    }
                    else if (item.type == 12)
                    {
                        if (!string.IsNullOrWhiteSpace(item.fileName))
                        {
                            this.li3.Visible = true;

                            this.HidFfileName3.Value = item.fileName;
                            this.validDate3.Value    = item.validDate.ToString("yyyy/MM/dd");
                        }
                    }
                    else if (item.type == 13)
                    {
                        if (!string.IsNullOrWhiteSpace(item.fileName))
                        {
                            this.li4.Visible = true;

                            this.HidFfileName4.Value = item.fileName;
                            this.validDate4.Value    = item.validDate.ToString("yyyy/MM/dd");
                        }
                    }
                    else if (item.type == 14)
                    {
                        if (!string.IsNullOrWhiteSpace(item.fileName))
                        {
                            this.li5.Visible = true;

                            this.HidFfileName5.Value = item.fileName;
                            this.validDate5.Value    = item.validDate.ToString("yyyy/MM/dd");
                        }
                    }
                    else if (item.type == 15)
                    {
                        if (!string.IsNullOrWhiteSpace(item.fileName))
                        {
                            this.li6.Visible = true;

                            this.HidFfileName6.Value = item.fileName;
                            this.validDate6.Value    = item.validDate.ToString("yyyy/MM/dd");
                        }
                    }
                    else if (item.type == 16)
                    {
                        if (!string.IsNullOrWhiteSpace(item.fileName))
                        {
                            this.li7.Visible = true;

                            this.HidFfileName7.Value = item.fileName;
                            this.validDate7.Value    = item.validDate.ToString("yyyy/MM/dd");
                        }
                    }
                    else if (item.type == 17)
                    {
                        if (!string.IsNullOrWhiteSpace(item.fileName))
                        {
                            this.li8.Visible = true;

                            this.HidFfileName8.Value = item.fileName;
                            this.validDate8.Value    = item.validDate.ToString("yyyy/MM/dd");
                        }
                    }
                    else if (item.type == 18)
                    {
                        if (!string.IsNullOrWhiteSpace(item.fileName))
                        {
                            this.li9.Visible = true;

                            this.HidFfileName9.Value = item.fileName;
                            this.validDate9.Value    = item.validDate.ToString("yyyy/MM/dd");
                        }
                    }
                    else if (item.type == 19)
                    {
                        if (!string.IsNullOrWhiteSpace(item.fileName))
                        {
                            this.li10.Visible = true;

                            this.HidFfileName10.Value = item.fileName;
                            this.validDate10.Value    = item.validDate.ToString("yyyy/MM/dd");
                        }
                    }
                }
            }
        }
    }