/// <summary> /// 更新合同是由甲方或者乙方先下载 /// </summary> /// <param name="ID"></param> /// <param name="type"></param> /// <returns></returns> public ActionResult UpdateDownByFirstOrSecond(string ID, string type) { string str = "失败"; try { CooperativeContract model = cooperativeContractDAL.GetModelByID(ID); if (model != null) { switch (type) { //甲方先上传盖章还是乙方先上传 0甲方;1乙方 case "1": model.FirstOrSecondDownload = 1; break; case "2": model.FirstOrSecondDownload = 0; break; } cooperativeContractDAL.Update(model); str = "成功"; } } catch { } return(Content(str)); }
/// <summary> /// 获取合作合同内容 /// </summary> /// <param name="loginid"></param> /// <param name="type"></param> /// <param name="ID"></param> /// <returns></returns> // GET: CooperativeContractA/CooperativeContractC/Details/5 public ActionResult GetContract(string loginid, string type, string ID) { if (!string.IsNullOrEmpty(loginid)) { ViewBag.LoginID = loginid; } else { ViewBag.LoginID = ""; } if (!string.IsNullOrEmpty(type)) { ViewBag.Type = type; } else { ViewBag.Type = ""; } string contentStr = string.Empty; CooperativeContract model = cooperativeContractDAL.GetModelByID(ID); ContractReview cr; if (model != null) { //contentStr ="{"+ string.Format(" \"result1\":{0},\"result2\":{1}", model.ContractContent, model.back1)+"}"; //contentStr = model.ContractContent; cr.ContractContent = model.ContractContent; cr.ReviewContent = HttpUtility.UrlDecode(model.ContractBack); JavaScriptSerializer jss = new JavaScriptSerializer(); contentStr = jss.Serialize(cr); } return(Content(contentStr)); }
/// <summary> /// 修改合同 /// </summary> /// <param name="loginid"></param> /// <param name="type"></param> /// <param name="ID"></param> /// <param name="page"></param> /// <returns></returns> public ActionResult AgreenContract(string loginid, string type, string ID, int page) { string str = "修改失败"; try { CooperativeContract model = cooperativeContractDAL.GetModelByID(ID); if (model != null) { // 0:同意 1:审阅中 switch (type) { case "1": model.SecondPartyStatus = 0; break; case "2": model.FirstPartyStatus = 0; break; } cooperativeContractDAL.Update(model); str = "修改成功"; } } catch { str = "修改失败"; } return(RedirectToAction("CooperativeContractIndex", new { loginid = loginid, type = type, page = page })); //return Content(str); }
/// <summary> /// 更改合同内容生效 /// </summary> /// <param name="loginid"></param> /// <param name="type"></param> /// <param name="ID"></param> /// <param name="page"></param> /// <returns></returns> public ActionResult EffectiveStatusUpdate(string loginid, string type, string ID, int page) { if (!string.IsNullOrEmpty(loginid)) { ViewBag.LoginID = loginid; } else { ViewBag.LoginID = ""; } if (!string.IsNullOrEmpty(type)) { ViewBag.Type = type; } else { ViewBag.Type = ""; } CooperativeContract model = cooperativeContractDAL.GetModelByID(ID); if (model != null) { #region 修改内容 //盖章合同是否生效 0生效;1未生效 switch (type) { case "1": model.SecondPartyEffectiveStatus = 1; break; case "2": model.FirstPartEffectiveStatus = 1; break; } //如果 甲方、乙方合同状态生效,则整个合同状态生效; if (model.FirstPartEffectiveStatus == 1 && model.SecondPartyEffectiveStatus == 1) { model.ContractStatus = 1; model.EffectiveTime = DateTime.Now; } cooperativeContractDAL.Update(model); #endregion } string str = string.Format("?loginid={0}&&type={1}&&page={2}", loginid, type, page); return(Content(str)); }
public JsonResult Upload(HttpPostedFileBase fileData, string ContractNum, string IDf) { if (fileData != null) { try { #region 更新当前上传人员派遣合同 EmployeeExpatriation employeeModel = employeeDAL.GetModelByParam(IDf); if (employeeModel != null) { CooperativeContract cooperativeModel = cooperativeContractDAL.GetModel(employeeModel.FirstPartyID.Value, employeeModel.SecondPartyID.Value); // 文件上传后的保存路径 string filePath = Server.MapPath("~/UploadFile/") + cooperativeModel == null ? "" : cooperativeModel.ContractCode; if (!Directory.Exists(filePath)) { Directory.CreateDirectory(filePath); } string fileName = Path.GetFileName(fileData.FileName); // 原始文件名称 string fileExtension = Path.GetExtension(fileName); // 文件扩展名 string saveName = Guid.NewGuid().ToString() + fileExtension; // 保存文件名称 fileData.SaveAs(filePath + "/" + saveName); employeeModel.UploadFilePath = "~/UploadFile/" + cooperativeModel == null ? "" : cooperativeModel.ContractCode; employeeModel.ContactFileFul = saveName; employeeDAL.Update(employeeModel); return(Json(new { Success = true, FileName = fileName, SaveName = saveName })); } #endregion } catch (Exception ex) { return(Json(new { Success = false, Message = ex.Message }, JsonRequestBehavior.AllowGet)); } } //else //{ // return Json(new { Success = false, Message = "请选择要上传的文件!" }, JsonRequestBehavior.AllowGet); //} return(Json(new { Success = false, Message = "请选择要上传的文件!" }, JsonRequestBehavior.AllowGet)); }
/// <summary> /// 下载盖章合同 /// </summary> /// <param name="filePath"></param> /// <param name="fileName"></param> /// <returns></returns> public FileStreamResult DownFile(string ID) { try { #region 更新当前上传合同信息 CooperativeContract model = cooperativeContractDAL.GetModelByID(ID); if (model != null) { // 文件上传后的保存路径 string filePath = model.UploadFilePath + "/" + model.ContactFileFul; string filename = model.ContactFileFul; string absoluFilePath = Server.MapPath(filePath); return(File(new FileStream(absoluFilePath, FileMode.Open), "application/octet-stream", Server.UrlEncode(filename))); } #endregion } catch { } return(null); }
public JsonResult Upload(HttpPostedFileBase fileData, string ContractNum, string IDf) { if (fileData != null) { try { // 文件上传后的保存路径 string filePath = Server.MapPath("~/UploadFile/") + ContractNum; if (!Directory.Exists(filePath)) { Directory.CreateDirectory(filePath); } string fileName = Path.GetFileName(fileData.FileName); // 原始文件名称 string fileExtension = Path.GetExtension(fileName); // 文件扩展名 string saveName = Guid.NewGuid().ToString() + fileExtension; // 保存文件名称 fileData.SaveAs(filePath + "/" + saveName); #region 更新当前上传合同信息 CooperativeContract model = cooperativeContractDAL.GetModelByID(IDf); if (model != null) { model.UploadFilePath = "~/UploadFile/" + ContractNum; model.ContactFileFul = saveName; cooperativeContractDAL.Update(model); } #endregion return(Json(new { Success = true, FileName = fileName, SaveName = saveName })); } catch (Exception ex) { return(Json(new { Success = false, Message = ex.Message }, JsonRequestBehavior.AllowGet)); } } else { return(Json(new { Success = false, Message = "请选择要上传的文件!" }, JsonRequestBehavior.AllowGet)); } }
/// <summary> /// 更新审阅内容 /// </summary> /// <param name="ID"></param> /// <returns></returns> public ActionResult UpdateContractReview(string loginid, string ID, string ReviewContent) { string str = "审阅失败"; try { CooperativeContract model = cooperativeContractDAL.GetModelByID(ID); if (model != null) { model.ContractBack = ReviewContent; //存放审阅备注内容 model.ReviewTime = DateTime.Now; model.ReviewUserID = int.Parse(loginid); cooperativeContractDAL.Update(model); str = "审阅成功"; } } catch { str = "审阅失败"; } return(Content(str)); }
public ActionResult PersonEntry(string loginid, int comid, int pid, int outcid, int rid, DateTime time, int money, string PersonLevel) { if (!string.IsNullOrEmpty(loginid)) { ViewBag.LoginID = loginid; } else { ViewBag.LoginID = ""; } List <CustomerOutsourc> custOut = custOutDAL.GetlList("CustomerOutID=" + loginid); if (custOut.Count > 0) { string types = custOut[0].Type.ToString(); ViewBag.Type = types; } #region 添加人员入职信息 PersonsEntrySet model = new PersonsEntrySet(); model.EntryDate = time; model.EntryStatus = 0; //0在职,1离职 model.PersonalInfoId = pid; model.CustomerCompnayCompnayId = comid; model.OutsourcingCompanyCompnayId = outcid; model.EntryMoney = money; personEntryDAL.Insert(model); // 更新人员表中的个人状态 PersonalInfo person = personalDAL.GetPersonalInfo(pid); if (person != null) { person.PeopleStatue = 0; personalDAL.Update(person); } #endregion #region 人员派遣单指定 EmployeeExpatriation employeeModel = employeeDAL.GetModelByParam(comid, outcid, model.EntryDate.Value); if (employeeModel == null) { employeeModel = new EmployeeExpatriation(); #region 如果不存在当前人员派遣单,则添加新的 employeeModel.ID = Guid.NewGuid().ToString(); employeeModel.FirstPartyID = comid; employeeModel.SecondPartyID = outcid; employeeModel.EntryDate = model.EntryDate; employeeModel.FirstContent = ContractOpration.GetEmployeeExpatriationTop(); employeeModel.SecondContent = ContractOpration.GetEmployeeExpatriationBottom(); employeeModel.PersonList = ContractOpration.GetEmployeeExpatriationCenter( person.PersonName, person.Publications, PersonLevel, //人员评定级别 model.EntryDate.Value.ToString("yyyy-MM-dd"), model.EntryMoney.ToString()); //是否同意 0:同意 1:审阅中 employeeModel.FirstPartyStatus = 1; employeeModel.SecondPartyStatus = 1; //合同是否生效 0 未生效;1生效 employeeModel.FirstPartEffectiveStatus = 0; employeeModel.SecondPartyEffectiveStatus = 0; //派遣协议状态合同状态 0:未生效 1:已生效 employeeModel.ContractStatus = 0; employeeDAL.Insert(employeeModel); #endregion } else { //如果存在则更新到内容中 string str = ContractOpration.GetEmployeeExpatriationCenter( person.PersonName, person.Publications, "初级", model.EntryDate.Value.ToString("yyyy-MM-dd"), model.EntryMoney.ToString()); employeeModel.PersonList += str; employeeDAL.Update(employeeModel); } #endregion #region 添加合作合同 if (!cooperativeContractDAL.IsExist(comid, outcid))//判断当前合作合同是否存在; { DateTime dt = DateTime.Now; CooperativeContract cooperModel = new CooperativeContract(); cooperModel.ID = Guid.NewGuid().ToString(); cooperModel.ContractCode = string.Format("YJY-{0}-{1}-{2}", dt.Year, dt.Month, cooperativeContractDAL.GetContractNumberByDate()); cooperModel.ContractFirstParty = comid; cooperModel.ContractSecondParty = outcid; cooperModel.ContractStatus = 0;//合同状态 0:未生效 1:已生效 cooperModel.FirstPartEffectiveStatus = 0; cooperModel.SecondPartyEffectiveStatus = 0; cooperModel.SigningTime = dt; //签约时间 cooperModel.FirstPartyStatus = 1; // 0:同意 1:审阅中 cooperModel.SecondPartyStatus = 1; // 0:同意 1:审阅中 //获取派遣协议模板 cooperModel.ContractContent = ContractOpration.GetDispatchingAgreement(); cooperativeContractDAL.Insert(cooperModel); } #endregion //暂时未找到跳转不到指定Action原因,据说是因为域的问题 string url = string.Format("loginid={0}&rid={1}&pid={2}", loginid, rid, pid); return(Content(url)); }