private string DoAdd() { Model.businessNature model = new Model.businessNature(); BLL.businessNature bll = new BLL.businessNature(); if (string.IsNullOrEmpty(txtTitle.Text.Trim())) { return("请填写业务性质"); } if (bll.Exists(txtTitle.Text.Trim())) { return("该业务性质名称已存在"); } model.na_name = txtTitle.Text.Trim(); model.na_sort = Utils.StrToInt(txtSortId.Text.Trim(), 0); model.na_isUse = cbIsUse.Checked; model.na_flag = cbIsFinance.Checked; model.na_type = cbType.Checked; int _naid = bll.Add(model); if (_naid > 0) { //更新一下域名缓存 //CacheHelper.Remove(DTKeys.CACHE_SITE_HTTP_DOMAIN); //Undo logmodel = new Model.business_log(); logmodel.ol_relateID = _naid; logmodel.ol_title = "添加业务性质"; logmodel.ol_content = model.na_name; logmodel.ol_operateDate = DateTime.Now; AddBusinessLog(DTEnums.ActionEnum.Add.ToString(), logmodel); //记录日志 return(""); } return("添加失败"); }
//批量删除 protected void btnDelete_Click(object sender, EventArgs e) { //ChkAdminLevel("sys_customer_list", DTEnums.ActionEnum.Delete.ToString()); //检查权限 BLL.Contacts bll = new BLL.Contacts(); string result = ""; log = new Model.business_log(); string idstr = string.Empty; int success = 0, error = 0; StringBuilder sb = new StringBuilder(); for (int i = 0; i < rptList.Items.Count; i++) { int id = Convert.ToInt32(((HiddenField)rptList.Items[i].FindControl("hidId")).Value); CheckBox cb = (CheckBox)rptList.Items[i].FindControl("chkId"); if (cb.Checked) { result = bll.Delete(Convert.ToInt32(id), manager); if (result == "") { success++; } else { error++; sb.Append(result + "<br/>"); } } } JscriptMsg("共选择" + (success + error) + "条记录,成功" + success + "条,失败" + error + "条<br/>" + sb.ToString(), "customer_edit.aspx?action=" + action + "&id=" + this.id); }
private string DoAdd() { Model.payMethod model = new Model.payMethod(); BLL.payMethod bll = new BLL.payMethod(); if (string.IsNullOrEmpty(txtTitle.Text.Trim())) { return("请填写收付款方式"); } if (bll.Exists(txtTitle.Text.Trim())) { return("该收付款方式已存在"); } model.pm_name = txtTitle.Text.Trim(); model.pm_isUse = cbIsUse.Checked; model.pm_sort = Utils.StrToInt(txtSortId.Text.Trim(), 0); model.pm_type = cbIsType.Checked; int _naid = bll.Add(model); if (_naid > 0) { //更新一下域名缓存 //CacheHelper.Remove(DTKeys.CACHE_SITE_HTTP_DOMAIN); //Undo logmodel = new Model.business_log(); logmodel.ol_relateID = _naid; logmodel.ol_title = "添加收付款方式"; logmodel.ol_content = model.pm_name + ",状态:" + (cbIsUse.Checked ? "启用" : "禁用"); logmodel.ol_operateDate = DateTime.Now; AddBusinessLog(DTEnums.ActionEnum.Add.ToString(), logmodel); //记录日志 return(""); } return("添加失败"); }
/// <summary> /// 增加一条数据 /// </summary> public string Add(Model.invoiceUnit model, Model.manager manager) { if (string.IsNullOrEmpty(model.invU_area)) { return("请选择所属区域"); } if (string.IsNullOrEmpty(model.invU_name)) { return("请填写开票单位"); } if (Exists(model.invU_area, model.invU_name)) { return("该区域下已存在相同的开票单位,请检查"); } int ret = dal.Add(model); if (ret > 0) { StringBuilder content = new StringBuilder(); content.Append("所属区域:" + model.invU_area + "<br/>"); content.Append("开票单位:" + model.invU_name + "<br/>"); content.Append("联系人:" + model.invU_contact + "<br/>"); content.Append("联系电话:" + model.invU_contactPhone + "<br/>"); content.Append("启用状态:" + (model.invU_flag.Value ? "启用" : "禁用") + ""); Model.business_log logmodel = new Model.business_log(); logmodel.ol_relateID = ret; logmodel.ol_title = "添加开票单位"; logmodel.ol_content = content.ToString(); logmodel.ol_operateDate = DateTime.Now; new business_log().Add(DTEnums.ActionEnum.Add.ToString(), logmodel, manager.user_name, manager.real_name); //记录日志 return(""); } return("添加失败"); }
/// <summary> /// 更新一条数据 /// </summary> public string Update(Model.invoiceUnit model, string content, Model.manager manager) { if (model == null) { return("数据不存在"); } if (string.IsNullOrEmpty(model.invU_area)) { return("请选择所属区域"); } if (string.IsNullOrEmpty(model.invU_name)) { return("请填写开票单位"); } if (Exists(model.invU_area, model.invU_name, model.invU_id.Value)) { return("该区域下已存在相同的开票单位,请检查"); } if (dal.Update(model)) { Model.business_log logmodel = new Model.business_log(); logmodel.ol_relateID = model.invU_id.Value; logmodel.ol_title = "编辑开票单位"; logmodel.ol_content = content; logmodel.ol_operateDate = DateTime.Now; new business_log().Add(DTEnums.ActionEnum.Add.ToString(), logmodel, manager.user_name, manager.real_name); //记录日志 return(""); } return("更新失败"); }
/// <summary> /// 付款明细汇总页面批量填写付款方式 /// </summary> /// <param name="cid"></param> /// <param name="method"></param> /// <param name="sdate"></param> /// <param name="edate"></param> /// <param name="manager"></param> /// <returns></returns> public string mutliUpdateMethod(int cid, int method, int oldmethod, string sdate, string edate, Model.manager manager) { if (!new BLL.permission().checkHasPermission(manager, "0401"))//如果不是财务 { return("无权限编辑"); } if (oldmethod == 0 && method == 0) { return("请选择付款方式"); } if (oldmethod == method) { return("付款方式未改变"); } string idStr = string.Empty; int count = dal.mutliUpdateMethod(cid, method, oldmethod, sdate, edate, manager, out idStr); if (count > 0) { Model.business_log logmodel = new Model.business_log(); logmodel.ol_oid = ""; logmodel.ol_relateID = 0; logmodel.ol_cid = cid; logmodel.ol_title = "批量更新付款方式"; logmodel.ol_content = "更新付款方式:" + oldmethod + "→<font color='red'>" + method + "</font><br/>记录ID为" + idStr; logmodel.ol_operateDate = DateTime.Now; new business_log().Add(DTEnums.ActionEnum.Edit.ToString(), logmodel, manager.user_name, manager.real_name); //记录日志 return(""); } return("失败"); }
/// <summary> /// 删除凭证 /// </summary> /// <param name="id"></param> /// <param name="username"></param> /// <param name="realname"></param> /// <returns></returns> public string deleteCertificate(int id, string username, string realname) { Model.certificates model = GetModel(id); if (model == null) { return("凭证不存在"); } if (model.ce_flag == 2) { return("审批通过的不能删除"); } //判断是否被使用 DataSet ds = new BLL.ReceiptPay().GetList(0, "rp_ceid=" + id, ""); if (ds != null && ds.Tables[0].Rows.Count > 0) { return("该凭证已被使用,不能删除"); } if (dal.Delete(id)) { Model.business_log logmodel = new Model.business_log(); logmodel.ol_relateID = id; logmodel.ol_title = "删除凭证"; logmodel.ol_content = "凭证号:" + model.ce_num + "<br/>凭证日期:" + model.ce_date.Value.ToString("yyyy-MM-dd") + ""; logmodel.ol_operateDate = DateTime.Now; new business_log().Add(DTEnums.ActionEnum.Delete.ToString(), logmodel, username, realname); return(""); } return("删除失败"); }
/// <summary> /// 客户审批 /// </summary> /// <param name="ids"></param> /// <param name="status"></param> /// <param name="username"></param> /// <param name="realname"></param> /// <returns></returns> public string checkStatus(int id, byte?status, Model.manager manager) { Model.Customer model = GetModel(id); if (model == null) { return("客户不存在"); } if (model.c_flag == status) { return("状态未变更"); } //2.验证有没有权限审批 if (!new BLL.permission().checkHasPermission(manager, "0301")) { return("没有客户管理权限0301"); } if (dal.updateStatus(id, status)) { //写日志 Model.business_log log = new Model.business_log(); log.ol_title = "审批客户状态"; log.ol_cid = id; log.ol_content = "审批状态:" + Common.BusinessDict.checkStatus()[model.c_flag] + "→<font color='red'>" + Common.BusinessDict.checkStatus()[status] + "</font><br/>";; new business_log().Add(DTEnums.ActionEnum.Audit.ToString(), log, manager.user_name, manager.real_name); return(""); } return("操作失败"); }
/// <summary> /// 增加一条数据 /// </summary> public string Add(Model.certificates model, out int id) { id = 0; if (string.IsNullOrEmpty(model.ce_num)) { return("请填写凭证号"); } if (model.ce_date == null) { return("请填写凭证日期"); } if (Exists(model.ce_num, model.ce_date)) { return("凭证号、凭证日期重复"); } model.ce_flag = 0; id = dal.Add(model); if (id > 0) { Model.business_log logmodel = new Model.business_log(); logmodel.ol_relateID = id; logmodel.ol_title = "添加凭证"; logmodel.ol_content = "凭证号:" + model.ce_num + "<br/>凭证日期:" + model.ce_date.Value.ToString("yyyy-MM-dd") + ""; logmodel.ol_operateDate = DateTime.Now; new business_log().Add(DTEnums.ActionEnum.Audit.ToString(), logmodel, model.ce_personNum, model.ce_personName); return("添加成功"); } return("添加失败"); }
/// <summary> /// 增加一条数据 /// </summary> public int Add(string action_type, Model.business_log model, string username, string realname) { model.ol_operaterNum = username; model.ol_operaterName = realname; model.ol_operateDate = DateTime.Now; model.ol_type = action_type; return(dal.Add(model)); }
/// <summary> /// 更新一条数据 /// </summary> public string Update(Model.manager model, string content, Model.manager manager, bool flag = true, bool updateName = false, bool updateContact = false) { if (model.role_id == 0) { return("请选择用户角色"); } if (string.IsNullOrEmpty(model.user_name)) { return("用户名不能为空"); } if (Exists(model.user_name, model.id)) { return("用户名已经存在"); } if (string.IsNullOrEmpty(model.password)) { return("密码不能为空"); } if (string.IsNullOrEmpty(model.real_name)) { return("姓名不能为空"); } if (string.IsNullOrEmpty(model.telephone)) { return("电话不能为空"); } if (flag) { if (model.departID == 0) { return("岗位不能为空"); } Model.department de = new BLL.department().GetModel(model.departID); if (de == null) { return("岗位不存在"); } if (de.de_type != 3) { return("请选择到岗位级别"); } } model.user_name = model.user_name.ToUpper(); model.area = model.area.ToUpper(); string result = dal.Update(model, updateName, updateContact); if (string.IsNullOrEmpty(result)) { Model.business_log logmodel = new Model.business_log(); logmodel.ol_relateID = model.id; logmodel.ol_title = "编辑用户"; logmodel.ol_content = content; logmodel.ol_operateDate = DateTime.Now; new business_log().Add(DTEnums.ActionEnum.Edit.ToString(), logmodel, manager.user_name, manager.real_name); return(""); } return(result); }
/// <summary> /// 写入业务日志 /// </summary> /// <param name="action_type">操作类型</param> /// <param name="remark"></param> /// <returns></returns> public bool AddBusinessLog(string action_type, Model.business_log modelLog) { Model.manager model = GetAdminInfo(); int newId = new BLL.business_log().Add(action_type, modelLog, model.user_name, model.real_name); if (newId > 0) { return(true); } return(false); }
/// <summary> /// 对账 /// </summary> /// <param name="fin_id"></param> /// <param name="oid">订单号</param> /// <param name="num">对账标识</param> /// <param name="money">对账金额</param> /// <param name="manager"></param> /// <returns></returns> public string addFinancechk(int?fin_id, string oid, string num, decimal?money, Model.manager manager, int fcid = 0, bool flag = false) { if (!new BLL.permission().checkHasPermission(manager, "0406")) { return("无权限操作"); } Model.finance_chk model = new Model.finance_chk(); StringBuilder content = new StringBuilder(); if (fcid > 0) { model = GetModel(fcid); if (model.fc_num != num) { content.Append("对账标识:" + model.fc_num + "→<font color='red'>" + num + "</font><br/>"); } model.fc_num = num; if (model.fc_money != money) { content.Append("对账金额:" + model.fc_money + "→<font color='red'>" + money + "</font><br/>"); } model.fc_money = money; } else { model.fc_finid = fin_id; model.fc_oid = oid; model.fc_num = num; model.fc_money = money; model.fc_number = manager.user_name; model.fc_name = manager.real_name; model.fc_addDate = DateTime.Now; content.Append("对账标识:" + num + "<br/>"); content.Append("对账金额:" + money + "<br/>"); } if (flag) { dal.DeleteByFinid(fin_id.Value); } bool result = fcid > 0 ? Update(model) : dal.Add(model) > 0; if (result) { Model.business_log logmodel = new Model.business_log(); logmodel.ol_relateID = fin_id.Value; logmodel.ol_oid = oid; logmodel.ol_title = "添加对账"; logmodel.ol_content = content.ToString(); logmodel.ol_operateDate = DateTime.Now; new business_log().Add(DTEnums.ActionEnum.Add.ToString(), logmodel, manager.user_name, manager.real_name); //记录日志 return(""); } return("对账失败"); }
/// <summary> /// 开票 /// </summary> /// <param name="id"></param> /// <param name="status"></param> /// <param name="username"></param> /// <param name="realname"></param> /// <returns></returns> public string confirmInvoice(int id, bool?status, string date, Model.manager adminModel) { if (status.Value && string.IsNullOrEmpty(date)) { return("请填写开票日期"); } Model.invoices model = GetModel(id); if (model == null) { return("数据不存在"); } if (model.inv_isConfirm == status) { return("状态未变更"); } if (model.inv_flag3 != 2) { return("财务审批未通过,不能开票"); } if (!new permission().checkHasPermission(adminModel, "0408")) { return("无权限开票"); } string _content = "发票id:" + id + ",开票状态:" + Common.BusinessDict.invoiceConfirmStatus()[model.inv_isConfirm] + "→<font color='red'>" + Common.BusinessDict.invoiceConfirmStatus()[status] + "</font>,开票日期:" + date; if (dal.confirmInvoice(id, status, ConvertHelper.toDate(date), adminModel.user_name, adminModel.real_name)) { //写日志 Model.business_log log = new Model.business_log(); log.ol_title = "发票开票"; log.ol_oid = model.inv_oid; log.ol_cid = model.inv_cid.Value; log.ol_relateID = id; log.ol_content = _content; new business_log().Add(DTEnums.ActionEnum.Audit.ToString(), log, adminModel.user_name, adminModel.real_name); //信息通知下申请通知人、业务员 if (status.Value) { string replaceContent = new BLL.Customer().GetModel(model.inv_cid.Value).c_name + "," + model.inv_money; string replaceUser = adminModel.user_name + "," + adminModel.real_name; new BLL.selfMessage().AddMessage("开票申请财务已开具", model.inv_personNum, model.inv_personName, replaceContent, replaceUser); //通知业务员 DataSet ds = new BLL.Order().GetPersonList(0, "op_oid='" + model.inv_oid + "' and op_type=1", ""); if (ds != null && ds.Tables[0].Rows.Count > 0) { new BLL.selfMessage().AddMessage("开票申请财务已开具", ds.Tables[0].Rows[0]["op_number"].ToString(), ds.Tables[0].Rows[0]["op_name"].ToString(), replaceContent, replaceUser); } } return(""); } return("操作失败"); }
/// <summary> /// 更新一条数据 /// </summary> public string Update(Model.customerBank model, string content, Model.manager manager) { if (string.IsNullOrEmpty(model.cb_bankName)) { return("请填写银行账户名称"); } if (string.IsNullOrEmpty(model.cb_bankNum)) { return("请填写客户银行账号"); } if (Exists(model.cb_bankNum, model.cb_cid.Value, model.cb_id.Value)) { return("该银行账号已存在"); } if (string.IsNullOrEmpty(model.cb_bank)) { return("请填写开户行"); } if (string.IsNullOrEmpty(model.cb_bankAddress)) { return("请填写开户地址"); } Model.Customer cu = new BLL.Customer().GetModel(model.cb_cid.Value); if (cu == null) { return("客户不存在"); } if (cu.c_flag == 2) { return("客户已经审批通过,不能编辑联系人"); } if (cu.c_owner != manager.user_name && cu.c_ownerName != manager.real_name) { if (!new BLL.permission().checkHasPermission(manager, "0301")) { return("不是客户所属人或无权限修改客户信息"); } } if (dal.Update(model)) { Model.business_log log = new Model.business_log(); log.ol_cid = model.cb_cid.Value; log.ol_relateID = model.cb_id.Value; log.ol_title = "编辑客户银行账号"; log.ol_content = content; log.ol_operateDate = DateTime.Now; log.ol_operaterNum = manager.user_name; log.ol_operaterName = manager.real_name; new business_log().Add(DTEnums.ActionEnum.Edit.ToString(), log, manager.user_name, manager.real_name); return(""); } return("更新失败"); }
/// <summary> /// 合并客户 /// </summary> /// <param name="cid1">源客户ID</param> /// <param name="cname1">源客户名称</param> /// <param name="cid2">目标客户ID</param> /// <param name="cname2">目标客户名称</param> /// <param name="username">操作人ID</param> /// <param name="realname">操作人姓名</param> /// <returns></returns> public string mergeCustomer(int cid1, string cname1, int cid2, string cname2, Model.manager manager) { if (cid1 == 0 || string.IsNullOrEmpty(cname1)) { return("请填写源客户"); } if (cid2 == 0 || string.IsNullOrEmpty(cname2)) { return("请填写目标客户"); } if (cid1 == cid2) { return("源客户和目标客户不能是同一个客户"); } //判断有没有权限合并客户 if (!new BLL.permission().checkHasPermission(manager, "0301")) { return("没有客户管理权限0301"); } Model.Customer model1 = GetModel(cid1); Model.Customer model2 = GetModel(cid2); if (model1 == null || model2 == null) { return("数据异常"); } if (model1.c_type != model2.c_type) { return("只能合并客户类别相同的客户"); } bool _updateCustomer = false; StringBuilder logcontent = new StringBuilder(); logcontent.Append("源客户:" + cid1 + "," + cname1 + "<br/>"); logcontent.Append("目标客户:" + cid2 + "," + cname2 + "<br/>"); if (model1.c_isUse.Value && !model2.c_isUse.Value) { model2.c_isUse = true; _updateCustomer = true; logcontent.Append("目标客户启用状态变更:禁用→<font color='red'>启用</font>"); } if (dal.mergeCustomer(cid1, cname1, model2, manager.user_name, manager.real_name, _updateCustomer)) { //写日志 Model.business_log log = new Model.business_log(); log.ol_title = "合并客户"; log.ol_cid = cid2; string _content = string.Empty; log.ol_content = logcontent.ToString(); new business_log().Add(DTEnums.ActionEnum.Merge.ToString(), log, manager.user_name, manager.real_name); return(""); } return("客户合并失败"); }
/// <summary> /// 删除一条数据 /// </summary> public string Delete(int id, Model.manager manager) { Model.invoices model = GetModel(id); if (model == null) { return("数据不存在"); } if (model.inv_flag3 == 2) { return("最终审批通过不能再编辑"); } Model.Order order = new BLL.Order().GetModel(model.inv_oid); if (order == null) { return("订单不存在"); } if (!new BLL.permission().checkHasPermission(manager, "0401"))//如果不是财务 { //验证权限:在同一个订单里,业务员与业务报账员可以对未审核地接进行编辑与删除!执行人员只能对自己地址进行编辑与删除操作! if (model.inv_personNum != manager.user_name && order.personlist.Where(p => p.op_number == manager.user_name && (p.op_type == 3 || p.op_type == 4)).ToArray().Length > 0) { return("无权限删除"); } } else { if (model.inv_personNum != manager.user_name && !new BLL.permission().checkHasPermission(manager, "0403")) { return("非申请人或没有删除他人数据权限不能删除"); } } if (dal.Delete(id)) { StringBuilder content = new StringBuilder(); content.Append("购买方名称:" + model.inv_purchaserName + "<br/>"); content.Append("购买方账号:" + model.inv_purchaserBankNum + "<br/>"); content.Append("金额:" + model.inv_money + "<br/>"); content.Append("应税劳务、服务名称:" + model.inv_serviceType + "," + model.inv_serviceName + "<br/>"); content.Append("送票方式:" + model.inv_sentWay + "<br/>"); content.Append("开票区域:" + model.inv_darea + "<br/>"); Model.business_log logmodel = new Model.business_log(); logmodel.ol_relateID = model.inv_id.Value; logmodel.ol_oid = model.inv_oid; logmodel.ol_cid = model.inv_cid.Value; logmodel.ol_title = "删除发票"; logmodel.ol_content = content.ToString(); logmodel.ol_operateDate = DateTime.Now; new business_log().Add(DTEnums.ActionEnum.Delete.ToString(), logmodel, manager.user_name, manager.real_name); //记录日志 return(""); } return("删除失败"); }
/// <summary> /// 更新一条数据 /// </summary> public string Update(Model.Contacts model, Model.manager manager, string content) { if (string.IsNullOrEmpty(model.co_name)) { return("请填写联系人"); } if (string.IsNullOrEmpty(model.co_number)) { return("请填写联系号码"); } Model.Customer cu = new BLL.Customer().GetModel(model.co_cid.Value); if (cu == null) { return("客户不存在"); } if (cu.c_flag == 2) { return("客户已经审批通过,不能编辑联系人"); } if (cu.c_type == 3) { return("内部客户不能编辑"); } if (cu.c_owner != manager.user_name && cu.c_ownerName != manager.real_name) { if (!new BLL.permission().checkHasPermission(manager, "0301")) { return("不是客户所属人或无权限修改客户信息"); } } if (cu.c_type != 2) { string existMsg = Exists(model.co_number, model.co_id.Value); if (!string.IsNullOrEmpty(existMsg)) { return(existMsg); } } if (dal.Update(model)) { Model.business_log log = new Model.business_log(); log.ol_cid = model.co_cid.Value; log.ol_title = "修改客户联系人"; log.ol_content = content; log.ol_operateDate = DateTime.Now; new business_log().Add(DTEnums.ActionEnum.Edit.ToString(), log, manager.user_name, manager.real_name); return(""); } return("修改失败"); }
/// <summary> /// 删除一条数据 /// </summary> public string Delete(int id, Model.manager manager) { Model.ReceiptPay model = new BLL.ReceiptPay().GetModel(id); if (model == null) { return("数据不存在"); } if (!new BLL.permission().checkHasPermission(manager, "0401"))//如果不是财务 { return("无权限删除"); } else { if (model.rp_personNum != manager.user_name && !new BLL.permission().checkHasPermission(manager, "0403")) { return("无权限删除"); } } string typeText = "收款"; bool flag = false; if (model.rp_type.Value) { if (model.rp_isConfirm.Value) { return("已经确认收款,不能删除"); } flag = dal.deleteReceipt(id); } else { typeText = "付款"; if (model.rp_isExpect.Value && model.rp_flag1 == 2 && model.rp_money >= 0 && (model.rp_method == 0 || !new BLL.payMethod().GetModel(model.rp_method.Value).pm_type.Value)) { return("最终审批通过不能删除"); } flag = dal.deletePay(model); } if (flag) { Model.business_log logmodel = new Model.business_log(); logmodel.ol_relateID = id; logmodel.ol_title = "删除收款"; logmodel.ol_content = typeText + "ID:" + id + ",金额:" + model.rp_money; logmodel.ol_operateDate = DateTime.Now; new business_log().Add(DTEnums.ActionEnum.Delete.ToString(), logmodel, manager.user_name, manager.real_name); return(""); } return("删除失败"); }
/// <summary> /// 审批应收应付 /// </summary> /// <param name="id"></param> /// <param name="status"></param> /// <param name="remark"></param> /// <param name="manager"></param> /// <returns></returns> public string checkStatus(int id, byte?status, string remark, Model.manager manager) { Model.finance model = GetModel(id); if (model == null) { return("数据不存在"); } if (!string.IsNullOrEmpty(model.fin_month)) { return("已结账,不能审批"); } if (model.fin_flag == status) { return("状态未变更"); } if (manager.area != new BLL.department().getGroupArea() || !new BLL.permission().checkHasPermission(manager, "0405")) { return("无权限审批"); } Model.Order order = new BLL.Order().GetModel(model.fin_oid); if (order != null && order.o_lockStatus == 1) { return("订单已锁单,不能再审批"); } string content = "记录id:" + id + ",审批状态:" + Common.BusinessDict.checkStatus()[model.fin_flag] + "→<font color='red'>" + Common.BusinessDict.checkStatus()[status] + "</font><br/>审批人:" + model.fin_checkNum + "(" + model.fin_checkName + ")→<font color='red'>" + manager.user_name + "(" + manager.real_name + ")</font><br/>审批备注:" + model.fin_checkRemark + "→<font color='red'>" + remark + "</font><br/>"; model.fin_flag = status; model.fin_checkNum = manager.user_name; model.fin_checkName = manager.real_name; model.fin_checkRemark = remark; if (model.fin_flag == 0) { model.fin_checkNum = ""; model.fin_checkName = ""; model.fin_checkRemark = ""; } if (dal.Update(model)) { //写日志 Model.business_log log = new Model.business_log(); log.ol_title = "审批应收付记录"; log.ol_oid = model.fin_oid; log.ol_cid = model.fin_cid.Value; log.ol_content = content; new business_log().Add(DTEnums.ActionEnum.Audit.ToString(), log, manager.user_name, manager.real_name); return(""); } return("审批失败"); }
/// <summary> /// 增加一条数据 /// </summary> public int Add(Model.business_log model, SqlConnection conn = null, SqlTransaction tran = null) { StringBuilder strSql = new StringBuilder(); StringBuilder str1 = new StringBuilder(); //数据字段 StringBuilder str2 = new StringBuilder(); //数据参数 //利用反射获得属性的所有公共属性 PropertyInfo[] pros = model.GetType().GetProperties(); List <SqlParameter> paras = new List <SqlParameter>(); strSql.Append("insert into MS_operateLog("); foreach (PropertyInfo pi in pros) { //如果不是主键则追加sql字符串 if (!pi.Name.Equals("ol_id")) { //判断属性值是否为空 if (pi.GetValue(model, null) != null) { str1.Append(pi.Name + ","); //拼接字段 str2.Append("@" + pi.Name + ","); //声明参数 paras.Add(new SqlParameter("@" + pi.Name, pi.GetValue(model, null))); //对参数赋值 } } } strSql.Append(str1.ToString().Trim(',')); strSql.Append(") values ("); strSql.Append(str2.ToString().Trim(',')); strSql.Append(") "); strSql.Append(";select @@IDENTITY;"); object obj; if (tran == null) { obj = DbHelperSQL.GetSingle(strSql.ToString(), paras.ToArray()); } else { obj = DbHelperSQL.GetSingle(conn, tran, strSql.ToString(), paras.ToArray()); } if (obj == null) { return(0); } else { return(Convert.ToInt32(obj)); } }
/// <summary> /// 删除某条地接下的所有对账 /// </summary> /// <param name="finid"></param> /// <returns></returns> public string delChkByFinID(int finid, string oid, Model.manager manager) { if (dal.DeleteByFinid(finid)) { Model.business_log logmodel = new Model.business_log(); logmodel.ol_relateID = Utils.ObjToInt(finid, 0); logmodel.ol_oid = oid; logmodel.ol_title = "删除地接下的对账信息"; logmodel.ol_content = "地接ID" + finid; logmodel.ol_operateDate = DateTime.Now; new business_log().Add(DTEnums.ActionEnum.Delete.ToString(), logmodel, manager.user_name, manager.real_name); //记录日志 return(""); } return("删除失败"); }
/// <summary> /// 添加活动文件 /// </summary> /// <param name="file"></param> /// <returns></returns> public int insertPayFile(Model.payPic model, Model.manager manager) { int ret = dal.insertPayFile(model); if (ret > 0) { Model.business_log logmodel = new Model.business_log(); logmodel.ol_relateID = model.pp_rid.Value; logmodel.ol_title = model.pp_type == 1?"添加付款明细附件":"添加费业务付款申请附件"; logmodel.ol_content = "文件名:" + model.pp_fileName + ",文件路径:" + model.pp_filePath; logmodel.ol_operateDate = DateTime.Now; new business_log().Add(DTEnums.ActionEnum.Add.ToString(), logmodel, manager.user_name, manager.real_name); } return(ret); }
/// <summary> /// 增加一条数据 /// </summary> public string Add(Model.Customer model, Model.Contacts contact, Model.manager manager, out int cid) { cid = 0; if (string.IsNullOrEmpty(model.c_name)) { return("请填写客户名称"); } if (model.c_type == 0) { return("请选择客户类别"); } if (new BLL.Customer().Exists(model.c_name)) { return("该客户名称已存在"); } if (string.IsNullOrEmpty(model.c_business)) { return("请填写业务范围"); } if (string.IsNullOrEmpty(contact.co_name)) { return("主要联系人不能为空"); } if (string.IsNullOrEmpty(contact.co_number)) { return("主要联系号码不能为空"); } if ((model.c_type == 2 || model.c_type == 3) && !new BLL.permission().checkHasPermission(manager, "0301")) { return("没有客户管理权限0301"); } string result = string.Empty; result = dal.Add(model, contact, out cid); if (string.IsNullOrEmpty(result)) { Model.business_log log = new Model.business_log(); log.ol_title = "添加客户"; log.ol_cid = cid; log.ol_content = "客户名称:" + model.c_name + "<br/>客户类别:" + Common.BusinessDict.customerType()[model.c_type] + "<br/>信用代码(税号):" + model.c_num + "<br/>业务范围:" + model.c_business + "<br/>备注:" + model.c_remarks + "<br/>主要联系人:" + contact.co_name + "<br/>主要联系人号码:" + contact.co_number + ""; log.ol_operateDate = DateTime.Now; log.ol_operaterNum = manager.user_name; log.ol_operaterName = manager.real_name; new business_log().Add(DTEnums.ActionEnum.Add.ToString(), log, manager.user_name, manager.real_name); return(""); } return(result); }
private string DoEdit(int _id) { BLL.payMethod bll = new BLL.payMethod(); Model.payMethod model = bll.GetModel(_id); if (string.IsNullOrEmpty(txtTitle.Text.Trim())) { return("请填写收付款方式"); } if (bll.Exists(txtTitle.Text.Trim(), _id)) { return("该收付款方式已存在"); } string _content = string.Empty; if (model.pm_name != txtTitle.Text.Trim()) { _content += "收付款方式:" + model.pm_name + "→<font color='red'>" + txtTitle.Text.Trim() + "</font><br/>"; } model.pm_name = txtTitle.Text.Trim(); if (model.pm_isUse != cbIsUse.Checked) { _content += "启用状态:" + (model.pm_isUse.Value ? "启用" : "禁用") + "→<font color='red'>" + (cbIsUse.Checked ? "启用" : "禁用") + "</font><br/>"; } model.pm_isUse = cbIsUse.Checked; if (model.pm_type != cbIsType.Checked) { _content += "仅限财务使用:" + (model.pm_type.Value ? "是" : "否") + "→<font color='red'>" + (cbIsType.Checked ? "是" : "否") + "</font><br/>"; } model.pm_type = cbIsType.Checked; model.pm_sort = Utils.StrToInt(txtSortId.Text.Trim(), 0); if (bll.Update(model)) { //CacheHelper.Remove(DTKeys.CACHE_SITE_HTTP_DOMAIN); //更新一下域名缓存 //Undo if (!string.IsNullOrEmpty(_content)) { logmodel = new Model.business_log(); logmodel.ol_relateID = _id; logmodel.ol_title = "修改收付款方式"; logmodel.ol_content = _content; logmodel.ol_operateDate = DateTime.Now; AddBusinessLog(DTEnums.ActionEnum.Edit.ToString(), logmodel); //记录日志 } return(""); } return("修改失败"); }
/// <summary> /// 删除一条数据 /// </summary> public string Delete(int id, Model.manager manager) { Model.department model = GetModel(id); if (model == null) { return("数据不存在"); } if (hasEmployee(id)) { return("该机构下存在员工,不能删除"); } DataTable dt = GetList(id, ""); string idstr = id.ToString() + ","; foreach (DataRow dr in dt.Rows) { idstr += dr["de_id"] + ","; } idstr = idstr.TrimEnd(','); if (dal.Delete(idstr)) { if (model.de_type == 1) { Dictionary <string, string> dic = new Dictionary <string, string>(); DataTable dtt = dal.GetList(0, "de_type=1", "de_sort asc,de_id asc").Tables[0]; if (dtt.Rows.Count > 0) { foreach (DataRow dr in dtt.Rows) { dic.Add(dr["de_area"].ToString(), dr["de_subname"].ToString()); } CacheHelper.Remove(DTKeys.COMPANY_AREA); CacheHelper.Insert(DTKeys.COMPANY_AREA, dic, 10);//重新写入缓存 } } Model.business_log logmodel = new Model.business_log(); logmodel.ol_relateID = id; logmodel.ol_title = "删除部门岗位"; logmodel.ol_content = "机构ID:" + id + "<br/>机构名称:" + model.de_name; logmodel.ol_operateDate = DateTime.Now; new business_log().Add(DTEnums.ActionEnum.Delete.ToString(), logmodel, manager.user_name, manager.real_name); return(""); } return("删除失败"); }
/// <summary> /// 删除一条数据 /// </summary> public string Delete(int id, string username, string realname) { if (dal.isUse(id)) { return("已被使用,不能删除"); } if (dal.Delete(id)) { Model.business_log logmodel = new Model.business_log(); logmodel.ol_relateID = id; logmodel.ol_title = "删除权限"; logmodel.ol_content = "权限ID:" + id; logmodel.ol_operateDate = DateTime.Now; new business_log().Add(DTEnums.ActionEnum.Delete.ToString(), logmodel, username, realname); return(""); } return("删除失败"); }
private string DoEdit(int _id) { BLL.businessDetails bll = new BLL.businessDetails(); Model.businessDetails model = bll.GetModel(_id); if (string.IsNullOrEmpty(ddlnature.SelectedValue)) { return("请选择业务性质"); } model.de_nid = Convert.ToInt32(ddlnature.SelectedValue); if (string.IsNullOrEmpty(txtTitle.Text.Trim())) { return("请填写业务明细"); } if (bll.Exists(txtTitle.Text.Trim(), _id)) { return("该业务明细已存在"); } string _content = string.Empty; if (model.de_name != txtTitle.Text.Trim()) { _content += "业务明细:" + model.de_name + "→<font color='red'>" + txtTitle.Text.Trim() + "</font><br/>"; } model.de_name = txtTitle.Text.Trim(); model.de_sort = Utils.StrToInt(txtSortId.Text.Trim(), 0); model.de_isUse = cbIsUse.Checked; if (bll.Update(model)) { //CacheHelper.Remove(DTKeys.CACHE_SITE_HTTP_DOMAIN); //更新一下域名缓存 //Undo if (!string.IsNullOrEmpty(_content)) { logmodel = new Model.business_log(); logmodel.ol_relateID = _id; logmodel.ol_title = "修改业务明细"; logmodel.ol_content = _content; logmodel.ol_operateDate = DateTime.Now; AddBusinessLog(DTEnums.ActionEnum.Edit.ToString(), logmodel); //记录日志 } return(""); } return("修改失败"); }
/// <summary> /// 删除一条数据 /// </summary> public string Delete(int id, Model.manager manager) { if (checkIsUse(id)) { return("该联系人已被订单使用,不能删除"); } Model.Contacts model = GetModel(id); if (model == null) { return("联系人不存在"); } Model.Customer cu = new BLL.Customer().GetModel(model.co_cid.Value); if (cu == null) { return("客户不存在"); } if (cu.c_flag == 2) { return("客户已经审批通过,不能删除联系人"); } if (model.co_flag.Value) { return("不能删除主要联系人"); } if (cu.c_owner != manager.user_name && cu.c_ownerName != manager.real_name) { if (!new BLL.permission().checkHasPermission(manager, "0301")) { return("不是客户所属人或无权限修改客户信息,不能删除联系人"); } } if (dal.Delete(id)) { Model.business_log log = new Model.business_log(); log.ol_cid = model.co_cid.Value; log.ol_title = "删除客户联系人"; log.ol_content = "次要联系人<br/>联系人:" + model.co_name + "<br/>联系号码:" + model.co_number; log.ol_operateDate = DateTime.Now; new business_log().Add(DTEnums.ActionEnum.Edit.ToString(), log, manager.user_name, manager.real_name); return(""); } return("删除失败"); }
/// <summary> /// 增加一条数据 /// </summary> public string Add(Model.customerBank model, Model.manager manager) { if (model.cb_cid == 0) { return("请选择客户"); } if (string.IsNullOrEmpty(model.cb_bankName)) { return("请填写银行账户名称"); } if (string.IsNullOrEmpty(model.cb_bankNum)) { return("请填写客户银行账号"); } if (Exists(model.cb_bankNum, model.cb_cid.Value)) { return("该银行账号已存在"); } if (string.IsNullOrEmpty(model.cb_bank)) { return("请填写开户行"); } if (string.IsNullOrEmpty(model.cb_bankAddress)) { return("请填写开户地址"); } int ret = dal.Add(model); if (ret > 0) { Model.business_log log = new Model.business_log(); log.ol_cid = model.cb_cid.Value; log.ol_relateID = ret; log.ol_title = "添加客户银行账号"; log.ol_content = "银行账户名称:" + model.cb_bankName + "<br/>客户银行账号:" + model.cb_bankNum + "<br/>开户行:" + model.cb_bank + "<br/>开户地址:" + model.cb_bankAddress + "<br/>状态:" + (model.cb_flag.Value ? "启用" : "禁用"); log.ol_operateDate = DateTime.Now; log.ol_operaterNum = manager.user_name; log.ol_operaterName = manager.real_name; new business_log().Add(DTEnums.ActionEnum.Add.ToString(), log, manager.user_name, manager.real_name); return(""); } return("添加失败"); }