Example #1
0
        //拒绝
        protected void btnReject_Click(object sender, EventArgs e)
        {
            using (SqlConnection conn = new SqlConnection(Globals.ConnectionString))
            {
                string cpid = Functions.ParseStr(ViewState["cpid"]);
                CorpPersonDAL cpDAL = new CorpPersonDAL(conn);
                cpDAL.ProcAndLog(cpid, corpadminid, (int)CorpPersonProcType.RejectApply, (int)CorpPersonStatus.ApplyReject);
                this.BindData(conn);
                GetSuccessMsg("已拒绝个人挂接企业申请.");

            }
        }
Example #2
0
        //确认合同生成;
        //生成pdf,记录hrcontract状态,记录日志;
        //2015-9-3 记录人员状态为 已签约
        public void ConfirmHRContract(string hrcid)
        {
            HRContractDAL hrcd = new HRContractDAL(conn);
            DataRow hrc = hrcd.GetAHRContract(hrcid);
            if (null == hrc) return;
            string corp_person_id = Functions.CleanDBGuid(hrc["corp_person_id"]);

            //生成pdf实例;only jsondata
            string jsonpath = Functions.CleanDBString(hrc["jsonpath"]);
            string contractbase = Functions.GetAppConfigString("ContractFileRootPath", "");
            string jsonfile = contractbase + "\\" + jsonpath;

            //在json中插入signtime信息
            PDFInstanceData pdfJsonData0 = PDFInstanceData.LoadFromJSONFile(jsonfile);
            //PDFInstanceFieldItem fi_signtime = new PDFInstanceFieldItem();
            //fi_signtime.FieldKey = "signtime";
            //fi_signtime.FeildValue = DateTime.Now.ToShortDateString();
            //pdfJsonData0.Items.Add(fi_signtime);
            pdfJsonData0.AddItem("signtime", DateTime.Now.ToShortDateString());

            pdfJsonData0.SaveToJSONFile(jsonfile);

            string datepath = DateTime.Now.ToString("yyyy/MM/dd").Replace('/', '\\').Replace('-','\\') ;
            string dir = contractbase + "\\" + datepath;
            if (!Directory.Exists(dir)) Directory.CreateDirectory(dir);
            string filename = Guid.NewGuid().ToString() + ".pdf";
            string newFile = dir + "\\" + filename; //contracts下YYYY/MM/DD/GUID.json命名

            //create pdf instance file
            this.CreatePDFInstance(jsonfile, newFile);

            #region CreatePDFInstance old srcode
            ////------------------------------------
            //PDFInstanceData data = PDFInstanceData.LoadFromJSONFile(jsonfile);
            //string corpid = data.CorpID;
            //string personid = data.PersonID;
            //string templetid = data.TempletID;
            //string templetdocpath = data.TempletDocPath;

            //string templetbase = Functions.GetAppConfigString("TempletFileRootPath", "");
            //string pdfTemplate = templetbase + "\\" + corpid + "\\" + templetdocpath;

            //PdfReader pdfReader = new PdfReader(pdfTemplate);
            //PdfStamper pdfStamper = null;
            //try
            //{
            //    pdfStamper = new PdfStamper(pdfReader, new FileStream(newFile, FileMode.Create));
            //    //设置字体解决中文问题
            //    BaseFont font = BaseFont.CreateFont(fontpath+ ",1",/*@"C:\windows\fonts\simsun.ttc,1", */
            //        BaseFont.IDENTITY_H, BaseFont.EMBEDDED);
            //    pdfStamper.AcroFields.AddSubstitutionFont(font);

            //    AcroFields pdfFormFields = pdfStamper.AcroFields;

            //    // set form pdfFormFields
            //    // The first worksheet and W-4 form
            //    for (int x = 0; x < data.Items.Count; x++)
            //    {
            //        string fieldName = data.Items[x].FieldKey;
            //        string fieldValue = data.Items[x].FeildValue;
            //        pdfFormFields.SetField(fieldName, fieldValue);

            //    }

            //    // close the pdf
            //    pdfStamper.Close();

            //}
            //catch (Exception e)
            //{
            //    e.ToString();
            //    pdfStamper.Close();
            //}
            ////--------------------------------------
            #endregion

            //写hrcontract
            //extract infos from json
            PDFInstanceData pdfJsonData = PDFInstanceData.LoadFromJSONFile(jsonfile);
            foreach (PDFTempletFieldItem fi in this._fieldsInfo.FeildsNeedExtract)
            {
                string fieldKey = fi.FieldKey;
                string fieldValue = pdfJsonData.GetItem(fieldKey).FeildValue;

                try
                {
                    hrc[fieldKey] = fieldValue;
                }
                catch { }

            }
            //set db docpath
            string docpath = datepath + "\\" + filename;
            hrc["docpath"] = docpath;

            hrcd.Update(hrc);

            //写企业人员状态corp_person
            //因为此过程由person发起,所以没有admin_id
            CorpPersonDAL cpd = new CorpPersonDAL(conn);
            cpd.ProcAndLog(corp_person_id, "", (int)CorpPersonProcType.ContractAssgin, (int)CorpPersonStatus.ContractAssigned);

            //reclog
            hrcd.ProcAndLog(hrcid, "", (int)HRContractProcType.PersonAccept, (int)HRContractStatus.PersonAccepted);
        }