/// <summary> /// 删除知识库目录 /// </summary> public bool DeleteKnowMenu(long cateId, long userId, ref string failReason) { var dgDal = new d_general_dal(); var cate = dgDal.FindNoDeleteById(cateId); if (cate == null) { return(true); } if (cate.parent_id == null) { failReason = "根目录不可删除"; return(false); } var gBll = new GeneralBLL(); ChangeArtCate(cateId, userId, (int)cate.parent_id); //var subMenu = dgDal.GetGeneralByParentId(cateId); //if (subMenu != null && subMenu.Count > 0) // subMenu.ForEach(_ => { // _.parent_id = cate.parent_id; // gBll.EditGeneral(_,userId); // }); //var subArt = _dal.GetArtByCate(cateId); //if(subArt!=null&& subArt.Count > 0) // subArt.ForEach(_=> { // _.kb_category_id = (int)cate.parent_id; // UpdateKnow(_,userId); // }); dgDal.SoftDelete(cate, userId); OperLogBLL.OperLogAdd <d_general>(cate, cate.id, userId, OPER_LOG_OBJ_CATE.General_Code, "删除知识库目录"); return(true); }
/// <summary> /// 修改知识库的类别( 某一类别下的所有知识库包括子类别的所有知识库 ) /// </summary> public void ChangeArtCate(long cateId, long userId, int parentId) { var subArt = _dal.GetArtByCate(cateId); var dgDal = new d_general_dal(); var gBll = new GeneralBLL(); var subMenu = dgDal.GetGeneralByParentId(cateId); if (subArt != null && subArt.Count > 0) { foreach (var art in subArt) { subArt.ForEach(_ => { _.kb_category_id = parentId; UpdateKnow(_, userId); }); } } if (subMenu != null && subMenu.Count > 0) { foreach (var menu in subMenu) { ChangeArtCate(menu.id, userId, parentId); dgDal.SoftDelete(menu, userId); OperLogBLL.OperLogAdd <d_general>(menu, menu.id, userId, OPER_LOG_OBJ_CATE.General_Code, "删除知识库目录"); } } }
/// <summary> /// 页面数据绑定 /// </summary> private void PageDataBind() { var cateList = new d_cost_code_dal().GetListCostCode((int)DicEnum.COST_CODE_CATE.EXPENSE_CATEGORY); expense_cost_code_id.DataTextField = "name"; expense_cost_code_id.DataValueField = "id"; expense_cost_code_id.DataSource = cateList; expense_cost_code_id.DataBind(); var workList = new d_cost_code_dal().GetListCostCode((int)DicEnum.COST_CODE_CATE.GENERAL_ALLOCATION_CODE); cost_code_id.DataTextField = "name"; cost_code_id.DataValueField = "id"; cost_code_id.DataSource = workList; cost_code_id.DataBind(); var payTypeList = new d_general_dal().GetGeneralByTableId((int)GeneralTableEnum.PAYMENT_TYPE); payment_type_id.DataTextField = "name"; payment_type_id.DataValueField = "id"; payment_type_id.DataSource = payTypeList; payment_type_id.DataBind(); RDAddRep.Checked = true; rbAssProTask.Checked = true; }
private void GetActicityInfo(HttpContext context) { var id = context.Request.QueryString["id"]; if (!string.IsNullOrEmpty(id)) { var acti = new com_activity_dal().FindNoDeleteById(long.Parse(id)); if (acti != null) { string accountName = ""; string actiType = ""; if (acti.account_id != null) { var thisAcc = new CompanyBLL().GetCompany((long)acti.account_id); accountName = thisAcc != null ? thisAcc.name : ""; } var thisDic = new d_general_dal().FindNoDeleteById(acti.action_type_id); var startDate = Tools.Date.DateHelper.ConvertStringToDateTime(acti.start_date); var endDate = Tools.Date.DateHelper.ConvertStringToDateTime(acti.end_date); var durHours = ((decimal)acti.end_date - (decimal)acti.start_date) / 1000 / 60 / 60; actiType = thisDic != null ? thisDic.name : ""; context.Response.Write(new Tools.Serialize().SerializeJson(new { accName = accountName, actiType = actiType, startDateString = startDate.ToString("yyyy-MM-dd"), startTimeString = startDate.ToString("HH:mm"), endDateString = endDate.ToString("yyyy-MM-dd"), endTimeString = endDate.ToString("HH:mm"), durHours = durHours.ToString("#0.00") })); } } }
/// <summary> /// 根据字典表ID 获取相应信息 /// </summary> private void GetGenListByTableId(HttpContext context, int table_id) { var genList = new d_general_dal().GetGeneralByTableId(table_id); if (genList != null && genList.Count > 0) { context.Response.Write(new Tools.Serialize().SerializeJson(genList)); } }
/// <summary> /// 根据父ID 获取相应信息 /// </summary> private void GetGeneralByParentId(HttpContext context, long parent_id) { var genList = new d_general_dal().GetGeneralByParentId(parent_id); if (genList != null && genList.Count > 0) { context.Response.Write(new Tools.Serialize().SerializeJson(genList)); } }
private void GetGeneralInfo(HttpContext context, long id) { var general = new d_general_dal().GetGeneralById(id); if (general != null) { context.Response.Write(new EMT.Tools.Serialize().SerializeJson(general)); } }
/// <summary> /// 返回备注的相关信息 /// </summary> private void GetNoteInfo(HttpContext context, long note_id) { var thisNote = new com_activity_dal().FindNoDeleteById(note_id); if (thisNote != null) { var thisRes = new sys_resource_dal().FindNoDeleteById(thisNote.create_user_id); var thisNoteType = new d_general_dal().FindNoDeleteById(thisNote.action_type_id); context.Response.Write(new Tools.Serialize().SerializeJson(new { title = thisNote.name, createUser = thisRes != null?thisRes.name:"", type = thisNoteType != null?thisNoteType.name:"", createDate = Tools.Date.DateHelper.ConvertStringToDateTime(thisNote.create_time).ToString("yyyy-MM-dd"), description = thisNote.description })); } }
protected void Page_Load(object sender, EventArgs e) { try { if (!IsPostBack) { publish_type_id.DataTextField = "name"; publish_type_id.DataValueField = "id"; var pushList = new d_general_dal().GetGeneralByTableId((int)GeneralTableEnum.NOTE_PUBLISH_TYPE); if (pushList != null && pushList.Count > 0) { pushList = pushList.Where(_ => _.ext2 == ((int)DicEnum.ACTIVITY_CATE.PROJECT_NOTE).ToString()).ToList(); } publish_type_id.DataSource = pushList; publish_type_id.DataBind(); } var project_id = Request.QueryString["project_id"]; if (!string.IsNullOrEmpty(project_id)) { thisProject = new pro_project_dal().FindNoDeleteById(long.Parse(project_id)); } var id = Request.QueryString["id"]; if (!string.IsNullOrEmpty(id)) { thisCal = new pro_project_calendar_dal().FindNoDeleteById(long.Parse(id)); if (thisCal != null) { isAdd = false; if (!IsPostBack) { if (thisCal.publish_type_id != null) { publish_type_id.SelectedValue = thisCal.publish_type_id.ToString(); } } thisProject = new pro_project_dal().FindNoDeleteById(thisCal.project_id); } } if (thisProject == null) { Response.End(); } } catch (Exception msg) { Response.Write(msg); Response.End(); } }
/// <summary> /// 根据ID 集合获取相应的服务信息 /// </summary> public void GetServicesByIds(HttpContext context) { var serviceIds = context.Request.QueryString["ids"]; if (!string.IsNullOrEmpty(serviceIds)) { var serList = new ivt_service_dal().GetServiceList($" and id in({serviceIds})"); if (serList != null && serList.Count > 0) { List <ServiceDto> serDtoList = new List <ServiceDto>(); var accBll = new CompanyBLL(); var dDal = new d_general_dal(); var dccDal = new d_cost_code_dal(); serList.ForEach(_ => { var thisDto = new ServiceDto() { id = _.id, name = _.name, description = _.description, unit_cost = (_.unit_cost ?? 0), unit_price = (_.unit_price ?? 0), cost_code_id = _.cost_code_id, period_type_id = _.period_type_id, vendor_id = _.vendor_account_id, }; if (_.vendor_account_id != null) { var thisVendor = accBll.GetCompany((long)_.vendor_account_id); if (thisVendor != null) { thisDto.vendor_name = thisVendor.name; } } if (_.period_type_id != null) { var thisType = dDal.FindNoDeleteById((long)_.period_type_id); if (thisType != null) { thisDto.period_type_name = thisType.name; } } var thisCode = dccDal.FindNoDeleteById(_.cost_code_id); if (thisCode != null) { thisDto.cost_code_name = thisCode.name; } serDtoList.Add(thisDto); }); context.Response.Write(new EMT.Tools.Serialize().SerializeJson(serDtoList)); } } }
/// <summary> /// 获取到页面参数 /// </summary> /// <returns></returns> protected ConfigurationItemAddDto GetParam(string chooseProId) { var param = AssembleModel <ConfigurationItemAddDto>(); if (contract != null) { param.account_id = contract.account_id; } if (thisProject != null) { param.account_id = thisProject.account_id; } param.installed_by = (int)LoginUserId; param.location = ""; param.number_of_users = null; param.status = 1; param.contact_id = null; param.contract_id = null; param.service_id = null; var productId = Request.Form[chooseProId + "_product_id"]; if (productId != "") { var thisProduct = new ivt_product_dal().FindNoDeleteById(long.Parse(productId)); if (thisProduct != null) { param.product_id = thisProduct.id; if (product.installed_product_cate_id != null) { param.installed_product_cate_id = product.installed_product_cate_id; } else { var thisGeneral = new d_general_dal().GetGeneralById((long)product.cate_id); if (thisGeneral != null) { param.installed_product_cate_id = int.Parse(thisGeneral.ext1); } } } } param.vendor_id = null; param.contract_cost_id = conCost.id; // 是否经过合同审核 param.terms = new Terms(); param.notice = new Notice(); param.udf = null; return(param); }
/// <summary> /// 根据不同的报价项选择不同的物料代码(执行不同的jquery代码放到前端执行) /// </summary> /// <returns></returns> private string ReturnJquery() { var scriptText = ""; if (proAndOneTimeItem != null && proAndOneTimeItem.Count > 0) { foreach (var item in proAndOneTimeItem) { if (item.object_id != null) { var product = new EMT.DoneNOW.BLL.ProductBLL().GetProduct((long)item.object_id); if (product != null) { scriptText += $"$('#{item.id}_select').val({product.cost_code_id});"; } } } } // SHIPITEM_COSTCODE_CLOSE if (shipItem != null && shipItem.Count > 0) { var sysSet = new SysSettingBLL().GetSetById(SysSettingEnum.SHIPITEM_COSTCODE_CLOSE); foreach (var item in shipItem) { if (item.object_id != null) { var thisGeneral = new d_general_dal().GetGeneralById((long)item.object_id); if (thisGeneral.parent_id != null) { scriptText += $"$('#{item.id}_select').val({thisGeneral.parent_id});"; } } else if (sysSet != null && (!string.IsNullOrEmpty(sysSet.setting_value))) { scriptText += $"$('#{item.id}_select').val({sysSet.setting_value});"; } } } if (degressionItem != null && degressionItem.Count > 0) { foreach (var item in proAndOneTimeItem) { if (item.object_id != null) { scriptText += $"$('#{item.id}_select').val({item.object_id});"; } } } return(scriptText); }
/// <summary> /// 获取相关目录结构 字符串输出 /// </summary> public string GetCateString(int cataId, string cataString) { var thisCata = new d_general_dal().FindNoDeleteById(cataId); if (thisCata != null) { cataString = thisCata.name + ">" + cataString; if (thisCata.parent_id != null) { cataString = GetCateString((int)thisCata.parent_id, cataString); } } return(cataString); }
/// <summary> /// 编辑知识库目录 /// </summary> public bool EditKnowMenu(long cateId, string name, int parentId, long userId, ref string failReason) { var dgDal = new d_general_dal(); if (string.IsNullOrEmpty(name)) { failReason = "为获取到相关名称"; return(false); } var cate = dgDal.FindNoDeleteById(cateId); if (cate == null) { failReason = "该目录已经删除"; return(false); } var isCanAdd = true; var subList = dgDal.GetGeneralByParentId(parentId); if (subList != null && subList.Count > 0) { if (subList.Any(_ => name.Equals(_.name) && _.id != cateId)) { isCanAdd = false; } } if (!isCanAdd) { failReason = "同一级目录,名称不能相同!"; return(false); } cate.name = name; cate.parent_id = parentId; cate.update_time = Tools.Date.DateHelper.ToUniversalTimeStamp(DateTime.Now); cate.update_user_id = userId; var oldCate = dgDal.FindNoDeleteById(cateId); dgDal.Update(cate); OperLogBLL.OperLogUpdate <d_general>(cate, oldCate, cate.id, userId, OPER_LOG_OBJ_CATE.General_Code, "编辑知识库目录"); return(true); }
/// <summary> /// 新增知识库目录 /// </summary> public bool AddKnowMenu(string name, int parentId, long userId, ref string failReason) { if (string.IsNullOrEmpty(name)) { failReason = "为获取到相关名称"; return(false); } var dgDal = new d_general_dal(); var isCanAdd = true; var subList = dgDal.GetGeneralByParentId(parentId); if (subList != null && subList.Count > 0) { if (subList.Any(_ => name.Equals(_.name))) { isCanAdd = false; } } if (!isCanAdd) { failReason = "同一级目录,名称不能相同!"; return(false); } var timeNow = Tools.Date.DateHelper.ToUniversalTimeStamp(DateTime.Now); var thisCate = new d_general() { id = (int)dgDal.GetNextIdCom(), general_table_id = (int)DTO.GeneralTableEnum.KNOWLEDGE_BASE_CATE, create_time = timeNow, update_time = timeNow, create_user_id = userId, update_user_id = userId, name = name, parent_id = parentId, }; dgDal.Insert(thisCate); OperLogBLL.OperLogAdd <d_general>(thisCate, thisCate.id, userId, OPER_LOG_OBJ_CATE.General_Code, "新增知识库目录"); return(true); }
public bool DeleteProductCate(long cateId, long userId) { d_general_dal dgDal = new d_general_dal(); var proList = _dal.FindListBySql <ivt_product>($"SELECT * from ivt_product where delete_time = 0 and cate_id =" + cateId.ToString()); if (proList != null && proList.Count > 0) { proList.ForEach(_ => { _.cate_id = null; EditProduct(_, userId); }); } var childCateList = dgDal.GetGeneralByParentId(cateId); if (childCateList != null && childCateList.Count > 0) { GeneralBLL genBll = new GeneralBLL(); childCateList.ForEach(_ => { genBll.Delete(_.id, userId, (long)GeneralTableEnum.PRODUCT_CATE); }); } return(true); }
protected void Page_Load(object sender, EventArgs e) { try { var taskId = Request.QueryString["id"]; if (!string.IsNullOrEmpty(taskId)) { thisTicket = new sdk_task_dal().FindNoDeleteById(long.Parse(taskId)); if (thisTicket != null) { isAdd = false; thisBookMark = new IndexBLL().GetSingBook(Request.Url.LocalPath + "?id=" + taskId, LoginUserId); ticketUdfValueList = new UserDefinedFieldsBLL().GetUdfValue(DicEnum.UDF_CATE.TASK, thisTicket.id, tickUdfList); thisAccount = new CompanyBLL().GetCompany(thisTicket.account_id); if (thisTicket.contact_id != null) { thisContact = new crm_contact_dal().FindNoDeleteById((long)thisTicket.contact_id); } if (thisTicket.owner_resource_id != null && thisTicket.role_id != null) { var resDepList = new sys_resource_department_dal().GetResDepByResAndRole((long)thisTicket.owner_resource_id, (long)thisTicket.role_id); if (resDepList != null && resDepList.Count > 0) { proResDep = resDepList[0]; priRes = new sys_resource_dal().FindNoDeleteById((long)thisTicket.owner_resource_id); } } if (thisTicket.installed_product_id != null) { insPro = new crm_installed_product_dal().FindNoDeleteById((long)thisTicket.installed_product_id); } if (thisTicket.contract_id != null) { thisContract = new ctt_contract_dal().FindNoDeleteById((long)thisTicket.contract_id); } if (thisTicket.cost_code_id != null) { thisCostCode = new d_cost_code_dal().FindNoDeleteById((long)thisTicket.cost_code_id); } ticketCheckList = new sdk_task_checklist_dal().GetCheckByTask(thisTicket.id); if (ticketCheckList != null && ticketCheckList.Count > 0) { ticketCheckList = ticketCheckList.OrderBy(_ => _.sort_order).ToList(); } entryList = new sdk_work_entry_dal().GetList(thisTicket.id); var otherResList = new sdk_task_resource_dal().GetTaskResByTaskId(thisTicket.id); if (otherResList != null && otherResList.Count > 0) { ticketResList = new List <sys_resource_department>(); var srdDal = new sys_resource_department_dal(); foreach (var resRole in otherResList) { if (resRole.resource_id == null || resRole.role_id == null) { continue; } var thisResDep = srdDal.GetResDepByResAndRole((long)resRole.resource_id, (long)resRole.role_id); if (thisResDep != null && thisResDep.Count > 0) { ticketResList.Add(thisResDep[0]); } } } if (thisTicket.service_id != null) { thisService = new ivt_service_dal().FindNoDeleteById((long)thisTicket.service_id); if (thisService == null) { thisServiceBun = new ivt_service_bundle_dal().FindNoDeleteById((long)thisTicket.service_id); } } createRes = new sys_resource_dal().FindNoDeleteById(thisTicket.create_user_id); var slaValue = new sdk_task_dal().GetSlaTime(thisTicket); string slaTimeValue = ""; if (slaValue != null) { slaTimeValue = slaValue.ToString(); } if (!string.IsNullOrEmpty(slaTimeValue)) { if (slaTimeValue.Substring(0, 1) == "{") { slaDic = new EMT.Tools.Serialize().JsonToDictionary(slaTimeValue); } } var actList = new d_general_dal().GetGeneralByTableId((int)GeneralTableEnum.ACTION_TYPE); if (actList != null && actList.Count > 0) { ticketNoteTypeList = actList.Where(_ => _.ext2 == ((int)DicEnum.ACTIVITY_CATE.TASK_NOTE).ToString()).ToList(); } ticketOther = new sdk_task_other_dal().GetTicketOther(thisTicket.id); ticketOtherList = new sdk_task_other_person_dal().GetTicketOther(thisTicket.id); } } var ticketIds = Request.QueryString["ids"]; if (!string.IsNullOrEmpty(ticketIds)) { pageTicketList = new sdk_task_dal().GetTicketByIds(ticketIds); } if (thisTicket == null) { Response.Write("<script>alert('未查询到该工单信息!');window.close();</script>"); return; } var history = new sys_windows_history() { title = "工单:" + thisTicket.no + ":" + thisTicket.title, url = Request.RawUrl, }; new IndexBLL().BrowseHistory(history, LoginUserId); } catch (Exception msg) { Response.Write("<script>alert('" + msg.Message + "');window.close();</script>"); } }
protected void Page_Load(object sender, EventArgs e) { try { thisUser = new sys_resource_dal().FindNoDeleteById(GetLoginUserId()); var caDal = new com_activity_dal(); var stDal = new sdk_task_dal(); var ppDal = new pro_project_dal(); var accDal = new crm_account_dal(); var ccDal = new ctt_contract_dal(); var id = Request.QueryString["id"]; if (!string.IsNullOrEmpty(id)) { thisNote = caDal.FindNoDeleteById(long.Parse(id)); if (thisNote != null) { isAdd = false; thisNoteAtt = new com_attachment_dal().GetAttListByOid(thisNote.id); thisTask = stDal.FindNoDeleteById(thisNote.object_id); if (thisTask != null) { object_id = thisTask.id; if (thisTask.type_id == (int)DicEnum.TASK_TYPE.SERVICE_DESK_TICKET) { isTicket = true; thisTask = null; thisTicket = stDal.FindNoDeleteById(thisNote.object_id); } } else { thisProject = ppDal.FindNoDeleteById(thisNote.object_id); if (thisProject != null) { isProject = true; object_id = thisProject.id; thisAccount = accDal.FindNoDeleteById(thisProject.account_id); } else { thisContract = ccDal.FindNoDeleteById(thisNote.object_id); if (thisContract != null) { isContract = true; object_id = thisContract.id; thisAccount = accDal.FindNoDeleteById(thisContract.account_id); } } } } } var taskId = Request.QueryString["task_id"]; var project_id = Request.QueryString["project_id"]; var contract_id = Request.QueryString["contract_id"]; var ticket_id = Request.QueryString["ticket_id"]; var call_id = Request.QueryString["call_id"]; if (!string.IsNullOrEmpty(taskId)) { thisTask = stDal.FindNoDeleteById(long.Parse(taskId)); } else if (!string.IsNullOrEmpty(project_id)) { thisProject = ppDal.FindNoDeleteById(long.Parse(project_id)); if (thisProject != null) { isProject = true; object_id = thisProject.id; thisAccount = accDal.FindNoDeleteById(thisProject.account_id); } } else if (!string.IsNullOrEmpty(contract_id)) { thisContract = ccDal.FindNoDeleteById(long.Parse(contract_id)); if (thisContract != null) { object_id = thisContract.id; thisAccount = accDal.FindNoDeleteById(thisContract.account_id); isContract = true; } } else if (!string.IsNullOrEmpty(ticket_id)) { thisTicket = stDal.FindNoDeleteById(long.Parse(ticket_id)); } else if (!string.IsNullOrEmpty(call_id)) { thisCall = new sdk_service_call_dal().FindNoDeleteById(long.Parse(call_id)); if (thisCall != null) { isCall = true; thisAccount = new CompanyBLL().GetCompany(thisCall.account_id); callTicketList = stDal.GetTciketByCall(thisCall.id); if (callTicketList != null && callTicketList.Count > 0) { thisTask = callTicketList[0]; if (callTicketList.Any(_ => _.id != thisTask.id && _.status_id != thisTask.status_id)) { isMantStatus = true; } if (callTicketList.Any(_ => _.id != thisTask.id && _.account_id != thisTask.account_id)) { isManyAccount = true; } if (callTicketList.Any(_ => _.id != thisTask.id && _.title != thisTask.title)) { isManyTitle = true; } } else { Response.Write("<script>alert('服务预定下暂无工单!');window.close();</script>"); return; } } } if (thisTask != null) { thisAccount = accDal.FindNoDeleteById(thisTask.account_id); object_id = thisTask.id; if (thisTask.type_id == (int)DicEnum.TASK_TYPE.PROJECT_PHASE) { isPhase = true; } task_creator = new sys_resource_dal().FindNoDeleteById(thisTask.create_user_id); if (thisTask.project_id != null) { thisProject = ppDal.FindNoDeleteById((long)thisTask.project_id); if (thisProject != null) { thisAccount = accDal.FindNoDeleteById(thisProject.account_id); } } } if (thisTicket != null) { isTicket = true; object_id = thisTicket.id; task_creator = new sys_resource_dal().FindNoDeleteById(thisTicket.create_user_id); thisAccount = accDal.FindNoDeleteById(thisTicket.account_id); if (thisTicket.contact_id != null) { thisContact = new crm_contact_dal().FindNoDeleteById((long)thisTicket.contact_id); } } if (thisAccount == null) { Response.End(); } else { if (thisAccount.resource_id != null) { thisAccManger = new sys_resource_dal().FindNoDeleteById((long)thisAccount.resource_id); } } if (!IsPostBack) { publish_type_id.DataTextField = "name"; publish_type_id.DataValueField = "id"; var pushList = new d_general_dal().GetGeneralByTableId((int)GeneralTableEnum.NOTE_PUBLISH_TYPE); if (pushList != null && pushList.Count > 0) { if (isProject) { pushList = pushList.Where(_ => _.ext2 == ((int)DicEnum.ACTIVITY_CATE.PROJECT_NOTE).ToString()).ToList(); } else if (isContract) { pushList = pushList.Where(_ => _.ext2 == ((int)DicEnum.ACTIVITY_CATE.CONTRACT_NOTE).ToString()).ToList(); } else if (isTicket) { pushList = pushList.Where(_ => _.ext2 == ((int)DicEnum.ACTIVITY_CATE.TASK_NOTE).ToString()).ToList(); } else { pushList = pushList.Where(_ => _.ext2 == ((int)DicEnum.ACTIVITY_CATE.TASK_NOTE).ToString()).ToList(); } } publish_type_id.DataSource = pushList; publish_type_id.DataBind(); status_id.DataTextField = "show"; status_id.DataValueField = "val"; var statusList = dic.FirstOrDefault(_ => _.Key == "ticket_status").Value as List <DictionaryEntryDto>; if (isMantStatus) { statusList.Add(new DictionaryEntryDto() { val = "0", show = "多个值,保持不变" }); } status_id.DataSource = statusList; status_id.DataBind(); if (isMantStatus) { status_id.SelectedValue = "0"; } else if (thisTask != null) { status_id.SelectedValue = thisTask.status_id.ToString(); } else if (thisTicket != null) { status_id.SelectedValue = thisTicket.status_id.ToString(); } action_type_id.DataTextField = "name"; action_type_id.DataValueField = "id"; var actList = new d_general_dal().GetGeneralByTableId((int)GeneralTableEnum.ACTION_TYPE); if (actList != null && actList.Count > 0) { if (isProject) { actList = actList.Where(_ => _.ext2 == ((int)DicEnum.ACTIVITY_CATE.PROJECT_NOTE).ToString()).ToList(); } else if (isContract) { actList = actList.Where(_ => _.ext2 == ((int)DicEnum.ACTIVITY_CATE.CONTRACT_NOTE).ToString()).ToList(); } else if (isTicket) { actList = actList.Where(_ => _.ext2 == ((int)DicEnum.ACTIVITY_CATE.TASK_NOTE).ToString()).ToList(); } else { actList = actList.Where(_ => _.ext2 == ((int)DicEnum.ACTIVITY_CATE.TASK_NOTE).ToString()).ToList(); } } action_type_id.DataSource = actList; action_type_id.DataBind(); if (thisNote != null) { if (!IsPostBack) { if (thisNote.publish_type_id != null) { publish_type_id.SelectedValue = thisNote.publish_type_id.ToString(); } action_type_id.SelectedValue = thisNote.action_type_id.ToString(); isAnnounce.Checked = thisNote.announce == 1; } } else { if (isContract) { publish_type_id.SelectedValue = ((int)DicEnum.NOTE_PUBLISH_TYPE.CONTRACT_INTERNA_USER).ToString(); } } var tempList = new sys_notify_tmpl_dal().GetTempByEvent(DicEnum.NOTIFY_EVENT.NONE); notify_id.DataTextField = "name"; notify_id.DataValueField = "id"; notify_id.DataSource = tempList; notify_id.DataBind(); } if (isProject) { tmplList = new FormTemplateBLL().GetTmplByType((int)DicEnum.FORM_TMPL_TYPE.PROJECT_NOTE, LoginUserId); } else if (isTicket && thisTicket != null) { tmplList = new FormTemplateBLL().GetTmplByType((int)DicEnum.FORM_TMPL_TYPE.TICKET_NOTE, LoginUserId); } else if (thisTask != null) { tmplList = new FormTemplateBLL().GetTmplByType((int)DicEnum.FORM_TMPL_TYPE.TASK_NOTE, LoginUserId); } } catch (Exception msg) { Response.Write(msg); Response.End(); } }
protected void Page_Load(object sender, EventArgs e) { try { if (!IsPostBack) { Bind(); // 绑定页面下拉数据 } CallBack = Request.QueryString["CallBack"]; var accountId = Request.QueryString["account_id"]; if (!string.IsNullOrEmpty(accountId)) { thisAccount = new CompanyBLL().GetCompany(long.Parse(accountId)); } var contractId = Request.QueryString["contract_id"]; if (!string.IsNullOrEmpty(contractId)) { thisContract = new ctt_contract_dal().FindNoDeleteById(long.Parse(contractId)); } var insProId = Request.QueryString["insProId"]; if (!string.IsNullOrEmpty(insProId)) { insPro = new crm_installed_product_dal().FindNoDeleteById(long.Parse(insProId)); if (insPro != null && insPro.account_id != null) { thisAccount = new CompanyBLL().GetCompany((long)insPro.account_id); } } var taskId = Request.QueryString["id"]; if (!string.IsNullOrEmpty(taskId)) { thisTicket = new sdk_task_dal().FindNoDeleteById(long.Parse(taskId)); if (thisTicket != null) { thisBookMark = new IndexBLL().GetSingBook(Request.RawUrl, LoginUserId); var isCopyString = Request.QueryString["isCopy"]; if (string.IsNullOrEmpty(isCopyString)) { isAdd = false; } else { isCopy = true; } if (!IsPostBack) { cate_id.ClearSelection(); cate_id.SelectedValue = thisTicket.cate_id.ToString(); this.ticket_type_id.SelectedValue = thisTicket.ticket_type_id.ToString(); this.status_id.SelectedValue = thisTicket.status_id.ToString(); if (isCopy) { this.status_id.ClearSelection(); this.status_id.SelectedValue = ((int)DicEnum.TICKET_STATUS.NEW).ToString(); } if (thisTicket.priority_type_id != null) { priority_type_id.SelectedValue = thisTicket.priority_type_id.ToString(); } if (thisTicket.issue_type_id != null) { issue_type_id.SelectedValue = thisTicket.issue_type_id.ToString(); } if (thisTicket.source_type_id != null) { source_type_id.SelectedValue = thisTicket.source_type_id.ToString(); } if (thisTicket.issue_type_id != null) { issue_type_id.SelectedValue = thisTicket.issue_type_id.ToString(); } if (thisTicket.sla_id != null) { sla_id.SelectedValue = thisTicket.sla_id.ToString(); } if (thisTicket.department_id != null) { department_id.SelectedValue = thisTicket.department_id.ToString(); } } ticketUdfValueList = new UserDefinedFieldsBLL().GetUdfValue(DicEnum.UDF_CATE.TASK, thisTicket.id, tickUdfList); thisAccount = new CompanyBLL().GetCompany(thisTicket.account_id); if (thisTicket.contact_id != null) { thisContact = new crm_contact_dal().FindNoDeleteById((long)thisTicket.contact_id); } if (thisTicket.owner_resource_id != null && thisTicket.role_id != null) { var resDepList = new sys_resource_department_dal().GetResDepByResAndRole((long)thisTicket.owner_resource_id, (long)thisTicket.role_id); if (resDepList != null && resDepList.Count > 0) { proResDep = resDepList[0]; priRes = new sys_resource_dal().FindNoDeleteById((long)thisTicket.owner_resource_id); } } if (thisTicket.installed_product_id != null) { insPro = new crm_installed_product_dal().FindNoDeleteById((long)thisTicket.installed_product_id); } if (thisTicket.contract_id != null) { thisContract = new ctt_contract_dal().FindNoDeleteById((long)thisTicket.contract_id); } if (thisTicket.cost_code_id != null) { thisCostCode = new d_cost_code_dal().FindNoDeleteById((long)thisTicket.cost_code_id); } var otherResList = new sdk_task_resource_dal().GetTaskResByTaskId(thisTicket.id); if (otherResList != null && otherResList.Count > 0) { foreach (var item in otherResList) { if (item.resource_id != null && item.role_id != null) { var resDepList = new sys_resource_department_dal().GetResDepByResAndRole((long)item.resource_id, (long)item.role_id); if (resDepList != null && resDepList.Count > 0) { ticketResIds += resDepList[0].id + ","; } } } if (ticketResIds != "") { ticketResIds = ticketResIds.Substring(0, ticketResIds.Length - 1); } } ticketCheckList = new sdk_task_checklist_dal().GetCheckByTask(thisTicket.id); if (ticketCheckList != null && ticketCheckList.Count > 0) { ticketCheckList = ticketCheckList.OrderBy(_ => _.sort_order).ToList(); } #region 时间轴显示相关 工单备注类型获取 var slaValue = new sdk_task_dal().GetSlaTime(thisTicket); string slaTimeValue = ""; if (slaValue != null) { slaTimeValue = slaValue.ToString(); } if (!string.IsNullOrEmpty(slaTimeValue)) { if (slaTimeValue.Substring(0, 1) == "{") { slaDic = new EMT.Tools.Serialize().JsonToDictionary(slaTimeValue); } } var actList = new d_general_dal().GetGeneralByTableId((int)GeneralTableEnum.ACTION_TYPE); if (actList != null && actList.Count > 0) { ticketNoteTypeList = actList.Where(_ => _.ext2 == ((int)DicEnum.ACTIVITY_CATE.TASK_NOTE).ToString()).ToList(); } #endregion entryList = new sdk_work_entry_dal().GetList(thisTicket.id); } } var ticket_type_id = Request.QueryString["ticket_type_id"]; if (!string.IsNullOrEmpty(ticket_type_id)) { this.ticket_type_id.ClearSelection(); this.ticket_type_id.SelectedValue = ticket_type_id; } } catch (Exception msg) { Response.Write("<script>alert('" + msg.Message + "');window.close();</script>"); } }
private ExpenseDto GetParam() { var param = new ExpenseDto(); if (RDAddRep.Checked) { var repTitle = Request.Form["title"]; var repEndDate = Request.Form["end_date"]; var reprAmount = Request.Form["report_amount"]; if (!string.IsNullOrEmpty(repTitle) && !string.IsNullOrEmpty(repEndDate)) { var expRep = new sdk_expense_report() { title = repTitle, end_date = DateTime.Parse(repEndDate), }; if (!string.IsNullOrEmpty(reprAmount)) { expRep.cash_advance_amount = decimal.Parse(reprAmount); } param.thisExpReport = expRep; } } else if (RDAddExiRep.Checked) { var expense_report_id = Request.Form["expense_report_id"]; if (!string.IsNullOrEmpty(expense_report_id)) { var expRep = new sdk_expense_report_dal().FindNoDeleteById(long.Parse(expense_report_id)); if (expRep != null) { param.thisExpReport = expRep; } } } var pageExp = new sdk_expense(); pageExp.add_date = DateTime.Parse(Request.Form["add_date"]); pageExp.is_billable = (sbyte)(isBillable.Checked?1:0); if (isShowWorkType) { var cost_code_id = Request.Form["cost_code_id"]; if (!string.IsNullOrEmpty(cost_code_id)) { pageExp.cost_code_id = long.Parse(cost_code_id); } } pageExp.description = Request.Form["description"]; pageExp.expense_cost_code_id = int.Parse(Request.Form["expense_cost_code_id"]); if (pageExp.expense_cost_code_id == (int)CostCode.ENTERTAINMENT_EXPENSE) { pageExp.location = Request.Form["location"]; } else if (pageExp.expense_cost_code_id == (int)CostCode.MILEAGE) { pageExp.from_loc = Request.Form["from_loc"]; pageExp.to_loc = Request.Form["to_loc"]; var odometer_start = Request.Form["odometer_start"]; if (!string.IsNullOrEmpty(odometer_start)) { pageExp.odometer_start = decimal.Parse(odometer_start); } pageExp.odometer_end = decimal.Parse(Request.Form["odometer_end"]); var miles = Request.Form["miles"]; if (!string.IsNullOrEmpty(miles)) { pageExp.miles = decimal.Parse(miles); } else { pageExp.miles = pageExp.odometer_end - pageExp.odometer_start; } } else { //var amount = long.Parse(Request.Form["amount"]); //var moneyHidden = Request.Form["moneyHidden"]; //if (!string.IsNullOrEmpty(moneyHidden)) //{ // var money = decimal.Parse(moneyHidden); // if (amount > money) // { // var overdraft_policy_id = Request.Form["overdraft_policy_id"]; // } // else // { // pageExp.amount = amount; // } //} //else //{ //pageExp.amount = amount; //} } pageExp.amount = decimal.Parse(Request.Form["amount"]); var esType = new d_cost_code_dal().FindNoDeleteById((long)pageExp.expense_cost_code_id); if (esType != null && esType.expense_type_id != null) { pageExp.type_id = (int)esType.expense_type_id; } pageExp.payment_type_id = int.Parse(Request.Form["payment_type_id"]); var thisPay = new d_general_dal().FindNoDeleteById(pageExp.payment_type_id); if (thisPay != null) { } pageExp.has_receipt = (sbyte)(hasReceipt.Checked?1:0); pageExp.account_id = long.Parse(Request.Form["account_id"]); if (rbAssTask.Checked) { var ticket_id = Request.Form["ticket_id"]; if (!string.IsNullOrEmpty(ticket_id)) { pageExp.task_id = long.Parse(ticket_id); } } else if (rbAssProTask.Checked) { pageExp.project_id = long.Parse(Request.Form["project_id"]); var task_id = Request.Form["task_id"]; if (!string.IsNullOrEmpty(task_id)) { pageExp.task_id = long.Parse(task_id); } } pageExp.purchase_order_no = Request.Form["purchase_order_no"]; if (!isAdd) { pageExp.id = thisExpense.id; pageExp.oid = thisExpense.oid; pageExp.create_user_id = thisExpense.create_user_id; pageExp.create_time = thisExpense.create_time; pageExp.is_approved = thisExpense.is_approved; pageExp.approve_and_post_user_id = thisExpense.approve_and_post_user_id; pageExp.approve_and_post_date = thisExpense.approve_and_post_date; pageExp.amountrate = thisExpense.amountrate; pageExp.purpose = thisExpense.purpose; pageExp.extacctitemid = thisExpense.extacctitemid; pageExp.web_service_date = thisExpense.web_service_date; pageExp.currency_id = thisExpense.currency_id; } param.thisExpense = pageExp; return(param); }
protected void Page_Load(object sender, EventArgs e) { thisUser = new sys_resource_dal().FindNoDeleteById(GetLoginUserId()); var caDal = new com_activity_dal(); var stDal = new sdk_task_dal(); var ppDal = new pro_project_dal(); var accDal = new crm_account_dal(); var ccDal = new ctt_contract_dal(); var id = Request.QueryString["id"]; if (!string.IsNullOrEmpty(id)) { thisNote = caDal.FindNoDeleteById(long.Parse(id)); if (thisNote != null) { isAdd = false; thisNoteAtt = new com_attachment_dal().GetAttListByOid(thisNote.id); thisTicket = stDal.FindNoDeleteById(thisNote.object_id); if (thisTicket != null) { object_id = thisTicket.id; } else { thisProject = ppDal.FindNoDeleteById(thisNote.object_id); if (thisProject != null) { object_id = thisProject.id; thisAccount = accDal.FindNoDeleteById(thisProject.account_id); } else { thisContract = ccDal.FindNoDeleteById(thisNote.object_id); if (thisContract != null) { object_id = thisContract.id; thisAccount = accDal.FindNoDeleteById(thisContract.account_id); } } } } } var ticketId = Request.QueryString["ticket_id"]; if (!string.IsNullOrEmpty(ticketId)) { thisTicket = stDal.FindNoDeleteById(long.Parse(ticketId)); } if (thisTicket != null) { object_id = thisTicket.id; if (thisTicket.type_id == (int)DicEnum.TASK_TYPE.PROJECT_PHASE) { // isPhase = true; } if (thisTicket.contact_id != null) { thisContact = new crm_contact_dal().FindNoDeleteById((long)thisTicket.contact_id); } thisAccount = accDal.FindNoDeleteById(thisTicket.account_id); ticket_creator = new sys_resource_dal().FindNoDeleteById(thisTicket.create_user_id); if (!IsPostBack) { //status_id.SelectedValue = thisTicket.status_id.ToString(); } if (thisTicket.project_id != null) { thisProject = ppDal.FindNoDeleteById((long)thisTicket.project_id); if (thisProject != null && thisAccount != null) { thisAccount = accDal.FindNoDeleteById(thisProject.account_id); } } } if (thisAccount == null) { Response.End(); } else { if (thisAccount.resource_id != null) { thisAccManger = new sys_resource_dal().FindNoDeleteById((long)thisAccount.resource_id); } } if (!IsPostBack) { publish_type_id.DataTextField = "name"; publish_type_id.DataValueField = "id"; var pushList = new d_general_dal().GetGeneralByTableId((int)GeneralTableEnum.NOTE_PUBLISH_TYPE); if (pushList != null && pushList.Count > 0) { pushList = pushList.Where(_ => _.ext2 == ((int)DicEnum.ACTIVITY_CATE.TICKET_NOTE).ToString()).ToList(); } publish_type_id.DataSource = pushList; publish_type_id.DataBind(); status_id.DataTextField = "show"; status_id.DataValueField = "val"; status_id.DataSource = dic.FirstOrDefault(_ => _.Key == "ticket_status").Value; status_id.DataBind(); if (thisTicket != null) { status_id.SelectedValue = thisTicket.status_id.ToString(); } action_type_id.DataTextField = "name"; action_type_id.DataValueField = "id"; var actList = new d_general_dal().GetGeneralByTableId((int)GeneralTableEnum.ACTION_TYPE); actList = actList.Where(_ => _.ext2 == ((int)DicEnum.ACTIVITY_CATE.TASK_NOTE).ToString()).ToList(); action_type_id.DataSource = actList; action_type_id.DataBind(); if (thisNote != null) { if (!IsPostBack) { if (thisNote.publish_type_id != null) { publish_type_id.SelectedValue = thisNote.publish_type_id.ToString(); } action_type_id.SelectedValue = thisNote.action_type_id.ToString(); } } //else //{ // if (isContract) // { // publish_type_id.SelectedValue = ((int)DicEnum.NOTE_PUBLISH_TYPE.CONTRACT_INTERNA_USER).ToString(); // } //} var tempList = new sys_notify_tmpl_dal().GetTempByEvent(DicEnum.NOTIFY_EVENT.NONE); notify_id.DataTextField = "name"; notify_id.DataValueField = "id"; notify_id.DataSource = tempList; notify_id.DataBind(); } }
protected List <crm_quote_item> degressionItem = null; // 成本的配置项 protected void Page_Load(object sender, EventArgs e) { try { #region 拉框赋值 stage_id.DataTextField = "show"; stage_id.DataValueField = "val"; stage_id.DataSource = dic.FirstOrDefault(_ => _.Key == "opportunity_stage").Value; stage_id.DataBind(); win_reason_type_id.DataTextField = "show"; win_reason_type_id.DataValueField = "val"; win_reason_type_id.DataSource = dic.FirstOrDefault(_ => _.Key == "oppportunity_win_reason_type").Value; win_reason_type_id.DataBind(); win_reason_type_id.Items.Insert(0, new ListItem() { Value = "0", Text = " ", Selected = true }); resource_id.DataTextField = "show"; resource_id.DataValueField = "val"; resource_id.DataSource = dic.FirstOrDefault(_ => _.Key == "sys_resource").Value; resource_id.DataBind(); competitor_id.DataTextField = "show"; competitor_id.DataValueField = "val"; competitor_id.DataSource = dic.FirstOrDefault(_ => _.Key == "competition").Value; competitor_id.DataBind(); competitor_id.Items.Insert(0, new ListItem() { Value = "0", Text = " ", Selected = true }); // period_type period_type.DataTextField = "show"; period_type.DataValueField = "val"; period_type.DataSource = dic.FirstOrDefault(_ => _.Key == "period_type").Value; period_type.DataBind(); period_type.Items.Insert(0, new ListItem() { Value = "0", Text = " ", Selected = true }); // notifi_temp 通知模板 var tempList = new sys_notify_tmpl_dal().GetTempByEvent(DicEnum.NOTIFY_EVENT.OPPORTUNITY_CLOSED); notifi_temp.DataTextField = "name"; notifi_temp.DataValueField = "id"; notifi_temp.DataSource = tempList; notifi_temp.DataBind(); #endregion var id = Request.QueryString["id"]; var account_id = Request.QueryString["account_id"]; if (!string.IsNullOrEmpty(id)) { if (string.IsNullOrEmpty(account_id)) { if (!IsPostBack) { opportunity_id.Enabled = false; } } opportunity = new crm_opportunity_dal().GetOpportunityById(long.Parse(id)); if (opportunity != null) { account = new CompanyBLL().GetCompany(opportunity.account_id); account_id = account.id.ToString(); } } if (!string.IsNullOrEmpty(account_id)) { account = new CompanyBLL().GetCompany(long.Parse(account_id)); var oppoList = new crm_opportunity_dal().FindOpHistoryByAccountId(long.Parse(account_id)); if (oppoList != null && oppoList.Count > 0) { opportunity_id.DataTextField = "name"; opportunity_id.DataValueField = "id"; opportunity_id.DataSource = oppoList; opportunity_id.DataBind(); } else { Response.Write("<script>alert('该客户还没有商机!');window.close();</script>"); } //opportunity_id.Items.Insert(0, new ListItem() { Value = "0", Text = " ", Selected = true }); if (string.IsNullOrEmpty(id)) { opportunity = oppoList[0]; } opportunity_id.SelectedValue = opportunity.id.ToString(); } if (!IsPostBack) { if (opportunity != null) { if (opportunity.status_id == (int)OPPORTUNITY_STATUS.CLOSED) { Response.Write("<script>if(!confirm('商机已被关闭,如果继续,系统会重复创建计费项和合同?')){window.close();}</script>"); } } if (opportunity.stage_id != null) { stage_id.SelectedValue = opportunity.stage_id.ToString(); } else { var stageList = new d_general_dal().GetGeneralByTableId((int)GeneralTableEnum.OPPORTUNITY_STATUS); var defaultStage = stageList.FirstOrDefault(_ => _.ext1 == "1"); if (defaultStage != null) { stage_id.SelectedValue = defaultStage.id.ToString(); } } // stage_id.SelectedValue = opportunity.stage_id == null ? "0" : opportunity.stage_id.ToString(); resource_id.SelectedValue = opportunity.resource_id.ToString(); competitor_id.SelectedValue = opportunity.competitor_id == null ? "0" : opportunity.competitor_id.ToString(); win_reason_type_id.SelectedValue = opportunity.win_reason_type_id == null ? "0" : opportunity.win_reason_type_id.ToString(); } // 折扣的下拉框不同于别的下拉框-- 需要去两个数据源去赋值 StringBuilder text = new StringBuilder(); var costCode = new d_cost_code_dal().GetListCostCode((int)COST_CODE_CATE.MATERIAL_COST_CODE); text.Append($"<option value='0'> </option>"); if (costCode != null && costCode.Count > 0) { foreach (var item in costCode) { text.Append($"<option value='{item.id}'>{item.name}</option>"); } } codeSelect.Value = text.ToString(); var disSource = ""; var disCostCode = costCode.Where(_ => _.id == (int)CostCode.NOTAXDISCOUNT || _.id == (int)CostCode.DISCOUNT).ToList(); if (disCostCode != null && disCostCode.Count > 0) { foreach (var item in disCostCode) { disSource += $"<option value='{item.id}'>{item.name}</option>"; } } disCodeSelct.Value = disSource; period_type.SelectedValue = ((int)QUOTE_ITEM_PERIOD_TYPE.MONTH).ToString(); primaryQuote = new QuoteBLL().GetPrimaryQuote(opportunity.id); if (primaryQuote != null) { if (!IsPostBack) { if (primaryQuote.project_id != null) // 判断该报价是否关联项目提案,如果关联,默认选中,不关联,灰掉,不可选 { activeproject.Checked = true; activeproject.Enabled = true; addRequest.Enabled = false; isaddRequest.Value = "1"; } else { activeproject.Checked = false; addRequest.Enabled = true; activeproject.Enabled = false; isactiveproject.Value = "1"; } } quoteItemList = new crm_quote_item_dal().GetQuoteItems($" and quote_id = {primaryQuote.id}"); if (quoteItemList != null && quoteItemList.Count > 0) { // 如果报价项中包含了服务 / 服务包、初始费用,则可以选中(默认不选) // 此功能需要具有合同模块权限以及修改合同服务/包权限 var isServiceChargeItem = quoteItemList.Where(_ => _.type_id == (int)QUOTE_ITEM_TYPE.SERVICE || _.type_id == (int)QUOTE_ITEM_TYPE.SERVICE_PACK || _.type_id == (int)QUOTE_ITEM_TYPE.START_COST).ToList(); if (!IsPostBack) { if (isServiceChargeItem != null && isServiceChargeItem.Count > 0) { // todo--需要判断用户权限 } else { addContractRequest.Enabled = false; isAddContractRequest.Value = "1"; addContractServices.Enabled = false; isaddContractServices.Value = "1"; } } proAndOneTimeItem = quoteItemList.Where(_ => _.optional != 1).Where(_ => _.type_id == (int)QUOTE_ITEM_TYPE.PRODUCT || _.type_id == (int)QUOTE_ITEM_TYPE.DISCOUNT).ToList(); if (!IsPostBack) { if (proAndOneTimeItem != null && proAndOneTimeItem.Count > 0) { isIncludePO.Checked = true; } else { IncludePO.Value = "1"; isIncludePO.Enabled = false; } } shipItem = quoteItemList.Where(_ => _.type_id == (int)QUOTE_ITEM_TYPE.DISTRIBUTION_EXPENSES && _.optional != 1).ToList(); if (!IsPostBack) { if (shipItem != null && shipItem.Count > 0) { isIncludeShip.Checked = true; } else { IncludeShip.Value = "1"; isIncludeShip.Enabled = false; } } degressionItem = quoteItemList.Where(_ => _.type_id == (int)QUOTE_ITEM_TYPE.DEGRESSION & _.optional != 1).ToList(); if (!IsPostBack) { if (degressionItem != null && degressionItem.Count > 0) { isIncludeCharges.Checked = true; } else { IncludeCharges.Value = "1"; isIncludeCharges.Enabled = false; } } jqueryCode.Value = ReturnJquery(); } else { // activeproject.Enabled = false; //isactiveproject.Value = "1"; addContractRequest.Enabled = false; isAddContractRequest.Value = "1"; addContractServices.Enabled = false; isaddContractServices.Value = "1"; IncludePO.Value = "1"; isIncludePO.Enabled = false; IncludeShip.Value = "1"; isIncludeShip.Enabled = false; IncludeCharges.Value = "1"; isIncludeCharges.Enabled = false; } } else { activeproject.Enabled = false; isactiveproject.Value = "1"; addContractRequest.Enabled = false; isAddContractRequest.Value = "1"; addContractServices.Enabled = false; isaddContractServices.Value = "1"; IncludePO.Value = "1"; isIncludePO.Enabled = false; IncludeShip.Value = "1"; isIncludeShip.Enabled = false; IncludeCharges.Value = "1"; isIncludeCharges.Enabled = false; } } catch (Exception msg) { Response.End(); } }
/// <summary> /// 获取税收地区名称 /// </summary> /// <param name="id"></param> /// <returns></returns> public string GetTaxName(int id) { string name = new d_general_dal().FindById(id).name; return(name); }
protected void Page_Load(object sender, EventArgs e) { try { thisBookMark = new IndexBLL().GetSingBook(Request.RawUrl, LoginUserId); iProduct_udfList = new UserDefinedFieldsBLL().GetUdf(DicEnum.UDF_CATE.CONFIGURATION_ITEMS); var contract_id = Request.QueryString["contract_id"]; if (!string.IsNullOrEmpty(contract_id)) { contract = new ctt_contract_dal().FindNoDeleteById(long.Parse(contract_id)); if (contract != null) { account = new CompanyBLL().GetCompany(contract.account_id); } } var contactId = Request.QueryString["contact_id"]; if (!string.IsNullOrEmpty(contactId)) { contact = new ContactBLL().GetContact(long.Parse(contactId)); if (contact != null) { account = new CompanyBLL().GetCompany(contact.account_id); } } var id = Request.QueryString["id"]; if (!string.IsNullOrEmpty(id)) { iProduct = new crm_installed_product_dal().GetInstalledProduct(long.Parse(id)); if (iProduct != null) { account = new CompanyBLL().GetCompany((long)iProduct.account_id); product = new ivt_product_dal().FindNoDeleteById(iProduct.product_id); } } var account_id = Request.QueryString["account_id"]; if (!string.IsNullOrEmpty(account_id)) { account = new CompanyBLL().GetCompany(long.Parse(account_id)); } //var contactList = new crm_contact_dal().GetContactByAccountId(account.id); //var serviceList = new ivt_service_dal().GetServiceList($" and vendor_id = {account.id}"); #region 配置下拉框数据源 var udfGroup = new d_general_dal().GetGeneralByTableId((int)GeneralTableEnum.UDF_FILED_GROUP); List <d_general> cateList = null; if (udfGroup != null && udfGroup.Count > 0) { cateList = udfGroup.Where(_ => _.parent_id == (int)UDF_CATE.CONFIGURATION_ITEMS).ToList(); } installed_product_cate_id.DataTextField = "name"; installed_product_cate_id.DataValueField = "id"; installed_product_cate_id.DataSource = cateList; installed_product_cate_id.DataBind(); installed_product_cate_id.Items.Insert(0, new ListItem() { Value = "", Text = " ", Selected = true }); //contact_id.DataTextField = "name"; //contact_id.DataValueField = "id"; //contact_id.DataSource = contactList; //contact_id.DataBind(); //contact_id.Items.Insert(0, new ListItem() { Value = "", Text = " ", Selected = true }); // //service.DataTextField = "name"; //service.DataValueField = "id"; //service.DataSource = serviceList; //service.DataBind(); //service.Items.Insert(0, new ListItem() { Value = "0", Text = " ", Selected = true }); //service.Enabled = false; // 所选合同如果是服务类型的,则此下拉框可选。可选内容为合同项 #endregion if (iProduct != null) { //account_id = iProduct.account_id.ToString(); iProduct_udfValueList = new UserDefinedFieldsBLL().GetUdfValue(DicEnum.UDF_CATE.CONFIGURATION_ITEMS, iProduct.id, iProduct_udfList); var isCopy = Request.QueryString["isCopy"]; product = new EMT.DoneNOW.BLL.ProductBLL().GetProduct(iProduct.product_id); isAdd = false; if (!string.IsNullOrEmpty(isCopy) && isCopy == "1") { isAdd = true; } if (!isAdd) { #region 记录浏览历史 var history = new sys_windows_history() { title = "配置项:" + (product == null ? "" : product.name) + account.name, url = Request.RawUrl, }; new IndexBLL().BrowseHistory(history, LoginUserId); #endregion } if (iProduct.contract_id != null) { contract = new ctt_contract_dal().FindNoDeleteById((long)iProduct.contract_id); } if (iProduct.cate_id != null) { installed_product_cate_id.SelectedValue = iProduct.cate_id.ToString(); } if (iProduct.contact_id != null) { contact_id.SelectedValue = iProduct.contact_id.ToString(); } viewSubscription_iframe.Src = "../Common/SearchBodyFrame.aspx?cat=" + (int)EMT.DoneNOW.DTO.DicEnum.QUERY_CATE.CONFIGSUBSCRIPTION + "&type=" + (int)EMT.DoneNOW.DTO.QueryType.CONFIGSUBSCRIPTION + "&id=" + iProduct.id; view_ticket_iframe.Src = "../Common/SearchBodyFrame.aspx?cat=" + (int)EMT.DoneNOW.DTO.DicEnum.QUERY_CATE.MY_QUEUE_ACTIVE + "&type=" + (int)EMT.DoneNOW.DTO.QueryType.MY_QUEUE_ACTIVE + "&group=215&con3962=" + iProduct.id + "¶m1=ShowPara"; // todo 订阅的通用查询 // "../Common/SearchBodyFrame.aspx?cat=" + (int)EMT.DoneNOW.DTO.DicEnum.QUERY_CATE.CONTACT_COMPANY_VIEW + "&type=" + (int)EMT.DoneNOW.DTO.QueryType.ContactCompanyView + "&id=" + id; thisNoteAtt = new com_attachment_dal().GetAttListByOid(iProduct.id); if (!isAdd) { if (iProduct.parent_id != null) { parentInsPro = new crm_installed_product_dal().GetInstalledProduct((long)iProduct.parent_id); } childInsProList = new crm_installed_product_dal().GetChildInsPro(iProduct.id); } } if (!IsPostBack) { is_active_.Checked = true; if (iProduct != null) { is_active_.Checked = iProduct.is_active == 1; } } } catch (Exception msg) { Response.Write("<script>alert('" + msg.Message + "');window.close();</script>"); } }
public ERROR_CODE CloseQuote(long user_id, QuoteCloseDto param) { // 此向导将会把产品、一次性折扣、配送、成本转为计费项。可选项和费用不会被转换。如果有产品,会生成销售订单。 // 报价中如果有服务 / 包或初始费用,将不会被转换为计费项,也不会创建定期服务合同 // 如果商机状态已经是“关闭”或“已实施”,将会为此商机生成重复的计费项。 // 报价项中如果有物料代码为空的,则需要设置。如果没有需要配置的,则此界面不显示 // 计费项将会生成,是否需要创建发票 // 打开新建的销售订单(链接)——如果创建了销售单才显示 // 关闭报价是关闭商机的另一种方式, // -- 必填项校验-- 根据系统设置来判断 TODO var user = UserInfoBLL.GetUserInfo(user_id); // 1.更新商机信息 #region 1.更新商机信息 // 根据系统设置来选择商机的阶段-- todo param.opportunity.status_id = (int)DicEnum.OPPORTUNITY_STATUS.CLOSED; var stageList = new d_general_dal().GetGeneralByTableId((int)GeneralTableEnum.OPPORTUNITY_STATUS); var defaultStage = stageList.FirstOrDefault(_ => _.ext1 == "1"); if (defaultStage != null) { param.opportunity.stage_id = defaultStage.id; } var old_opportunity = new crm_opportunity_dal().GetOpportunityById(param.opportunity.id); new crm_opportunity_dal().Update(param.opportunity); new sys_oper_log_dal().Insert(new sys_oper_log() { user_cate = "用户", user_id = user_id, name = user.name, phone = user.mobile == null ? "" : user.mobile, oper_time = Tools.Date.DateHelper.ToUniversalTimeStamp(DateTime.Now), oper_object_cate_id = (int)OPER_LOG_OBJ_CATE.OPPORTUNITY, oper_object_id = param.opportunity.id,// 操作对象id oper_type_id = (int)OPER_LOG_TYPE.UPDATE, oper_description = _dal.CompareValue(old_opportunity, param.opportunity), remark = "修改商机信息" }); #endregion // 2.更新客户信息 #region 2.更新客户信息 var account = new CompanyBLL().GetCompany(param.quote.account_id); if (account.type_id != (int)DicEnum.ACCOUNT_TYPE.CUSTOMER) { account.type_id = (int)DicEnum.ACCOUNT_TYPE.CUSTOMER; new crm_account_dal().Update(account); new sys_oper_log_dal().Insert(new sys_oper_log() { user_cate = "用户", user_id = user_id, name = user.name, phone = user.mobile == null ? "" : user.mobile, oper_time = Tools.Date.DateHelper.ToUniversalTimeStamp(DateTime.Now), oper_object_cate_id = (int)OPER_LOG_OBJ_CATE.CUSTOMER, oper_object_id = param.quote.account_id,// 操作对象id oper_type_id = (int)OPER_LOG_TYPE.UPDATE, oper_description = _dal.CompareValue(new CompanyBLL().GetCompany(param.quote.account_id), account), remark = "修改客户信息" }); } #endregion long?contact_id = null; if (param.opportunity.contact_id != null) { crm_contact contact = new ContactBLL().GetContact((long)param.opportunity.contact_id); if (contact.is_active == 1) { contact_id = contact.id; } } // 3.保存项目信息 #region 3.如果项目关联了项目提案,修改项目提案信息 if (param.quote.project_id != null) { var project = new pro_project_dal().GetProjectById((long)param.quote.project_id); if (project != null) { if (project.type_id != (int)PROJECT_TYPE.ACCOUNT_PROJECT) { project.type_id = (int)PROJECT_TYPE.ACCOUNT_PROJECT; project.update_time = Tools.Date.DateHelper.ToUniversalTimeStamp(DateTime.Now); project.update_user_id = user.id; new sys_oper_log_dal().Insert(new sys_oper_log() { user_cate = "用户", user_id = (int)user.id, name = user.name, phone = user.mobile == null ? "" : user.mobile, oper_time = Tools.Date.DateHelper.ToUniversalTimeStamp(DateTime.Now), oper_object_cate_id = (int)OPER_LOG_OBJ_CATE.PROJECT, oper_object_id = project.id,// 操作对象id oper_type_id = (int)OPER_LOG_TYPE.UPDATE, oper_description = _dal.CompareValue(new pro_project_dal().GetProjectById((long)param.quote.project_id), project), remark = "修改项目提案类型" }); new pro_project_dal().Update(project); } param.project_id = project.id; } string costIds = ""; new OpportunityBLL().InsertContract(param.dic, param.opportunity, user, null, out costIds, param.project_id, null); if (!string.IsNullOrEmpty(costIds)) { var aapBLL = new ApproveAndPostBLL(); costIds = costIds.Substring(0, costIds.Length - 1); var costList = costIds.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries); foreach (var costId in costList) { // 审批并提交 aapBLL.Post_Charges(int.Parse(costId), int.Parse(DateTime.Now.ToString("yyyyMMdd")), user); } } } #endregion // 4.新增工单信息 #region 4.如果报价未关联项目提案,有需要转换的计费项 // todo 关联sdk_ticket #endregion // 5.转换为工单/项目成本 #region 5.转换为工单/项目成本 // todo 关联sdk_ticket_charge // 一次性折扣根据需要拆分为两行——收税的、不收税的,分别计算折扣额。计算时仍然按照全部周期为一次性的报价项,而不是排除了服务和工时等报价项。 #endregion // 将报价项转换为计费项 #region 将报价项转换为计费项并审批提交 todo-需要项目ID 或者工单ID才可以进行操作 //string costIds =""; //new OpportunityBLL().InsertContract(param.dic,param.opportunity,user,null,out costIds, param.project_id,null); //if (!string.IsNullOrEmpty(costIds)) //{ // var aapBLL = new ApproveAndPostBLL(); // costIds = costIds.Substring(0,costIds.Length-1); // var costList = costIds.Split(new char[] { ','},StringSplitOptions.RemoveEmptyEntries); // foreach (var costId in costList) // { // // 审批并提交 // aapBLL.Post_Charges(int.Parse(costId),int.Parse(DateTime.Now.ToString("yyyyMMdd")),user); // } //} #endregion // 6.新增销售订单 #region 6.当有产品/一次性折扣、成本、配送转为计费项时,销售订单就会自动生成。Crm_sales_order if (param.dic != null && param.dic.Count > 0) { var saleOrder = new crm_sales_order_dal().GetSingleSalesOrderByWhere($" and opportunity_id = {param.opportunity.id} "); if (saleOrder == null) { saleOrder = new crm_sales_order() { id = _dal.GetNextIdCom(), opportunity_id = param.opportunity.id, status_id = (int)SALES_ORDER_STATUS.OPEN, contact_id = contact_id, owner_resource_id = param.opportunity.resource_id, begin_date = DateTime.Now, create_user_id = user.id, update_user_id = user.id, create_time = Tools.Date.DateHelper.ToUniversalTimeStamp(DateTime.Now), update_time = Tools.Date.DateHelper.ToUniversalTimeStamp(DateTime.Now), }; new crm_sales_order_dal().Insert(saleOrder); new sys_oper_log_dal().Insert(new sys_oper_log() { user_cate = "用户", user_id = (int)user.id, name = user.name, phone = user.mobile == null ? "" : user.mobile, oper_time = Tools.Date.DateHelper.ToUniversalTimeStamp(DateTime.Now), oper_object_cate_id = (int)OPER_LOG_OBJ_CATE.SALE_ORDER, oper_object_id = saleOrder.id,// 操作对象id oper_type_id = (int)OPER_LOG_TYPE.ADD, oper_description = _dal.AddValue(saleOrder), remark = "关闭报价,新增销售订单" }); param.saleOrderId = saleOrder.id; } } #endregion // 7.新增项目备注 #region 7.转为项目计费项时,会生成备注 if (param.quote.project_id != null) { com_activity addActivity = new com_activity() { id = _dal.GetNextIdCom(), cate_id = (int)ACTIVITY_CATE.PROJECT_NOTE, action_type_id = (int)ACTIVITY_TYPE.PROJECT_NOTE, parent_id = null, object_id = (long)param.quote.project_id, object_type_id = (int)OBJECT_TYPE.PROJECT, // todo发布范围 account_id = param.opportunity.account_id, contact_id = contact_id, resource_id = param.opportunity.resource_id, contract_id = contact_id, opportunity_id = param.opportunity.id, ticket_id = null, // todo 标题 description = $"", // todo 内容描述拼接 status_id = null, complete_description = null, complete_time = null, create_user_id = user.id, create_time = Tools.Date.DateHelper.ToUniversalTimeStamp(DateTime.Now), update_user_id = user.id, update_time = Tools.Date.DateHelper.ToUniversalTimeStamp(DateTime.Now), is_system_generate = 1, }; new com_activity_dal().Insert(addActivity); new sys_oper_log_dal().Insert(new sys_oper_log() { user_cate = "用户", user_id = (int)user.id, name = user.name, phone = user.mobile == null ? "" : user.mobile, oper_time = Tools.Date.DateHelper.ToUniversalTimeStamp(DateTime.Now), oper_object_cate_id = (int)OPER_LOG_OBJ_CATE.ACTIVITY, oper_object_id = addActivity.id,// 操作对象id oper_type_id = (int)OPER_LOG_TYPE.ADD, oper_description = _dal.AddValue(addActivity), remark = "商机关闭,新增项目备注" }); } #endregion // 8.新增备注(商机关闭) #region 8.商机关闭时,会自动生成备注 com_activity closeOppoActivity = new com_activity() { id = _dal.GetNextIdCom(), cate_id = (int)ACTIVITY_CATE.NOTE, action_type_id = (int)ACTIVITY_TYPE.OPPORTUNITYUPDATE, parent_id = null, object_id = param.opportunity.id, object_type_id = (int)OBJECT_TYPE.OPPORTUNITY, account_id = param.opportunity.account_id, contact_id = contact_id, resource_id = param.opportunity.resource_id, contract_id = null, // todo 如果转为合同成本,则为“合同”;否则为空 opportunity_id = param.opportunity.id, ticket_id = null, start_date = Tools.Date.DateHelper.ToUniversalTimeStamp(DateTime.Parse(DateTime.Now.ToShortDateString() + " 12:00:00")), // todo 从页面获取时间,去页面时间的12:00:00 end_date = Tools.Date.DateHelper.ToUniversalTimeStamp(DateTime.Parse(DateTime.Now.ToShortDateString() + " 12:00:00")), description = $"关闭时间:{DateTime.Now.ToString("dd/MM/yyyy")}/r通知人:{user.email}/r主题:{param.opportunity.name}已经关闭/r内容:商机关闭向导定义", // todo 内容描述拼接 status_id = null, complete_description = null, complete_time = null, create_user_id = user.id, create_time = Tools.Date.DateHelper.ToUniversalTimeStamp(DateTime.Now), update_user_id = user.id, update_time = Tools.Date.DateHelper.ToUniversalTimeStamp(DateTime.Now), is_system_generate = 1, }; new com_activity_dal().Insert(closeOppoActivity); new sys_oper_log_dal().Insert(new sys_oper_log() { user_cate = "用户", user_id = (int)user.id, name = user.name, phone = user.mobile == null ? "" : user.mobile, oper_time = Tools.Date.DateHelper.ToUniversalTimeStamp(DateTime.Now), oper_object_cate_id = (int)OPER_LOG_OBJ_CATE.ACTIVITY, oper_object_id = closeOppoActivity.id,// 操作对象id oper_type_id = (int)OPER_LOG_TYPE.ADD, oper_description = _dal.AddValue(closeOppoActivity), remark = "新增关闭商机的备注" }); #endregion return(ERROR_CODE.SUCCESS); }