Esempio n. 1
0
 //拒绝
 protected void btnReject_Click(object sender, EventArgs e)
 {
     using (SqlConnection conn = new SqlConnection(Globals.ConnectionString))
     {
         string id = Functions.ParseStr(ViewState["id"]);
         HRContractDAL hrcd = new HRContractDAL(conn);
         hrcd.ProcAndLog(id, "", (int)HRContractProcType.PersonReject, (int)HRContractStatus.PersonRejected);
         BindData(conn);
     }
 }
Esempio n. 2
0
        //保存修改
        protected void btnSave_Click(object sender, EventArgs e)
        {
            using (SqlConnection conn = new SqlConnection(Globals.ConnectionString))
            {
                string id = Functions.ParseStr(ViewState["id"]);
                HRContractDAL hrcd = new HRContractDAL(conn);
                hrcd.ProcAndLog(id, corpadminid, (int)HRContractProcType.AdminEdit, (int)HRContractStatus.Edit);

                int status = Functions.ParseInt(ViewState["status"], -1);

                if (status == (int)HRContractStatus.Edit)
                {
                    string jsonpath = Functions.ParseStr(ViewState["jsonpath"]);
                    string contractbase = Functions.GetAppConfigString("ContractFileRootPath", "");
                    string jsonfile = contractbase + "\\" + jsonpath;
                    TempletInfoEditor.SaveToJSONFile(jsonfile);
                    this.EditArea.Visible = false;
                    this.btnEdit.Visible = true;
                }
            }
        }
Esempio n. 3
0
        protected void btnOK_Click(object sender, EventArgs e)
        {
            string person_corp_id = PersonSelecter.SelectedCorpPersonID;
            string person_id = PersonSelecter.SelectedPersonID;
            if (person_corp_id.Equals("") || person_id.Equals("")) {
                GetErrMsg("请先选择人员!");
                return;
            }
            string templet_id = TempletSelecter.SelectedTempletID;
            if (templet_id.Equals(""))
            {
                GetErrMsg("请先选择模板!");
                return;
            }

            using (SqlConnection conn = new SqlConnection(Globals.ConnectionString))
            {
                //保存为json文件,
                string jsonfile = this.TempletInfoEditor.SaveToJSONFile();

                //记录db
                HRContractDAL hrcd = new HRContractDAL(conn);
                DataRow hrc = hrcd.GetABlankHRContract();
                hrc["corp_person_id"] = this.PersonSelecter.SelectedCorpPersonID;
                hrc["person_id"] = this.PersonSelecter.SelectedPersonID;
                hrc["corp_id"] = this.corpid;
                hrc["templet_id"] = this.TempletSelecter.SelectedTempletID;
                hrc["docpath"] = "";
                hrc["jsonpath"] = jsonfile;
                hrc["creatorid"] = this.adminid;
                hrc["status"] = HRContractStatus.Starting;
                //reclog
                string newid = hrcd.Create(hrc);
                hrcd.ProcAndLog(newid, adminid, (int)HRContractProcType.AdminEdit, (int)HRContractStatus.Starting);

                //redirect
                Response.Redirect("list.aspx");

            }
        }
Esempio n. 4
0
 //撤回
 protected void btnWithdraw_Click(object sender, EventArgs e)
 {
     using (SqlConnection conn = new SqlConnection(Globals.ConnectionString))
     {
         string id = Functions.ParseStr(ViewState["id"]);
         HRContractDAL hrcd = new HRContractDAL(conn);
         hrcd.ProcAndLog(id, corpadminid, (int)HRContractProcType.AdminWithdraw, (int)HRContractStatus.Edit);
         BindData(conn);
     }
 }
Esempio n. 5
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);
        }