Beispiel #1
0
        //同意签订!! 2015-12-26
        protected void btnConfirm_Click(object sender, EventArgs e)
        {
            using (SqlConnection conn = new SqlConnection(Globals.ConnectionString))
            {
                string id = Functions.ParseStr(ViewState["id"]);

                HRContractBLL hrcb = new HRContractBLL(conn);
                hrcb.ConfirmHRContract(id);
                //copy video from userdata/tempvideos to contract
                //hrid.mp4 --> .pdf.mp4
                //hrid.wmv --> .pdf.wmv
                HRContractDAL hrcd = new HRContractDAL(conn);
                DataRow hrc = hrcd.GetAHRContract(id);
                string docpath = Functions.CleanDBString(hrc["docpath"]);//pdf fullfilename

                string contractdatapath = Functions.GetAppConfigString("ContractFileRootPath", "");
                string userdatapath = Functions.GetAppConfigString("UserDataPath", "");

                string srcfile = userdatapath + "\\tempvideos\\"+id+".wmv";
                string destfile = contractdatapath + "\\"+docpath+".wmv";

                File.Copy(srcfile, destfile, true);
                File.Delete(srcfile);

                GetSuccessMsg("签约成功!\\n合同内容已不可修改!", "list.aspx");

            }
        }
Beispiel #2
0
        //同意签订!! 2015-12-26 废弃,按钮隐藏
        protected void btnAgree_Click(object sender, EventArgs e)
        {
            using (SqlConnection conn = new SqlConnection(Globals.ConnectionString))
            {
                string id = Functions.ParseStr(ViewState["id"]);

                HRContractBLL hrcb = new HRContractBLL(conn);
                hrcb.ConfirmHRContract(id);
                GetSuccessMsg("签约成功!\\n合同内容已不可修改!","list.aspx");

            }
        }
Beispiel #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string _corpid = "";
            string _personid = "";

            string from = Functions.ParseStr(Request["from"], "c");//来源:c:corp;p:person

            if (from.Equals("c"))
            {
                CorpAdminBLL.CheckSession(Session, Request, Response);
                _corpid = Functions.ParseStr(Session["corp.id"]);
            }
            else
            {
                PersonBLL.CheckSession(Session, Request, Response);
                _personid = Functions.ParseStr(Session["person.id"]);

            }

            //request
            string hrcontractid = Functions.ParseStr(Request["id"]);
            using (SqlConnection conn = new SqlConnection(Globals.ConnectionString))
            {
                HRContractBLL hrcb = new HRContractBLL(conn);

                HRContractDAL hrcd = new HRContractDAL(conn);
                DataRow hrc = hrcd.GetAHRContract(hrcontractid);

                string personid = Functions.CleanDBGuid(hrc["person_id"]);
                string corpid = Functions.CleanDBGuid(hrc["corp_id"]);
                if (!_corpid.Equals(corpid) && !_personid.Equals(personid))
                {
                    //非本人或者本企业无权利查看该合同
                    Response.Write("您没有该合同的访问权.");
                    CloseOrBack("您没有该合同的访问权.");
                    return;
                }

                string contractbase = Functions.GetAppConfigString("ContractFileRootPath", "");

                #region v1 (v2版本换为HRContractBLL中的GetContractFilePathByID,会增加一次数据库访问,但会让程序漂亮)
                //int status = Functions.CleanDBInt(hrc["status"]);

                //最终的合同直接读取docpath
                string docpath = Functions.CleanDBString(hrc["docpath"]);
                string docfile = contractbase + "\\" + docpath+".wmv";

                if (File.Exists(docfile))
                {
                    Response.ContentType = "application/octet-stream";
                    CommonBLL.GetStreamFromFile(docfile, Response);
                }
                else
                {
                    Response.Write("视频不存在.");
                    CloseOrBack("视频不存在.");
                }

                #endregion

            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            string _corpid = "";
            string _personid = "";

            string from = Functions.ParseStr(Request["from"], "c");//来源:c:corp;p:person
            string type = Functions.ParseStr(Request["type"], "pdf").ToLower();//pdf/img

            if (from.Equals("c"))
            {
                CorpAdminBLL.CheckSession(Session, Request, Response);
                _corpid = Functions.ParseStr(Session["corp.id"]);
            }else
            {
                PersonBLL.CheckSession(Session, Request, Response);
                _personid = Functions.ParseStr(Session["person.id"]);

            }

            //request
            string hrcontractid = Functions.ParseStr(Request["id"]);
            using (SqlConnection conn = new SqlConnection(Globals.ConnectionString))
            {
                HRContractBLL hrcb = new HRContractBLL(conn);

                HRContractDAL hrcd = new HRContractDAL(conn);
                DataRow hrc = hrcd.GetAHRContract(hrcontractid);

                string personid = Functions.CleanDBGuid(hrc["person_id"]);
                string corpid = Functions.CleanDBGuid(hrc["corp_id"]);
                if (!_corpid.Equals(corpid) && !_personid.Equals(personid)) {
                    //非本人或者本企业无权利查看该合同
                    Response.Write("您没有该合同的访问权.");
                    CloseOrBack("您没有该合同的访问权.");
                    return;
                }

                string contractbase = Functions.GetAppConfigString("ContractFileRootPath", "");

                #region v1 (v2版本换为HRContractBLL中的GetContractFilePathByID,会增加一次数据库访问,但会让程序漂亮)
                int status = Functions.CleanDBInt(hrc["status"]);
                if (status == (int)HRContractStatus.PersonAccepted)
                {
                    //最终的合同直接读取docpath
                    string docpath = Functions.CleanDBString(hrc["docpath"]);
                    string docfile = contractbase + "\\" + docpath;
                    if (!File.Exists(docfile))
                    {
                        Response.Write("未发现合同文件.");
                        CloseOrBack("未发现合同文件.");
                        return;
                    }

                    Response.ContentType = "application/pdf";
                    CommonBLL.GetStreamFromFile(docfile, Response);

                }
                else
                {
                    //其他状态的合同根据jsonfile临时生成,之后清除掉
                    string jsonpath = Functions.CleanDBString(hrc["jsonpath"]);

                    string jsonfile = contractbase + "\\" + jsonpath;
                    string outputfile = contractbase + "\\temp\\" + hrcontractid + ".pdf";

                    if (!File.Exists(jsonfile))
                    {
                        Response.Write("未发现数据文件[J].");
                        CloseOrBack("未发现数据文件[J].");
                        return;
                    }

                    hrcb.CreatePDFInstance(jsonfile, outputfile);

                    if (!File.Exists(outputfile))
                    {
                        Response.Write("未发现合同文件.");
                        CloseOrBack("未发现合同文件.");
                        return;
                    }

                    Response.ContentType = "application/pdf";
                    CommonBLL.GetStreamFromFile(outputfile, Response);

                    File.Delete(outputfile);
                }
                #endregion

            }
        }
Beispiel #5
0
        public void BindData() {
            try
            {
                //do
                //根据id和type返回模板或者实例(临时或永久)的文件路径;
                //PDFType:t 模板; hrc 合同实例
                string pdffile = "";
                bool needdelete = false;
                if (PDFType.Equals("t"))
                {
                    TempletBLL tb = new TempletBLL(_conn);
                    pdffile = tb.GetTempletFilePathByID(PDFID);
                    needdelete = false;

                }
                if (PDFType.Equals("hrc"))
                {
                    HRContractBLL hrcb = new HRContractBLL(_conn);
                    int res = hrcb.GetContractFilePathByID(PDFID, out pdffile);
                    if (1 == res)
                        needdelete = false;
                    else
                        needdelete = true;
                }
                //读取pdf的页数
                if (pdffile.Equals("") || !File.Exists(pdffile))
                {
                    Response.Write("合同[" + PDFType + "]文件不存在.");
                    this.imgPreviewer.ImageUrl = "../images/logo.png";
                    return;
                }
                PDFFile pdfFile = PDFFile.Open(pdffile);
                int cnt = pdfFile.PageCount;
                ViewState["pagecount"] = cnt;
                pdfFile.Dispose();
                if (PageNo > cnt) PageNo = cnt;


                if (needdelete) File.Delete(pdffile);


                //绑定图片
                this.imgPreviewer.ImageUrl = "/control/GetPDFPageImage.aspx?id=" + PDFID + "&type=" + PDFType + "&from=" + From + "&page=" + PageNo;

                //生成翻页器
                this.phLinks.Controls.Clear();

                for (int i = 1; i <= cnt; i++)
                {
                    Button lb = new Button();
                    lb.Text = " [ " + i.ToString() + " ] ";
                    //lb.Click += new EventHandler(this.OnButton);
                    lb.CssClass = "txt";
                    lb.Command += new CommandEventHandler(this.OnButton);
                    lb.CommandArgument = i.ToString();

                    this.phLinks.Controls.Add(lb);
                }
            }
            catch (Exception e) {
                Response.Write(e.ToString());
                GetErrMsg(e.Message);
                
            }
        
        }