/// <summary> /// 设置库存仓库激活/不激活 /// </summary> /// <param name="id"></param> /// <param name="is_active"></param> /// <param name="userId"></param> /// <returns></returns> public bool SetLocationIsActive(long id, bool is_active, long userId) { var lct = dal.FindById(id); var lctOld = dal.FindById(id); if (lct == null) { return(false); } if (is_active) { lct.is_active = 1; } else { lct.is_active = 0; } lct.update_time = Tools.Date.DateHelper.ToUniversalTimeStamp(); lct.update_user_id = userId; dal.Update(lct); OperLogBLL.OperLogUpdate <ivt_warehouse>(lct, lctOld, lct.id, userId, DicEnum.OPER_LOG_OBJ_CATE.INVENTORY_LOCATION, "修改库存仓库激活状态"); return(true); }
public bool EditTicketTmpl(sys_form_tmpl tmpl, sys_form_tmpl_ticket tmplTicket, List <UserDefinedFieldValue> udfValue, List <CheckListDto> checkList, long userId) { var user = UserInfoBLL.GetUserInfo(userId); sys_form_tmpl_ticket_dal sfttDal = new sys_form_tmpl_ticket_dal(); var oldtmplTicket = sfttDal.FindNoDeleteById(tmplTicket.id); if (oldtmplTicket == null || user == null) { return(false); } if (!EditFormTmpl(tmpl, userId)) { return(false); } tmplTicket.update_time = Tools.Date.DateHelper.ToUniversalTimeStamp(DateTime.Now); tmplTicket.update_user_id = userId; sfttDal.Update(tmplTicket); OperLogBLL.OperLogUpdate <sys_form_tmpl_ticket>(tmplTicket, oldtmplTicket, tmplTicket.id, userId, OPER_LOG_OBJ_CATE.SYS_FORM_TMPL_TICKET, ""); var udf_ticket_list = new UserDefinedFieldsBLL().GetUdf(DicEnum.UDF_CATE.TICKETS); if (udf_ticket_list != null && udf_ticket_list.Count > 0) { new UserDefinedFieldsBLL().UpdateUdfValue(DicEnum.UDF_CATE.FORM_TICKET, udf_ticket_list, tmplTicket.id, udfValue, user, DicEnum.OPER_LOG_OBJ_CATE.SYS_FORM_TMPL_TICKET_EXT); } CheckManage(checkList, tmplTicket.id, userId); return(true); }
/// <summary> /// 编辑附件 /// </summary> public void EditAttachment(com_attachment att, long userId) { var oldAtt = dal.FindNoDeleteById(att.id); if (oldAtt == null) { return; } att.update_time = Tools.Date.DateHelper.ToUniversalTimeStamp(DateTime.Now); att.update_user_id = userId; dal.Update(att); OperLogBLL.OperLogUpdate <com_attachment>(att, oldAtt, att.id, userId, DicEnum.OPER_LOG_OBJ_CATE.ATTACHMENT, ""); if (att.object_type_id == (int)DicEnum.ATTACHMENT_OBJECT_TYPE.TASK) { var task = new sdk_task_dal().FindNoDeleteById(att.object_id); if (task != null) { #region 更新客户最后活动时间 crm_account thisAccount = new CompanyBLL().GetCompany(task.account_id); if (thisAccount != null) { thisAccount.last_activity_time = Tools.Date.DateHelper.ToUniversalTimeStamp(DateTime.Now); new CompanyBLL().EditAccount(thisAccount, userId); } #endregion } } }
/// <summary> /// 服务编辑 /// </summary> /// <param name="ser"></param> /// <param name="userId"></param> /// <returns></returns> public bool EditService(ivt_service ser, long userId) { ivt_service_dal dal = new ivt_service_dal(); ivt_service service = dal.FindById(ser.id); ivt_service serOld = dal.FindById(ser.id); service.update_time = Tools.Date.DateHelper.ToUniversalTimeStamp(); service.update_user_id = userId; service.name = ser.name; service.description = ser.description; service.invoice_description = ser.invoice_description; service.sla_id = ser.sla_id; service.vendor_account_id = ser.vendor_account_id; service.period_type_id = ser.period_type_id; service.unit_cost = ser.unit_cost; service.unit_price = ser.unit_price; service.cost_code_id = ser.cost_code_id; service.is_active = ser.is_active; var desc = OperLogBLL.CompareValue <ivt_service>(serOld, service); if (!string.IsNullOrEmpty(desc)) { dal.Update(service); OperLogBLL.OperLogUpdate(desc, service.id, userId, DTO.DicEnum.OPER_LOG_OBJ_CATE.IVT_SERVICE, "编辑服务"); } return(true); }
/// <summary> /// 设置邮件模板默认 /// </summary> /// <param name="id"></param> /// <param name="type"></param> /// <param name="userId"></param> /// <returns></returns> public bool SetDefault(long id, int type, long userId) { var tmpl = dal.FindNoDeleteById(id); if (tmpl == null || tmpl.is_system_default == 1) { return(false); } sys_quote_email_tmpl old; var dft = dal.FindSignleBySql <sys_quote_email_tmpl>($"select * from sys_quote_email_tmpl where is_system_default=1 and cate_id={type}"); if (dft != null) { old = dal.FindById(dft.id); dft.is_system_default = 0; dft.update_time = Tools.Date.DateHelper.ToUniversalTimeStamp(); dft.update_user_id = userId; dal.Update(dft); OperLogBLL.OperLogUpdate(OperLogBLL.CompareValue <sys_quote_email_tmpl>(old, dft), dft.id, userId, DicEnum.OPER_LOG_OBJ_CATE.QUOTE_TEMP, "取消邮件模板默认"); } old = dal.FindById(tmpl.id); tmpl.is_system_default = 1; tmpl.update_time = Tools.Date.DateHelper.ToUniversalTimeStamp(); tmpl.update_user_id = userId; dal.Update(tmpl); OperLogBLL.OperLogUpdate(OperLogBLL.CompareValue <sys_quote_email_tmpl>(old, tmpl), tmpl.id, userId, DicEnum.OPER_LOG_OBJ_CATE.QUOTE_TEMP, "设置邮件模板默认"); return(true); }
/// <summary> /// 编辑库存仓库 /// </summary> /// <param name="id"></param> /// <param name="name"></param> /// <param name="is_default"></param> /// <param name="is_active"></param> /// <param name="userId"></param> /// <returns></returns> public bool EditLocation(long id, string name, bool is_default, bool is_active, long userId) { ivt_warehouse lct = dal.FindById(id); if (lct == null) { return(false); } ivt_warehouse lctOld = dal.FindById(id); lct.name = name; lct.is_active = (sbyte)(is_active ? 1 : 0); lct.is_default = (sbyte)(is_default ? 1 : 0); lct.update_time = Tools.Date.DateHelper.ToUniversalTimeStamp(); lct.update_user_id = userId; if (lct.resource_id != null) { lct.is_default = 0; } if (lctOld.is_default == 0 && lct.is_default == 1) // 只能设置一个默认仓库 { string sql = "update ivt_warehouse set is_default=0 where delete_time=0"; dal.ExecuteSQL(sql); } dal.Update(lct); OperLogBLL.OperLogUpdate <ivt_warehouse>(lct, lctOld, lct.id, userId, DTO.DicEnum.OPER_LOG_OBJ_CATE.INVENTORY_LOCATION, "编辑库存仓库"); return(true); }
/// <summary> /// 设置库存仓库为默认仓库,如果仓库为停用状态,设置为激活 /// </summary> /// <param name="id"></param> /// <param name="userId"></param> /// <returns></returns> public bool SetLocationDefault(long id, long userId) { var lct = dal.FindById(id); if (lct == null) { return(false); } if (lct.resource_id != null) // 员工仓库不能设置为默认 { return(false); } var lctOld = dal.FindById(id); string sql = "update ivt_warehouse set is_default=0 where delete_time=0"; dal.ExecuteSQL(sql); lct.is_default = 1; lct.is_active = 1; lct.update_time = Tools.Date.DateHelper.ToUniversalTimeStamp(); lct.update_user_id = userId; dal.Update(lct); OperLogBLL.OperLogUpdate <ivt_warehouse>(lct, lctOld, lct.id, userId, DicEnum.OPER_LOG_OBJ_CATE.INVENTORY_LOCATION, "修改库存仓库为默认"); return(true); }
/// <summary> /// 取消提交工时表 /// </summary> /// <param name="startDate"></param> /// <param name="resourceId"></param> /// <param name="userId"></param> /// <returns></returns> public bool CancleSubmitWorkEntry(DateTime startDate, long resourceId, long userId) { var weList = GetWorkEntryListByStartDate(startDate, resourceId); if (weList.Count == 0) { return(false); } sdk_work_entry_report_dal rptDal = new sdk_work_entry_report_dal(); var find = rptDal.FindSignleBySql <sdk_work_entry_report>($"select * from sdk_work_entry_report where resource_id={resourceId} and start_date='{startDate}' and delete_time=0"); if (find == null || find.status_id != (int)DicEnum.WORK_ENTRY_REPORT_STATUS.WAITING_FOR_APPROVAL) { return(false); } sdk_work_entry_report reportOld = rptDal.FindById(find.id); find.status_id = (int)DicEnum.WORK_ENTRY_REPORT_STATUS.HAVE_IN_HAND; find.update_time = Tools.Date.DateHelper.ToUniversalTimeStamp(); find.update_user_id = userId; find.submit_time = find.update_time; find.submit_user_id = userId; rptDal.Update(find); OperLogBLL.OperLogUpdate(OperLogBLL.CompareValue <sdk_work_entry_report>(reportOld, find), find.id, userId, DicEnum.OPER_LOG_OBJ_CATE.SDK_WORK_RECORD, "工时表取消提交"); return(true); }
/// <summary> /// 编辑工作流规则 /// </summary> /// <param name="workflow"></param> /// <param name="userId"></param> /// <returns></returns> public bool EditWorkflow(sys_workflow workflow, long userId) { sys_workflow wf = dal.FindById(workflow.id); sys_workflow wfOld = dal.FindById(workflow.id); if (wf.workflow_object_id != workflow.workflow_object_id) // 编辑不能修改对象类型 { return(false); } wf.update_time = Tools.Date.DateHelper.ToUniversalTimeStamp(); wf.update_user_id = userId; wf.name = workflow.name; wf.description = workflow.description; wf.is_active = workflow.is_active; wf.use_default_tmpl = workflow.use_default_tmpl; wf.notify_tmpl_id = workflow.notify_tmpl_id; wf.notify_subject = workflow.notify_subject; wf.event_json = workflow.event_json; wf.condition_json = workflow.condition_json; wf.update_json = workflow.update_json; string desc = OperLogBLL.CompareValue <sys_workflow>(wfOld, wf); if (!string.IsNullOrEmpty(desc)) { dal.Update(wf); OperLogBLL.OperLogUpdate(desc, wf.id, userId, DicEnum.OPER_LOG_OBJ_CATE.WORKFLOW_RULE, "编辑工作流规则"); } return(true); }
/// <summary> /// 工时表提交 /// </summary> /// <param name="startDate"></param> /// <param name="resourceId"></param> /// <param name="userId"></param> /// <returns></returns> public bool SubmitWorkEntry(DateTime startDate, long resourceId, long userId) { var weList = GetWorkEntryListByStartDate(startDate, resourceId); //if (weList.Count == 0) // return false; sdk_work_entry_report report = new sdk_work_entry_report(); sdk_work_entry_report_dal rptDal = new sdk_work_entry_report_dal(); var find = rptDal.FindSignleBySql <sdk_work_entry_report>($"select * from sdk_work_entry_report where resource_id={resourceId} and start_date='{startDate}' and delete_time=0"); if (find != null && find.status_id != (int)DicEnum.WORK_ENTRY_REPORT_STATUS.HAVE_IN_HAND && find.status_id != (int)DicEnum.WORK_ENTRY_REPORT_STATUS.REJECTED) { return(false); } if (find == null) { report.id = rptDal.GetNextIdCom(); report.create_time = Tools.Date.DateHelper.ToUniversalTimeStamp(); report.update_time = report.create_time; report.create_user_id = userId; report.update_user_id = userId; report.resource_id = resourceId; report.start_date = startDate; report.end_date = startDate.AddDays(6); report.status_id = (int)DicEnum.WORK_ENTRY_REPORT_STATUS.WAITING_FOR_APPROVAL; report.submit_time = report.create_time; report.submit_user_id = userId; rptDal.Insert(report); OperLogBLL.OperLogAdd <sdk_work_entry_report>(report, report.id, userId, DicEnum.OPER_LOG_OBJ_CATE.SDK_WORK_RECORD, "工时表提交"); foreach (var we in weList) { var weOld = dal.FindById(we.id); we.update_time = Tools.Date.DateHelper.ToUniversalTimeStamp(); we.update_user_id = userId; we.work_entry_report_id = report.id; dal.Update(we); OperLogBLL.OperLogUpdate(OperLogBLL.CompareValue <sdk_work_entry>(weOld, we), we.id, userId, DicEnum.OPER_LOG_OBJ_CATE.SDK_WORK_ENTRY, "工时表提交"); } } else { sdk_work_entry_report reportOld = rptDal.FindById(find.id); find.status_id = (int)DicEnum.WORK_ENTRY_REPORT_STATUS.WAITING_FOR_APPROVAL; find.update_time = Tools.Date.DateHelper.ToUniversalTimeStamp(); find.update_user_id = userId; find.submit_time = find.update_time; find.submit_user_id = userId; rptDal.Update(find); OperLogBLL.OperLogUpdate(OperLogBLL.CompareValue <sdk_work_entry_report>(reportOld, find), find.id, userId, DicEnum.OPER_LOG_OBJ_CATE.SDK_WORK_RECORD, "工时表提交"); } return(true); }
/// <summary> /// 费用报表 管理(新增,编辑) /// </summary> public bool ReportManage(sdk_expense_report report, long userId, bool isCopy = false, long copyId = 0) { try { var timeNow = Tools.Date.DateHelper.ToUniversalTimeStamp(DateTime.Now); report.update_user_id = userId; report.update_time = timeNow; if (report.id == 0) { report.id = _dal.GetNextIdCom(); report.create_time = timeNow; report.create_user_id = userId; report.submit_user_id = userId; report.submit_time = report.create_time; _dal.Insert(report); OperLogBLL.OperLogAdd <sdk_expense_report>(report, report.id, userId, OPER_LOG_OBJ_CATE.SDK_EXPENSE_REPORT, "新增费用报表"); // 代表是复制操作 if (isCopy && copyId != 0) { var seDal = new sdk_expense_dal(); // 复制时,将原有的费用复制,已经审批提交的只复制相关信息,审批状态不复制 var thisExpList = seDal.GetExpByReport(copyId); if (thisExpList != null && thisExpList.Count > 0) { thisExpList.ForEach(_ => { _.id = seDal.GetNextIdCom(); _.oid = 0; _.expense_report_id = report.id; _.create_time = timeNow; _.update_time = timeNow; _.create_user_id = userId; _.update_user_id = userId; _.approve_and_post_date = null; _.approve_and_post_user_id = null; seDal.Insert(_); OperLogBLL.OperLogAdd <sdk_expense>(_, _.id, userId, OPER_LOG_OBJ_CATE.SDK_EXPENSE, "新增费用"); }); } } } else { var oldReport = _dal.FindNoDeleteById(report.id); if (oldReport != null) { _dal.Update(report); OperLogBLL.OperLogUpdate <sdk_expense_report>(report, oldReport, report.id, userId, OPER_LOG_OBJ_CATE.SDK_EXPENSE_REPORT, "修改费用报表"); } } } catch (Exception) { return(false); } return(true); }
/// <summary> /// 工时表审批 /// </summary> /// <param name="ids">,号分割的多个工时表id</param> /// <param name="userId"></param> /// <returns></returns> public int ApproveWorkEntryReport(string ids, long userId) { int appCnt = 0; var rptDal = new sdk_work_entry_report_dal(); var logDal = new tst_work_entry_report_log_dal(); var reports = rptDal.FindListBySql($"select * from sdk_work_entry_report where id in({ids}) and status_id={(int)DicEnum.WORK_ENTRY_REPORT_STATUS.WAITING_FOR_APPROVAL} and delete_time=0"); if (reports == null || reports.Count == 0) { return(appCnt); } var user = new UserResourceBLL().GetResourceById(userId); foreach (var report in reports) { // 判断用户是否在当前可以审批工时表 int tier = GetWorkEntryReportCurrentApproveTier(report.id); if (tier == 3) { continue; } var aprvResList = GetApproverList((long)report.resource_id); tier++; if (user.security_level_id == 1 || aprvResList.Exists(_ => _.tier == tier && _.approver_resource_id == userId)) // 用户是管理员或用户可以审批下一级 { tst_work_entry_report_log log = new tst_work_entry_report_log(); log.id = logDal.GetNextIdCom(); log.work_entry_report_id = report.id; log.oper_user_id = userId; log.oper_type_id = (int)DicEnum.WORK_ENTRY_REPORT_OPER_TYPE.APPROVAL; log.oper_time = Tools.Date.DateHelper.ToUniversalTimeStamp(); log.tier = tier; logDal.Insert(log); OperLogBLL.OperLogAdd <tst_work_entry_report_log>(log, log.id, userId, DicEnum.OPER_LOG_OBJ_CATE.WORK_ENTRY_REPORT_LOG, "工时表审批"); appCnt++; if (aprvResList.Count == 0 || aprvResList.Max(_ => _.tier) == tier) // 是最后一级审批人 { var rptOld = rptDal.FindById(report.id); report.status_id = (int)DicEnum.WORK_ENTRY_REPORT_STATUS.PAYMENT_BEEN_APPROVED; report.update_time = Tools.Date.DateHelper.ToUniversalTimeStamp(); report.update_user_id = userId; report.approve_time = report.update_time; report.approve_user_id = userId; rptDal.Update(report); OperLogBLL.OperLogUpdate(OperLogBLL.CompareValue <sdk_work_entry_report>(rptOld, report), report.id, userId, DicEnum.OPER_LOG_OBJ_CATE.SDK_WORK_RECORD, "工时表审批"); } } } return(appCnt); }
/// <summary> /// 报价参数设置 /// </summary> /// <param name="quoteRef"></param> /// <param name="emailQuoteContact">是否通知报价联系人</param> /// <param name="emailAccountResource">是否通知客户经理</param> /// <param name="userId"></param> /// <returns></returns> public bool PreferencesQuote(crm_account_reference quoteRef, bool emailQuoteContact, bool emailAccountResource, long userId) { crm_account_reference_dal refDal = new crm_account_reference_dal(); var oldPref = refDal.GetAccountQuoteRef(quoteRef.account_id); crm_account_reference newPref; if (oldPref == null) { newPref = new crm_account_reference(); } else { newPref = refDal.GetAccountQuoteRef(quoteRef.account_id); } newPref.account_id = quoteRef.account_id; newPref.quote_tmpl_id = quoteRef.quote_tmpl_id; newPref.quote_email_message_tmpl_id = quoteRef.quote_email_message_tmpl_id; newPref.invoice_tmpl_id = null; newPref.invoice_email_message_tmpl_id = null; newPref.email_to_contacts = quoteRef.email_to_contacts; newPref.email_to_others = quoteRef.email_to_others; newPref.email_bcc_resources = quoteRef.email_bcc_resources; if (emailAccountResource) { var account = new CompanyBLL().GetCompany(newPref.account_id); if (account.resource_id != null) { newPref.email_bcc_account_manager = account.resource_id.ToString(); } } newPref.email_notes = quoteRef.email_notes; newPref.update_time = Tools.Date.DateHelper.ToUniversalTimeStamp(); newPref.update_user_id = userId; if (oldPref == null) { newPref.create_time = newPref.update_time; newPref.create_user_id = userId; newPref.id = refDal.GetNextIdCom(); refDal.Insert(newPref); OperLogBLL.OperLogAdd <crm_account_reference>(newPref, newPref.id, userId, OPER_LOG_OBJ_CATE.REFERENCE, "添加客户报价参数"); } else { refDal.Update(newPref); OperLogBLL.OperLogUpdate <crm_account_reference>(oldPref, newPref, newPref.id, userId, OPER_LOG_OBJ_CATE.REFERENCE, "修改客户报价参数"); } return(true); }
/// <summary> /// 撤销费用审批 /// </summary> public ERROR_CODE REVOKE_EXPENSE(long user_id, string ids, out string re) { re = ""; if (!string.IsNullOrEmpty(ids)) { var idArr = ids.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries); var cadDal = new crm_account_deduction_dal(); var seDal = new sdk_expense_dal(); StringBuilder returnvalue = new StringBuilder(); var timeNow = Tools.Date.DateHelper.ToUniversalTimeStamp(DateTime.Now); foreach (var accId in idArr) { var thisCad = cadDal.FindNoDeleteById(long.Parse(accId)); if (thisCad != null) { if (thisCad.invoice_id != null) { var ci = new ctt_invoice_dal().FindNoDeleteById((long)thisCad.invoice_id); if (ci != null && ci.is_voided != 1) { returnvalue.Append(accId + "条目已经生成发票(发票ID:" + thisCad.invoice_id + "),请先作废该发票\n"); } } else { #region 除条目信息 // var oldCad = cadDal.FindNoDeleteById(long.Parse(accId)); cadDal.SoftDelete(thisCad, user_id); OperLogBLL.OperLogDelete <crm_account_deduction>(thisCad, thisCad.id, user_id, OPER_LOG_OBJ_CATE.ACCOUNT_DEDUCTION, "删除审批并提交条目"); #endregion #region 修改费用表 if (thisCad.object_id != null) { var se = seDal.FindNoDeleteById((long)thisCad.object_id); if (se != null) { var oldSe = seDal.FindNoDeleteById((long)thisCad.object_id); se.approve_and_post_date = null; se.approve_and_post_user_id = null; se.amount_deduction = null; se.update_time = timeNow; se.update_user_id = user_id; seDal.Update(se); OperLogBLL.OperLogUpdate <sdk_expense>(se, oldSe, se.id, user_id, OPER_LOG_OBJ_CATE.SDK_EXPENSE, "修改费用"); } } #endregion } } } } return(ERROR_CODE.SUCCESS); }
/// <summary> /// 编辑目标 /// </summary> public void EditApproval(sys_resource_approver appro, long userId) { sys_resource_approver_dal sraDal = new sys_resource_approver_dal(); sys_resource_approver oldAppro = sraDal.FindById(appro.id); if (oldAppro == null) { return; } sraDal.Update(appro); OperLogBLL.OperLogUpdate <sys_resource_approver>(appro, oldAppro, appro.id, userId, OPER_LOG_OBJ_CATE.RESOURCE, ""); }
/// <summary> /// 编辑库存产品 /// </summary> /// <param name="pdt"></param> /// <param name="sn"></param> /// <param name="userId"></param> /// <returns></returns> public bool EditIvtProduct(ivt_warehouse_product pdt, string sn, long userId) { ivt_warehouse_product product = dal.FindById(pdt.id); ivt_warehouse_product productOld = dal.FindById(pdt.id); if (product == null) { return(false); } product.reference_number = pdt.reference_number; product.bin = pdt.bin; product.quantity_minimum = pdt.quantity_minimum; product.quantity_maximum = pdt.quantity_maximum; product.quantity = pdt.quantity; product.update_time = Tools.Date.DateHelper.ToUniversalTimeStamp(); product.update_user_id = userId; string desc = OperLogBLL.CompareValue <ivt_warehouse_product>(productOld, product); if (!string.IsNullOrEmpty(desc)) { dal.Update(product); OperLogBLL.OperLogUpdate(desc, product.id, userId, DicEnum.OPER_LOG_OBJ_CATE.INVENTORY_ITEM, "修改库存产品"); } if (product.quantity != productOld.quantity) // 修改库存数量记录库存转移 { var transferDal = new ivt_transfer_dal(); var trsf = new ivt_transfer(); trsf.id = dal.GetNextIdCom(); trsf.create_time = Tools.Date.DateHelper.ToUniversalTimeStamp(); trsf.create_user_id = userId; trsf.update_time = trsf.create_time; trsf.update_user_id = userId; trsf.quantity = product.quantity - productOld.quantity; trsf.type_id = (int)DicEnum.INVENTORY_TRANSFER_TYPE.MANUAL; trsf.product_id = product.product_id; trsf.from_warehouse_id = (long)product.warehouse_id; trsf.notes = ""; transferDal.Insert(trsf); OperLogBLL.OperLogAdd <ivt_transfer>(trsf, trsf.id, userId, DicEnum.OPER_LOG_OBJ_CATE.INVENTORY_ITEM_TRANSFER, "新增库存转移"); } //OperLogBLL.OperLogUpdate<ivt_warehouse_product>(product, productOld, product.id, userId, DicEnum.OPER_LOG_OBJ_CATE.INVENTORY_ITEM, "修改库存产品"); string sql = $"update ivt_warehouse_product_sn set delete_user_id={userId},delete_time={Tools.Date.DateHelper.ToUniversalTimeStamp()} where warehouse_product_id={product.id}"; dal.ExecuteSQL(sql); SaveProductSn(sn, product.id, userId); return(true); }
/// <summary> /// 编辑销售订单 /// </summary> public void EditSaleOrder(crm_sales_order sale, long userId) { var oldSale = GetSaleOrder(sale.id); if (oldSale == null) { return; } sale.update_time = Tools.Date.DateHelper.ToUniversalTimeStamp(DateTime.Now); sale.update_user_id = userId; _dal.Update(sale); OperLogBLL.OperLogUpdate <crm_sales_order>(sale, oldSale, sale.id, userId, OPER_LOG_OBJ_CATE.SALE_ORDER, ""); }
/// <summary> /// 编辑工作组员工 /// </summary> public bool EditGroupResource(sys_workgroup_resouce group, long userId) { sys_workgroup_resouce_dal swrDal = new sys_workgroup_resouce_dal(); var oldGroup = swrDal.FindById(group.id); if (oldGroup == null) { return(false); } swrDal.Update(group); OperLogBLL.OperLogUpdate <sys_workgroup_resouce>(group, oldGroup, group.id, userId, DicEnum.OPER_LOG_OBJ_CATE.SYS_WORKGROUP_RESOURCE, ""); return(true); }
/// <summary> /// 编辑联系人 /// </summary> public void EditContact(crm_contact contact, long userId) { var oldcon = _dal.FindNoDeleteById(contact.id); if (oldcon == null) { return; } contact.update_time = Tools.Date.DateHelper.ToUniversalTimeStamp(DateTime.Now); contact.update_user_id = userId; _dal.Update(contact); OperLogBLL.OperLogUpdate <crm_contact>(contact, oldcon, contact.id, userId, OPER_LOG_OBJ_CATE.CONTACTS, ""); }
/// <summary> /// 编辑队列 /// </summary> public bool EditQueue(sys_department queue, long userId) { var oldQueue = _dal.FindNoDeleteById(queue.id); if (oldQueue == null) { return(false); } queue.update_time = Tools.Date.DateHelper.ToUniversalTimeStamp(DateTime.Now); queue.update_user_id = userId; _dal.Update(queue); OperLogBLL.OperLogUpdate <sys_department>(queue, oldQueue, queue.id, userId, OPER_LOG_OBJ_CATE.DEPARTMENT, ""); return(true); }
/// <summary> /// 编辑知识库 /// </summary> public bool UpdateKnow(sdk_kb_article thisArt, long userId) { var oldArt = _dal.FindNoDeleteById(thisArt.id); if (oldArt == null) { return(false); } thisArt.update_time = Tools.Date.DateHelper.ToUniversalTimeStamp(DateTime.Now); thisArt.update_user_id = userId; _dal.Update(thisArt); OperLogBLL.OperLogUpdate <sdk_kb_article>(thisArt, oldArt, thisArt.id, userId, OPER_LOG_OBJ_CATE.SDK_KONWLEDGE, "编辑知识库"); return(true); }
/// <summary> /// 编辑费用 /// </summary> public void EditExpense(sdk_expense expense, long userId) { var expDal = new sdk_expense_dal(); var oldExpense = expDal.FindNoDeleteById(expense.id); if (oldExpense == null) { return; } expense.update_time = Tools.Date.DateHelper.ToUniversalTimeStamp(DateTime.Now); expense.update_user_id = userId; expDal.Update(expense); OperLogBLL.OperLogUpdate <sdk_expense>(expense, oldExpense, expense.id, userId, OPER_LOG_OBJ_CATE.SDK_EXPENSE, ""); }
public bool EditProduct(ivt_product product, long userId) { var oldProduct = _dal.FindNoDeleteById(product.id); if (oldProduct == null) { return(false); } product.update_time = Tools.Date.DateHelper.ToUniversalTimeStamp(); product.update_user_id = userId; _dal.Update(product); OperLogBLL.OperLogUpdate <ivt_product>(product, oldProduct, product.id, userId, OPER_LOG_OBJ_CATE.PRODUCT, ""); return(true); }
/// <summary> /// 编辑工作组 /// </summary> public bool EditGroup(sys_workgroup group, long userId) { sys_workgroup_dal swDal = new sys_workgroup_dal(); var oldGroup = swDal.FindNoDeleteById(group.id); if (oldGroup == null) { return(false); } group.update_time = Tools.Date.DateHelper.ToUniversalTimeStamp(DateTime.Now); group.update_user_id = userId; swDal.Update(group); OperLogBLL.OperLogUpdate <sys_workgroup>(group, oldGroup, group.id, userId, DicEnum.OPER_LOG_OBJ_CATE.SYS_WORKGROUP, ""); return(true); }
/// <summary> /// 编辑员工的密码 /// </summary> public bool ChangeUserPass(sys_user user, long userId) { var userDal = new sys_user_dal(); var userOld = userDal.FindById(user.id); if (userOld == null) { return(false); } if (userOld.password != user.password) { userDal.Update(user); OperLogBLL.OperLogUpdate <sys_user>(user, userOld, user.id, userId, OPER_LOG_OBJ_CATE.RESOURCE, "修改员工密码"); } return(true); }
/// <summary> /// 改变系统设置的值 /// </summary> public void ChangeSetValue(long setId, string setValue, long userId) { var thisSet = dal.FindById(setId); if (thisSet == null) { return; } if (thisSet.setting_value != setValue) { var oldSet = dal.FindById(setId); thisSet.setting_value = setValue; dal.Update(thisSet); OperLogBLL.OperLogUpdate <sys_system_setting>(thisSet, oldSet, thisSet.id, userId, DicEnum.OPER_LOG_OBJ_CATE.SERVICE_CALL, "编辑系统设置"); } }
/// <summary> /// 编辑模板 /// </summary> public bool EditFormTmpl(sys_form_tmpl tmpl, long userId) { var oldTemp = _dal.FindNoDeleteById(tmpl.id); if (oldTemp == null) { return(false); } if (!CheckTempCode(tmpl.speed_code, tmpl.id)) { return(false); } tmpl.update_time = Tools.Date.DateHelper.ToUniversalTimeStamp(DateTime.Now); tmpl.update_user_id = userId; _dal.Update(tmpl); OperLogBLL.OperLogUpdate <sys_form_tmpl>(tmpl, oldTemp, tmpl.id, userId, OPER_LOG_OBJ_CATE.FROM, ""); return(true); }
/// <summary> /// 设置预付为停用状态 /// </summary> /// <param name="blockId"></param> /// <param name="userId"></param> /// <returns></returns> public bool SetBlockInactive(long blockId, long userId) { var entity = dal.FindById(blockId); var entityOld = dal.FindById(blockId); if (entity.is_billed == 1) { return(false); } entity.status_id = 0; entity.update_time = Tools.Date.DateHelper.ToUniversalTimeStamp(DateTime.Now); entity.update_user_id = userId; dal.Update(entity); OperLogBLL.OperLogUpdate <ctt_contract_block>(entity, entityOld, entity.id, userId, OPER_LOG_OBJ_CATE.CONTRACT_BLOCK, "修改预付设置为停用状态"); return(true); }
/// <summary> /// 编辑物料代码 /// </summary> public bool EditCode(d_cost_code code, long userId) { d_cost_code oldCode = GetCodeById(code.id); if (oldCode == null) { return(false); } if (!CheckCodeName(code.name, code.cate_id, code.id)) { return(false); } code.update_time = Tools.Date.DateHelper.ToUniversalTimeStamp(DateTime.Now); code.update_user_id = userId; _dal.Update(code); OperLogBLL.OperLogUpdate <d_cost_code>(code, oldCode, code.id, userId, OPER_LOG_OBJ_CATE.D_COST_CODE, ""); return(true); }
/// <summary> /// 编辑员工的周目标 /// </summary> public bool EditResAvaGoal(long resAvaId, decimal goal, long userId) { sys_resource_availability thisResAva = GetResourceAvailabilityById(resAvaId); if (thisResAva == null) { return(false); } if (thisResAva.goal != goal) { sys_resource_availability oldResAva = GetResourceAvailabilityById(resAvaId); thisResAva.goal = goal; thisResAva.update_user_id = userId; thisResAva.update_time = Tools.Date.DateHelper.ToUniversalTimeStamp(DateTime.Now); new sys_resource_availability_dal().Update(thisResAva); OperLogBLL.OperLogUpdate <sys_resource_availability>(thisResAva, oldResAva, thisResAva.id, userId, OPER_LOG_OBJ_CATE.RESOURCE, ""); } return(true); }