/// <summary> /// 更新处理 /// </summary> /// <returns></returns> private bool Update_deal() { var result = new UserResourceBLL().Update(param, GetLoginUserId(), id); if (result == ERROR_CODE.SUCCESS) { Response.Write("<script>alert('员工修改成功!');</script>"); paramcopy = param; return(true); } else if (result == ERROR_CODE.USER_NOT_FIND)// 用户丢失 { Response.Write("<script>alert('查询不到用户,请重新登陆');</script>"); Response.Redirect("Login.aspx"); return(false); } else if (result == ERROR_CODE.EXIST) { Response.Write("<script>alert('存在相同用户名,请修改!');</script>"); } else if (result == ERROR_CODE.SYS_NAME_EXIST) { Response.Write("<script>alert('该姓名已存在!');</script>"); return(false); } return(false); }
protected void Page_Load(object sender, EventArgs e) { var weBll = new WorkEntryBLL(); if (!long.TryParse(Request.QueryString["resId"], out resourceId)) { resourceId = LoginUserId; } if (!int.TryParse(Request.QueryString["year"], out year)) { year = DateTime.Now.Year; } resList = weBll.GetApproveResList(LoginUserId); var res = new UserResourceBLL().GetResourceById(resourceId); if (res.hire_date != null) { startYear = res.hire_date.Value.Year; if (year < startYear) { year = DateTime.Now.Year; } } else { startYear = DateTime.Now.Year; } timeoffList = new TimeOffPolicyBLL().GetResourceTimeoffInfo(year, resourceId); reportList = weBll.GetTenWorkEntryReportList(resourceId); timeoffSummary = new TimeOffPolicyBLL().GetResourceTimeoffTotal(resourceId, year); }
protected void btnChange_Click(object sender, EventArgs e) { string userPwd = oldPwd.Text.Trim(); if (!new Cryptographys().SHA1Encrypt(userPwd).Equals(thisUser.password)) { // 密码错误 ClientScript.RegisterStartupScript(this.GetType(), "提示信息", $"<script>alert('原密码填写错误,请重新填写!');</script>"); return; } string userNewPwd = newPwd.Text.Trim(); thisUser.password = new Cryptographys().SHA1Encrypt(userNewPwd); var result = new UserResourceBLL().ChangeUserPass(thisUser, LoginUserId); ClientScript.RegisterStartupScript(this.GetType(), "提示信息", $"<script>alert('保存{(result?"成功":"失败")}!');window.close();</script>"); }
protected void Page_Load(object sender, EventArgs e) { if (!string.IsNullOrEmpty(Request.QueryString["year"])) { int.TryParse(Request.QueryString["year"], out year); } if (!string.IsNullOrEmpty(Request.QueryString["month"])) { int.TryParse(Request.QueryString["month"], out month); } resourceList = new UserResourceBLL().GetResourceByTime(year, month); long resId = 0; if (!string.IsNullOrEmpty(Request.QueryString["resId"]) && long.TryParse(Request.QueryString["resId"], out resId)) { resQuota = salBll.GetResMonthQuota(resId, year, month); } long id = 0; if (!string.IsNullOrEmpty(Request.QueryString["id"]) && long.TryParse(Request.QueryString["id"], out id)) { resQuota = salBll.GetQuotaById(id); } if (resQuota != null) { isAdd = false; var thisRes = new UserResourceBLL().GetResourceById(resQuota.resource_id); year = resQuota.year; month = resQuota.month; if (resourceList == null || (!resourceList.Any(_ => _.id == resQuota.resource_id))) { resourceList.Add(thisRes); } } }
protected bool noTime = false; // 可以不输入开始结束时间(根据系统设置进行判断) protected void Page_Load(object sender, EventArgs e) { try { // 是否需要输入开始结束时间 var isNeedTimeString = Request.QueryString["NoTime"]; var noTimeSet = new SysSettingBLL().GetSetById(SysSettingEnum.SDK_ENTRY_REQUIRED); if (!string.IsNullOrEmpty(isNeedTimeString)) { if (noTimeSet != null && noTimeSet.setting_value == "0") { noTime = true; } } var callId = Request.QueryString["callId"]; if (!string.IsNullOrEmpty(callId)) { thisCall = new sdk_service_call_dal().FindNoDeleteById(long.Parse(callId)); } thisUser = new sys_resource_dal().FindNoDeleteById(GetLoginUserId()); var resList = dic.FirstOrDefault(_ => _.Key == "sys_resource").Value as List <DictionaryEntryDto>; if (!IsPostBack) { resource_id.DataTextField = "show"; resource_id.DataValueField = "val"; var entryProxySet = new SysSettingBLL().GetValueById(SysSettingEnum.SDK_ENTRY_PROXY); bool isAgent = false; if (entryProxySet == ((int)DicEnum.PROXY_TIME_ENTRY.DISABLED).ToString()) { if (resList != null && resList.Count > 0) { resList = resList.Where(_ => _.val == LoginUserId.ToString()).ToList(); } } else { var agentResList = new UserResourceBLL().GetAgentUser(LoginUserId, out isAgent); if (agentResList != null && agentResList.Count > 0) { resList = (from a in agentResList select new DictionaryEntryDto() { val = a.id.ToString(), show = a.name }).ToList(); } } resource_id.DataSource = resList; resource_id.SelectedValue = LoginUserId.ToString(); resource_id.DataBind(); var statusList = dic.FirstOrDefault(_ => _.Key == "ticket_status").Value as List <DictionaryEntryDto>; //statusList.Remove(statusList.FirstOrDefault(_=>_.val==((int)DicEnum.TICKET_STATUS.NEW).ToString())); status_id.DataTextField = "show"; status_id.DataValueField = "val"; status_id.DataSource = statusList; status_id.DataBind(); cost_code_id.DataTextField = "name"; cost_code_id.DataValueField = "id"; cost_code_id.DataSource = new d_cost_code_dal().GetCostCodeByWhere((int)DicEnum.COST_CODE_CATE.GENERAL_ALLOCATION_CODE); cost_code_id.DataBind(); notify_id.DataTextField = "name"; notify_id.DataValueField = "id"; notify_id.DataSource = new sys_notify_tmpl_dal().GetTempByEvent(DicEnum.NOTIFY_EVENT.TICKET_TIME_ENTRY_CREATED_EDITED); notify_id.DataBind(); } var taskId = Request.QueryString["task_id"]; if (!string.IsNullOrEmpty(taskId)) { thisTask = new sdk_task_dal().FindNoDeleteById(long.Parse(taskId)); } var id = Request.QueryString["id"]; if (!string.IsNullOrEmpty(id)) { thisWorkEntry = new sdk_work_entry_dal().FindNoDeleteById(long.Parse(id)); if (thisWorkEntry != null) { if (thisWorkEntry.approve_and_post_date != null || thisWorkEntry.approve_and_post_user_id != null) { Response.Write("<script>alert('审批提交的工时不可以更改!');window.close();</script>"); Response.End(); } if (!resList.Any(_ => _.val == thisWorkEntry.create_user_id.ToString())) { Response.Write("<script>alert('系统设置不能代理操作!');window.close();</script>"); return; } if (thisWorkEntry.end_time == null && noTimeSet != null && noTimeSet.setting_value == "0") { noTime = true; } entryList = new sdk_work_entry_dal().GetBatchList(thisWorkEntry.batch_id); isAdd = false; thisTask = new sdk_task_dal().FindNoDeleteById(thisWorkEntry.task_id); if (!IsPostBack) { resource_id.ClearSelection(); resource_id.SelectedValue = ((long)thisWorkEntry.resource_id).ToString(); cost_code_id.SelectedValue = ((long)thisWorkEntry.cost_code_id).ToString(); // status_id.SelectedValue = ((long)thisWorkEntry.) // thisTask = new crm_account_dal().FindNoDeleteById(thisWorkEntry.); } if (thisWorkEntry.contract_id != null) { thisContract = new ctt_contract_dal().FindNoDeleteById((long)thisWorkEntry.contract_id); } if (!IsPostBack) { isBilled.Checked = thisWorkEntry.is_billable == 0; ShowOnInv.Checked = thisWorkEntry.show_on_invoice == 1; if (isBilled.Checked) { ShowOnInv.Enabled = true; } } } else { Response.Write("<script>alert('工时已被删除!')window.close();</script>"); Response.End(); } } #region 根据批次获取相关工时 //var batchId = Request.QueryString["batchId"]; //if (!string.IsNullOrEmpty(batchId)) //{ // entryList = new sdk_work_entry_dal().GetBatchList(long.Parse(batchId)); // if(entryList!=null&& entryList.Count > 0) // { // thisWorkEntry = entryList[0]; // if (thisWorkEntry.approve_and_post_date != null || thisWorkEntry.approve_and_post_user_id != null) // { // Response.Write("<script>alert('审批提交的工时不可以更改!');window.close();</script>"); // Response.End(); // } // if (!resList.Any(_ => _.val == thisWorkEntry.create_user_id.ToString())) // { // Response.Write("<script>alert('系统设置不能代理操作!')window.close();</script>"); // Response.End(); // } // if (thisWorkEntry.end_time == null && noTimeSet != null && noTimeSet.setting_value == "0") // { // noTime = true; // } // entryList = new sdk_work_entry_dal().GetBatchList(thisWorkEntry.batch_id); // isAdd = false; // thisTask = new sdk_task_dal().FindNoDeleteById(thisWorkEntry.task_id); // if (!IsPostBack) // { // resource_id.SelectedValue = ((long)thisWorkEntry.resource_id).ToString(); // cost_code_id.SelectedValue = ((long)thisWorkEntry.cost_code_id).ToString(); // // status_id.SelectedValue = ((long)thisWorkEntry.) // // thisTask = new crm_account_dal().FindNoDeleteById(thisWorkEntry.); // } // if (thisWorkEntry.contract_id != null) // { // thisContract = new ctt_contract_dal().FindNoDeleteById((long)thisWorkEntry.contract_id); // } // if (!IsPostBack) // { // isBilled.Checked = thisWorkEntry.is_billable == 0; // ShowOnInv.Checked = thisWorkEntry.show_on_invoice == 1; // if (isBilled.Checked) // { // ShowOnInv.Enabled = true; // } // } // } //} #endregion if (thisTask != null) { v_task = new v_task_all_dal().FindById(thisTask.id); thisProjetc = new pro_project_dal().FindNoDeleteById((long)thisTask.project_id); if (thisProjetc != null) { thisAccount = new crm_account_dal().FindNoDeleteById(thisProjetc.account_id); if (!IsPostBack) { status_id.SelectedValue = thisTask.status_id.ToString(); } } } // 项目关联合同,并且合同中设置-工时录入需要输入开始结束时间 if (thisProjetc != null && thisProjetc.contract_id != null) { var thisCttContract = new ctt_contract_dal().FindNoDeleteById((long)thisProjetc.contract_id); if (thisCttContract != null) { if (thisCttContract.timeentry_need_begin_end == 1) { noTime = false; } } } if (thisCall != null) { showStartDate = EMT.Tools.Date.DateHelper.ConvertStringToDateTime(thisCall.start_time); showEndDate = EMT.Tools.Date.DateHelper.ConvertStringToDateTime(thisCall.end_time); } if (!string.IsNullOrEmpty(Request.QueryString["chooseDate"])) { showStartDate = DateTime.Parse(Request.QueryString["chooseDate"]); showEndDate = DateTime.Parse(Request.QueryString["chooseDate"]); } } catch (Exception msg) { Response.Write($"<script>alert('{msg.Message}');window.close();</script>"); } }
protected void Page_Load(object sender, EventArgs e) { long batchId; if (long.TryParse(Request.QueryString["id"], out batchId)) { isAdd = false; } if (!string.IsNullOrEmpty(Request.QueryString["resourceId"])) { resourceId = long.Parse(Request.QueryString["resourceId"]); } else { resourceId = LoginUserId; } var entryProxySet = new SysSettingBLL().GetValueById(SysSettingEnum.SDK_ENTRY_PROXY); if (entryProxySet == ((int)DicEnum.PROXY_TIME_ENTRY.ENABLED_TIMESHEET_APPROVERS).ToString()) { showResource = true; } if (string.IsNullOrEmpty(Request.QueryString["startDate"])) { startDate = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day); } else { startDate = DateTime.Parse(Request.QueryString["startDate"]); } if (!isAdd) // 编辑工时的开始日期 { workEntryList = bll.GetWorkEntryByBatchId(batchId); if (workEntryList.Count <= 0) { Response.Write("<script>alert('工时不存在');window.close();</script>"); Response.End(); return; } startDate = Tools.Date.DateHelper.TimeStampToUniversalDateTime(workEntryList[0].start_time.Value); resourceId = workEntryList[0].resource_id.Value; } if (startDate.DayOfWeek != DayOfWeek.Monday) { if (startDate.DayOfWeek == DayOfWeek.Sunday) { startDate = startDate.AddDays(-6); } else { startDate = startDate.AddDays((int)DayOfWeek.Monday - (int)startDate.DayOfWeek); } } resourceName = new UserResourceBLL().GetResourceById(resourceId).name; var costCodeList = bll.GetTimeCostCodeList(); if (!IsPostBack) { if (isAdd) { costCodeName.Visible = false; cost_code_id.DataValueField = "id"; cost_code_id.DataTextField = "name"; cost_code_id.DataSource = costCodeList; cost_code_id.DataBind(); } else { cost_code_id.Visible = false; costCodeName.Visible = true; costCodeName.Text = costCodeList.Find(_ => _.id == workEntryList[0].task_id).name; DateTime dt = new DateTime(startDate.Ticks); var find = workEntryList.Find(_ => _.start_time == Tools.Date.DateHelper.ToUniversalTimeStamp(dt)); if (find != null) { monday.Text = find.hours_billed.Value.ToString(); mondayInter.Value = find.internal_notes; mondayNodes.Value = find.summary_notes; } dt = dt.AddDays(1); find = workEntryList.Find(_ => _.start_time == Tools.Date.DateHelper.ToUniversalTimeStamp(dt)); if (find != null) { tuesday.Text = find.hours_billed.Value.ToString(); tuesdayInter.Value = find.internal_notes; tuesdayNodes.Value = find.summary_notes; } dt = dt.AddDays(1); find = workEntryList.Find(_ => _.start_time == Tools.Date.DateHelper.ToUniversalTimeStamp(dt)); if (find != null) { wednesday.Text = find.hours_billed.Value.ToString(); wednesdayInter.Value = find.internal_notes; wednesdayNodes.Value = find.summary_notes; } dt = dt.AddDays(1); find = workEntryList.Find(_ => _.start_time == Tools.Date.DateHelper.ToUniversalTimeStamp(dt)); if (find != null) { thursday.Text = find.hours_billed.Value.ToString(); thursdayInter.Value = find.internal_notes; thursdayNodes.Value = find.summary_notes; } dt = dt.AddDays(1); find = workEntryList.Find(_ => _.start_time == Tools.Date.DateHelper.ToUniversalTimeStamp(dt)); if (find != null) { friday.Text = find.hours_billed.Value.ToString(); fridayInter.Value = find.internal_notes; fridayNodes.Value = find.summary_notes; } dt = dt.AddDays(1); find = workEntryList.Find(_ => _.start_time == Tools.Date.DateHelper.ToUniversalTimeStamp(dt)); if (find != null) { saturday.Text = find.hours_billed.Value.ToString(); saturdayInter.Value = find.internal_notes; saturdayNodes.Value = find.summary_notes; } dt = dt.AddDays(1); find = workEntryList.Find(_ => _.start_time == Tools.Date.DateHelper.ToUniversalTimeStamp(dt)); if (find != null) { sunday.Text = find.hours_billed.Value.ToString(); sundayInter.Value = find.internal_notes; sundayNodes.Value = find.summary_notes; } } if (showResource) { var resList = new UserResourceBLL().GetResourceList(); resource_id.DataValueField = "val"; resource_id.DataTextField = "show"; resource_id.DataSource = resList; resource_id.DataBind(); if (resList.Exists(_ => _.val == resourceId.ToString())) { resource_id.SelectedValue = resourceId.ToString(); } } notify_tmpl_id.DataTextField = "name"; notify_tmpl_id.DataValueField = "id"; notify_tmpl_id.DataSource = new DAL.sys_notify_tmpl_dal().GetTempByEvent(DicEnum.NOTIFY_EVENT.TICKET_TIME_ENTRY_CREATED_EDITED); notify_tmpl_id.DataBind(); } else { List <string> weNames = new List <string> { "monday", "tuesday", "wednesday", "thursday", "friday", "saturday", "sunday" }; if (isAdd && showResource) { resourceId = long.Parse(resource_id.SelectedValue); } var weList = new List <sdk_work_entry>(); for (int i = 0; i < weNames.Count; i++) { decimal hours_worked; if (!decimal.TryParse(Request.Form[weNames[i]], out hours_worked)) { continue; } sdk_work_entry we = new sdk_work_entry(); if (isAdd) { long taskId = long.Parse(cost_code_id.SelectedValue); we.task_id = taskId; we.cost_code_id = taskId; } else { we.batch_id = batchId; } we.resource_id = resourceId; we.start_time = Tools.Date.DateHelper.ToUniversalTimeStamp(startDate.AddDays(i)); we.end_time = we.start_time; we.hours_worked = hours_worked; we.hours_billed = hours_worked; we.offset_hours = 0; we.internal_notes = Request.Form[weNames[i] + "Inter"]; we.summary_notes = Request.Form[weNames[i] + "Nodes"]; we.is_billable = 0; we.show_on_invoice = 0; weList.Add(we); } if (isAdd) { bll.AddWorkEntry(weList, LoginUserId); } else if (!bll.EditWorkEntry(weList, batchId, LoginUserId)) { Response.Write("<script>alert('工时审批提交后不能编辑');</script>"); return; } if (Request.Form["subAct"] == "SaveClose") { Response.Write("<script>window.close();self.opener.location.reload();</script>"); Response.End(); } else { Response.Write("<script>window.location.href='RegularTimeAddEdit';self.opener.location.reload();</script>"); Response.End(); } } }
private void Bind() { var dic = new UserResourceBLL().GetDownList(); // 日期格式 this.DateFormat.DataTextField = "show"; this.DateFormat.DataValueField = "val"; this.DateFormat.DataSource = dic.FirstOrDefault(_ => _.Key == "DateFormat").Value; this.DateFormat.DataBind(); // DateFormat.Items.Insert(0, new ListItem() { Value = "0", Text = " ", Selected = true }); //数字格式 this.NumberFormat.DataTextField = "show"; this.NumberFormat.DataValueField = "val"; this.NumberFormat.DataSource = dic.FirstOrDefault(_ => _.Key == "NumberFormat").Value; NumberFormat.DataBind(); // NumberFormat.Items.Insert(0, new ListItem() { Value = "0", Text = " ", Selected = true }); //TimeFormat时间格式 this.TimeFormat.DataTextField = "show"; this.TimeFormat.DataValueField = "val"; this.TimeFormat.DataSource = dic.FirstOrDefault(_ => _.Key == "TimeFormat").Value; TimeFormat.DataBind(); // TimeFormat.Items.Insert(0, new ListItem() { Value = "0", Text = " ", Selected = true }); //EmailType50 this.EmailType.DataTextField = "show"; this.EmailType.DataValueField = "val"; this.EmailType.DataSource = dic.FirstOrDefault(_ => _.Key == "EmailType").Value; EmailType.DataBind(); EmailType.Items.Insert(0, new ListItem() { Value = "0", Text = " ", Selected = true }); this.EmailType1.DataTextField = "show"; this.EmailType1.DataValueField = "val"; this.EmailType1.DataSource = dic.FirstOrDefault(_ => _.Key == "EmailType").Value; EmailType1.DataBind(); EmailType1.Items.Insert(0, new ListItem() { Value = "0", Text = " ", Selected = true }); this.EmailType2.DataTextField = "show"; this.EmailType2.DataValueField = "val"; this.EmailType2.DataSource = dic.FirstOrDefault(_ => _.Key == "EmailType").Value; EmailType2.DataBind(); EmailType2.Items.Insert(0, new ListItem() { Value = "0", Text = " ", Selected = true }); //Sex49 this.Sex.DataTextField = "show"; this.Sex.DataValueField = "val"; this.Sex.DataSource = dic.FirstOrDefault(_ => _.Key == "Sex").Value; Sex.DataBind(); Sex.Items.Insert(0, new ListItem() { Value = "0", Text = " ", Selected = true }); //NameSuffix this.NameSuffix.DataTextField = "show"; this.NameSuffix.DataValueField = "val"; this.NameSuffix.DataSource = dic.FirstOrDefault(_ => _.Key == "NameSuffix").Value; NameSuffix.DataBind(); NameSuffix.Items.Insert(0, new ListItem() { Value = "0", Text = " ", Selected = true }); //Prefix前缀 //Prefix.Items.Insert(0, new ListItem() { Value = "0", Text = " ", Selected = true }); //Prefix.Items.Insert(1, new ListItem() { Value = "1", Text = "Mr." }); //Prefix.Items.Insert(2, new ListItem() { Value = "2", Text = "Mrs." }); //Prefix.Items.Insert(3, new ListItem() { Value = "3", Text = "Ms." }); //主要位置 location_id this.Position.DataTextField = "name"; this.Position.DataValueField = "id"; this.Position.DataSource = dic.FirstOrDefault(_ => _.Key == "Position").Value; Position.DataBind(); Position.Items.Insert(0, new ListItem() { Value = "0", Text = " ", Selected = true }); Position.Items.Insert(1, new ListItem() { Value = "1", Text = "总部" }); //授权tab页 //权限等级 //this.Security_Level this.Security_Level.DataTextField = "name"; this.Security_Level.DataValueField = "id"; this.Security_Level.DataSource = dic.FirstOrDefault(_ => _.Key == "Security_Level").Value; Security_Level.DataBind(); Security_Level.Items.Insert(0, new ListItem() { Value = "0", Text = " ", Selected = true }); //外包权限 //this.Outsource_Security this.Outsource_Security.DataTextField = "show"; this.Outsource_Security.DataValueField = "val"; this.Outsource_Security.DataSource = dic.FirstOrDefault(_ => _.Key == "Outsource_Security").Value; Outsource_Security.DataBind(); Outsource_Security.Items.Insert(0, new ListItem() { Value = "0", Text = " ", Selected = true }); //员工类型 var genBll = new GeneralBLL(); var resType = genBll.GetDicValues(GeneralTableEnum.RESOURCE_TYPE); type_id.DataTextField = "show"; type_id.DataValueField = "val"; type_id.DataSource = resType; type_id.DataBind(); //薪资类型 var payType = genBll.GetDicValues(GeneralTableEnum.PAYROLL_TYPE); payroll_type_id.DataTextField = "show"; payroll_type_id.DataValueField = "val"; payroll_type_id.DataSource = payType; payroll_type_id.DataBind(); hire_date.Text = DateTime.Now.ToString("yyyy-MM-dd"); time_sheet_start_date.Text = DateTime.Now.ToString("yyyy-MM-dd"); var tmoffBll = new TimeOffPolicyBLL(); // 休假方案 var policyList = tmoffBll.GetPolicyList(); timeoff_policy_id.DataTextField = "name"; timeoff_policy_id.DataValueField = "id"; timeoff_policy_id.DataSource = policyList; timeoff_policy_id.DataBind(); timeoff_policy_id.Items.Insert(0, new ListItem() { Value = "0", Text = "", Selected = true }); // 出差限度 var travelRest = genBll.GetDicValues(GeneralTableEnum.TRAVEL_RESTRICTIONS); travel_restrictions_id.DataTextField = "show"; travel_restrictions_id.DataValueField = "val"; travel_restrictions_id.DataSource = travelRest; travel_restrictions_id.DataBind(); }