Beispiel #1
0
        protected void SaveClose_Click(object sender, EventArgs e)
        {
            if (!SaveBlock())
            {
                Response.Write("<script>alert('添加预付失败,必填项填写不完整!');</script>");
            }
            else
            {
                Response.Write("<script>alert('添加预付成功!');window.close();self.opener.location.reload();</script>");
            }

            contract = new ContractBLL().GetContract(contractId);
            if (contract.type_id == (int)DicEnum.CONTRACT_TYPE.BLOCK_HOURS)
            {
                blocktypeName = "时间";
                blockType     = 1;
            }
            else if (contract.type_id == (int)DicEnum.CONTRACT_TYPE.RETAINER)
            {
                blocktypeName = "费用";
                blockType     = 2;
            }
            else if (contract.type_id == (int)DicEnum.CONTRACT_TYPE.PER_TICKET)
            {
                blocktypeName = "事件";
                blockType     = 3;
            }
        }
Beispiel #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                var ccDal      = new DAL.ctt_contract_dal();
                var contractId = Request.QueryString["contract_id"];
                if (!string.IsNullOrEmpty(contractId))
                {
                    thisContract = ccDal.FindNoDeleteById(long.Parse(contractId));
                }
                if (thisContract == null)
                {
                    Response.End();
                }
                else
                {
                    if (thisContract.exclusion_contract_id != null)
                    {
                        excContract = ccDal.FindNoDeleteById((long)thisContract.exclusion_contract_id);
                    }
                    thisCodeList = new DAL.d_cost_code_dal().GetConExsCode(thisContract.id);
                    allCodeList  = new DAL.d_cost_code_dal().GetNotConExsCode(thisContract.id);

                    thisRoleList = new DAL.sys_role_dal().GetConExcRole(thisContract.id);
                    allRoleList  = new DAL.sys_role_dal().GetNotConExcRole(thisContract.id);
                }
            }
            catch (Exception msg)
            {
                Response.End();
            }
        }
Beispiel #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                var thisContractId = Request.QueryString["contract_id"];
                if (!string.IsNullOrEmpty(thisContractId))
                {
                    thisContract = new ctt_contract_dal().FindNoDeleteById(long.Parse(thisContractId));
                }
                if (thisContract != null)
                {
                    ShowNoteList.Src = "../Common/SearchBodyFrame.aspx?cat=" + (int)EMT.DoneNOW.DTO.DicEnum.QUERY_CATE.PROJECT_NOTE + "&type=" + (int)EMT.DoneNOW.DTO.QueryType.PROJECT_NOTE + "&con1054=" + thisContract.id;
                }

                var taskId = Request.QueryString["task_id"];
                if (!string.IsNullOrEmpty(taskId))
                {
                    thisTask = new sdk_task_dal().FindNoDeleteById(long.Parse(taskId));
                }
                if (thisTask != null)
                {
                    ShowNoteList.Src = "../Common/SearchBodyFrame.aspx?cat=" + (int)EMT.DoneNOW.DTO.DicEnum.QUERY_CATE.PROJECT_NOTE + "&type=" + (int)EMT.DoneNOW.DTO.QueryType.PROJECT_NOTE + "&con1054=" + thisTask.id;
                    thisAccount      = new BLL.CompanyBLL().GetCompany(thisTask.account_id);
                }
            }
            catch (Exception)
            {
                Response.End();
            }
        }
Beispiel #4
0
 protected void Page_Load(object sender, EventArgs e)
 {
     try
     {
         var insProId   = Request.QueryString["insProId"];
         var contractId = Request.QueryString["contractId"];
         if (!string.IsNullOrEmpty(insProId) && !string.IsNullOrEmpty(contractId))
         {
             iProduct    = new crm_installed_product_dal().FindNoDeleteById(long.Parse(insProId));
             serviceList = new ctt_contract_service_dal().GetConSerList(long.Parse(contractId));
             contract    = new ctt_contract_dal().FindNoDeleteById(long.Parse(contractId));
             if (iProduct != null && serviceList != null && serviceList.Count > 0)
             {
             }
         }
         if (contract == null || iProduct == null)
         {
             Response.Write("<script>alert('未获取到相关配置项,合同信息');window.close();</script>");
         }
     }
     catch (Exception error)
     {
         Response.Write("<script>alert('" + error.Message + "');window.close();</script>");
     }
 }
Beispiel #5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                var conDefCostId = Request.QueryString["id"];
                var contract_id  = Request.QueryString["contract_id"];
                contract = new ctt_contract_dal().FindNoDeleteById(long.Parse(contract_id));
                if (contract != null)
                {
                    if (!string.IsNullOrEmpty(conDefCostId))
                    {
                        conDefCost = new ctt_contract_cost_default_dal().FindNoDeleteById(long.Parse(conDefCostId));
                        if (conDefCost != null)
                        {
                            isAdd = false;

                            if (!IsPostBack)
                            {
                                isbillable.Checked = conDefCost.is_billable == 1;
                            }
                        }
                    }
                }
            }
            catch (Exception)
            {
                Response.End();
            }
        }
Beispiel #6
0
        protected void SaveNew_Click(object sender, EventArgs e)
        {
            long ctId = long.Parse(Request.Form["contractId"]);
            int  type = int.Parse(Request.Form["blockType"]);

            if (SaveBlock())
            {
                Response.Write("<script>alert('添加预付成功!');</script>");
                Response.Redirect($"AddRetainerPurchase.aspx?id={ctId}&type={type}");
            }
            else
            {
                Response.Write("<script>alert('添加预付失败,必填项填写不完整!');</script>");
            }

            contract = new ContractBLL().GetContract(contractId);
            if (contract.type_id == (int)DicEnum.CONTRACT_TYPE.BLOCK_HOURS)
            {
                blocktypeName = "时间";
                blockType     = 1;
            }
            else if (contract.type_id == (int)DicEnum.CONTRACT_TYPE.RETAINER)
            {
                blocktypeName = "费用";
                blockType     = 2;
            }
            else if (contract.type_id == (int)DicEnum.CONTRACT_TYPE.PER_TICKET)
            {
                blocktypeName = "事件";
                blockType     = 3;
            }
        }
Beispiel #7
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                string cId = Request.QueryString["id"];
                serviceId = long.Parse(cId);
            }
            else
            {
                serviceId = long.Parse(Request.Form["serId"]);
            }
            service  = bll.GetService(serviceId);
            contract = new ContractBLL().GetContract(service.contract_id);
            DTO.DicEnum.QUOTE_ITEM_PERIOD_TYPE svcPeriod, maxPeriod;
            decimal rate = bll.GetPeriodRate((DTO.DicEnum.QUOTE_ITEM_PERIOD_TYPE)contract.period_type, service.id, 0, out svcPeriod, out maxPeriod);

            if (rate > 1)
            {
                service.unit_cost  = service.unit_cost / rate;
                service.unit_price = service.unit_price / rate;
            }
            if (service.object_type == 1)
            {
                serviceTypeName = "服务";
            }
            else if (service.object_type == 2)
            {
                serviceTypeName = "服务包";
            }
            serviceName = bll.GetServiceName(service);

            if (IsPostBack)
            {
                ctt_contract_service ser = new ctt_contract_service();
                ser.id = serviceId;
                try
                {
                    ser.quantity       = int.Parse(Request.Form["serUnits"]);
                    ser.unit_price     = decimal.Parse(Request.Form["serPrice"]);
                    ser.unit_cost      = decimal.Parse(Request.Form["serCost"]);
                    ser.adjusted_price = int.Parse(Request.Form["serAdjustCost"]);
                    ser.effective_date = DateTime.Parse(Request.Form["effective_date"]);
                }
                catch
                {
                    Response.Write("<script>alert('输入有误,调整失败!');</script>");
                    return;
                }
                if (service.object_type == 1)
                {
                    new ContractServiceBLL().AdjustService(ser, GetLoginUserId());
                }
                else if (service.object_type == 2)
                {
                    new ContractServiceBLL().AdjustServiceBundle(ser, GetLoginUserId());
                }
                Response.Write("<script>alert('调整成功!');window.close();self.opener.location.reload();</script>");
            }
        }
Beispiel #8
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                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)
                    {
                        roleList = new sys_role_dal().GetContarctNoRate(contract.id);
                    }
                }

                var rate_id = Request.QueryString["rate_id"];
                if (!string.IsNullOrEmpty(rate_id))
                {
                    conRate = new ctt_contract_rate_dal().FindNoDeleteById(long.Parse(rate_id));
                    if (conRate != null)
                    {
                        isAdd = false;
                        var thisRole = new sys_role_dal().FindNoDeleteById(conRate.role_id);
                        roleList.Add(thisRole);
                    }
                }

                if (roleList != null && roleList.Count > 0)
                {
                    role_id.DataTextField  = "name";
                    role_id.DataValueField = "id";
                    role_id.DataSource     = roleList;
                    role_id.DataBind();
                    role_id.Items.Insert(0, new ListItem()
                    {
                        Value = "0", Text = "   ", Selected = true
                    });
                    if (!isAdd)
                    {
                        role_id.SelectedValue = conRate.role_id.ToString();
                    }
                }
                else
                {
                    Response.Write("<script>alert('在你可以添加更多的合同费率之前,请在系统中加入更多的角色。在你可以添加额外的合同费率之前,请在系统中加入额外的角色。');window.close();</script>");
                }
            }
            catch (Exception)
            {
                Response.End();
            }
        }
Beispiel #9
0
        protected v_contract_summary summary; // 合同摘要

        protected void Page_Load(object sender, EventArgs e)
        {
            long id = 0;

            if (!long.TryParse(Request.QueryString["id"], out id))
            {
                id = 0;
            }

            var bll = new ContractBLL();

            summary  = bll.GetContractSummary(id);
            contract = bll.GetContract(id);
        }
Beispiel #10
0
        protected void SaveClose_Click()
        {
            ctt_contract contractEdit = AssembleModel <ctt_contract>();

            if (!string.IsNullOrEmpty(Request.Form["MastInput"]) && Request.Form["MastInput"].Equals("on"))
            {
                contractEdit.timeentry_need_begin_end = 1;
            }
            else
            {
                contractEdit.timeentry_need_begin_end = 0;
            }
            if (!string.IsNullOrEmpty(Request.Form["isSdtDefault"]) && Request.Form["isSdtDefault"].Equals("on"))
            {
                contractEdit.is_sdt_default = 1;
            }
            else
            {
                contractEdit.is_sdt_default = 0;
            }
            if (contract.contract.type_id != (int)DicEnum.CONTRACT_TYPE.SERVICE)
            {
                if (!string.IsNullOrEmpty(Request.Form["isEnableOrverage"]) && Request.Form["isEnableOrverage"].Equals("on"))
                {
                    contractEdit.enable_overage_billing_rate = 1;
                }
                else
                {
                    contractEdit.enable_overage_billing_rate = 0;
                }
                if (string.IsNullOrEmpty(Request.Form["bill_to_contact_id1"]))
                {
                    contractEdit.bill_to_contact_id = null;
                }
                else
                {
                    contractEdit.bill_to_contact_id = long.Parse(Request.Form["bill_to_contact_id1"]);
                }
            }
            else
            {
                if (!string.IsNullOrEmpty(Request.Form["date"]) && Request.Form["date"].Equals("1"))
                {
                    contractEdit.occurrences = null;
                }
            }
            bll.EditContract(contractEdit, GetLoginUserId());
            Response.Write("<script>alert('编辑合同成功!');window.close();self.opener.location.reload();</script>");
        }
Beispiel #11
0
        protected void SaveClose_Click(object sender, EventArgs e)
        {
            ctt_contract_block blk = new ctt_contract_block();

            blk.id         = long.Parse(Request.Form["id"]);
            blk.start_date = DateTime.Parse(Request.Form["startDate"]);
            blk.end_date   = DateTime.Parse(Request.Form["endDate"]);
            if (string.IsNullOrEmpty(Request.Form["amount"]))
            {
                blk.rate     = decimal.Parse(Request.Form["hourlyRate"]);
                blk.quantity = decimal.Parse(Request.Form["hours"]);
            }
            else
            {
                blk.rate     = decimal.Parse(Request.Form["amount"]);
                blk.quantity = 1;
            }
            blk.status_id      = sbyte.Parse(Request.Form["rdStatus"]);
            blk.date_purchased = DateTime.Parse(Request.Form["datePurchased"]);
            blk.payment_number = Request.Form["paymentNum"];
            if (string.IsNullOrEmpty(paymentType.SelectedValue))
            {
                blk.payment_type_id = null;
            }
            else
            {
                blk.payment_type_id = int.Parse(paymentType.SelectedValue);
            }
            blk.description = Request.Form["note"];

            bll.EditPurchase(blk, GetLoginUserId());

            blockId  = blk.id;
            block    = bll.GetBlockById(blk.id);
            contract = new ContractBLL().GetContract(block.contract_id);
            if (contract.type_id == (int)DicEnum.CONTRACT_TYPE.BLOCK_HOURS)
            {
                blocktypeName = "时间";
            }
            else if (contract.type_id == (int)DicEnum.CONTRACT_TYPE.RETAINER)
            {
                blocktypeName = "费用";
            }
            else if (contract.type_id == (int)DicEnum.CONTRACT_TYPE.PER_TICKET)
            {
                blocktypeName = "事件";
            }
            Response.Write("<script>alert('修改预付成功!');window.close();self.opener.location.reload();</script>");
        }
Beispiel #12
0
        protected ctt_contract contract; // 合同信息

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                string cId = Request.QueryString["contractId"];
                objType = int.Parse(Request.QueryString["type"]);

                if (objType == 1)
                {
                    serviceName = "服务";
                }
                else if (objType == 2)
                {
                    serviceName = "服务包";
                }

                long contractId = 0;
                if (!long.TryParse(cId, out contractId))
                {
                    Response.Close();
                    return;
                }
                contract = new ContractBLL().GetContract(contractId);

                if (string.IsNullOrEmpty(Request.QueryString["date"]))
                {
                    effDate = contract.start_date > DateTime.Now ? contract.start_date : DateTime.Now;
                }
                else
                {
                    effDate = DateTime.Parse(Request.QueryString["date"]);
                }
            }
            else
            {
                var service = AssembleModel <ctt_contract_service>();
                if (!string.IsNullOrEmpty(Request.Form["adjustCost"]))
                {
                    service.adjusted_price = decimal.Parse(Request.Form["adjustCost"]);
                }
                new ContractServiceBLL().AddServiceServiceBundle(service, GetLoginUserId());

                contract = new ContractBLL().GetContract(service.contract_id);
                effDate  = DateTime.Now;
                objType  = service.object_type;

                Response.Write("<script>alert('添加成功!');window.close();self.opener.location.reload();</script>");
            }
        }
Beispiel #13
0
        protected void Page_Load(object sender, EventArgs e)
        {
            var  insProId = Request.QueryString["insProId"];
            long id       = 0;

            if (!string.IsNullOrEmpty(insProId) && long.TryParse(insProId, out id))
            {
                thisInsPro = insProBll.GetById(id);
            }
            if (thisInsPro == null)
            {
                Response.Write("<script>alert('未获取到相关配置项!');window.close();</script>");
                return;
            }
            noCloseTicket = new DAL.sdk_task_dal().GetNoDoneByInsPro(thisInsPro.id);
            thisProduct   = new ProductBLL().GetProduct(thisInsPro.product_id);
            wareList      = new DAL.ivt_warehouse_dal().GetAllWareList();
            if (thisInsPro.account_id != null)
            {
                thisAccount = new CompanyBLL().GetCompany((long)thisInsPro.account_id);
                contactList = new ContactBLL().GetContactByCompany((long)thisInsPro.account_id);
            }
            if (thisInsPro.contract_id != null)
            {
                thisContract = new ContractBLL().GetContract((long)thisInsPro.contract_id);
            }
            var thisSubAllList = new DAL.crm_subscription_dal().GetSubByInsProId(thisInsPro.id);

            thisSubList = new InstalledProductBLL().ReturnSubIds(thisSubAllList);
            if (thisSubList != null && thisSubList.Count > 0)
            {
                thisSubList.ForEach(_ => {
                    subNames += _.name + ',';
                });
                if (!string.IsNullOrEmpty(subNames))
                {
                    subNames = subNames.Substring(0, subNames.Length - 1);
                }
            }

            if (IsPostBack)
            {
                var result = new InstalledProductBLL().SwapConfigItem(GetParam(), LoginUserId);
                Response.Write($"<script>self.opener.location.reload();alert('替换{(result?"成功":"失败")}!');window.close();</script>");
            }
        }
Beispiel #14
0
        protected void Page_Load(object sender, EventArgs e)
        {
            udfList      = new UserDefinedFieldsBLL().GetUdf(DicEnum.UDF_CATE.CONTRACTS);
            resourceList = new DAL.sys_resource_dal().GetSourceList();
            roleList     = new DAL.sys_role_dal().GetList();

            //if (!IsPostBack)
            //{
            long id = 0;

            if (string.IsNullOrEmpty(Request.QueryString["id"]) || !long.TryParse(Request.QueryString["id"], out id))
            {
                Response.Close();
                return;
            }

            contractCopy = bll.GetContract(id);
            if (contractCopy.type_id != (int)DicEnum.CONTRACT_TYPE.SERVICE)
            {
                Response.Close();
                return;
            }

            contractCopy.name = "[Renewal of]" + contractCopy.name;
            companyName       = new CompanyBLL().GetCompany(contractCopy.account_id).name;
            if (contractCopy.contact_id != null && contractCopy.contact_id > 0)
            {
                contactList = new ContactBLL().GetContactByCompany(contractCopy.account_id);
            }
            udfValues    = new UserDefinedFieldsBLL().GetUdfValue(DicEnum.UDF_CATE.CONTRACTS, id, udfList);
            serviceList  = new ContractServiceBLL().GetServiceList(id);
            contractType = contractCopy.type_id;
            isFinish     = 0;
            //}

            Dictionary <string, object> dics = bll.GetField();

            contractCate = dics["cate"] as List <DictionaryEntryDto>;
            periodType   = dics["periodType"] as List <DictionaryEntryDto>;
            periodType.Remove(periodType.Find(pt => pt.val.Equals(((int)DicEnum.QUOTE_ITEM_PERIOD_TYPE.ONE_TIME).ToString())));
            billPostType = dics["billPostType"] as List <DictionaryEntryDto>;
            slaList      = bll.GetSLAList();

            contractTypeName = bll.GetContractTypeName(contractType);
        }
Beispiel #15
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                contractId = 0;
                string id = Request.QueryString["id"];
                if (!long.TryParse(id, out contractId))
                {
                    Response.Close();
                    return;
                }

                contract = new ContractBLL().GetContract(contractId);
                if (contract.type_id == (int)DicEnum.CONTRACT_TYPE.BLOCK_HOURS)
                {
                    blocktypeName = "时间";
                    blockType     = 1;
                }
                else if (contract.type_id == (int)DicEnum.CONTRACT_TYPE.RETAINER)
                {
                    blocktypeName = "费用";
                    blockType     = 2;
                }
                else if (contract.type_id == (int)DicEnum.CONTRACT_TYPE.PER_TICKET)
                {
                    blocktypeName = "事件";
                    blockType     = 3;
                }
                else
                {
                    Response.Close();
                    return;
                }

                var dic = bll.GetField();
                paymentType.DataValueField = "val";
                paymentType.DataTextField  = "show";
                paymentType.DataSource     = dic.FirstOrDefault(_ => _.Key == "paymentType").Value;
                paymentType.DataBind();
                paymentType.Items.Insert(0, new ListItem()
                {
                    Value = "", Text = "   ", Selected = true
                });
            }
        }
Beispiel #16
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                var id = Request.QueryString["id"];
                if (!string.IsNullOrEmpty(id))
                {
                    thisEntry = new sdk_work_entry_dal().FindNoDeleteById(long.Parse(id));
                }
                if (thisEntry == null)
                {
                    Response.End();
                }
                else
                {
                    if (thisEntry.cost_code_id != null)
                    {
                        thisCost = new d_cost_code_dal().FindNoDeleteById((long)thisEntry.cost_code_id);
                        thisRate = new ContractRateBLL().GetRateByCodeAndRole((long)thisEntry.cost_code_id, (long)thisEntry.role_id);
                    }
                    thisTask = new sdk_task_dal().FindNoDeleteById(thisEntry.task_id);

                    if (thisTask != null && thisTask.project_id != null)
                    {
                        thisProject = new pro_project_dal().FindNoDeleteById((long)thisTask.project_id);
                        if (thisProject != null)
                        {
                            thisAccount = new CompanyBLL().GetCompany(thisProject.account_id);
                        }
                    }
                    if (thisEntry.contract_id != null)
                    {
                        thisContract = new ctt_contract_dal().FindNoDeleteById((long)thisEntry.contract_id);
                    }
                }
            }
            catch (Exception)
            {
                Response.End();
            }
        }
Beispiel #17
0
 protected void Page_Load(object sender, EventArgs e)
 {
     try
     {
         var contract_id = Request.QueryString["contract_id"];
         contract = new ctt_contract_dal().FindNoDeleteById(long.Parse(contract_id));
         var cost_id = Request.QueryString["cost_id"];
         if (!string.IsNullOrEmpty(cost_id))
         {
             intCost = new ctt_contract_internal_cost_dal().FindNoDeleteById(long.Parse(cost_id));
             if (intCost != null)
             {
                 isAdd = false;
             }
         }
     }
     catch (Exception)
     {
         Response.End();
     }
 }
        protected void Page_Load(object sender, EventArgs e)
        {
            var contratId = Request.QueryString["contractId"];
            var seviceId  = Request.QueryString["serviceId"];
            var insProId  = Request.QueryString["insProId"];

            if (!string.IsNullOrEmpty(contratId))
            {
                contract = new ContractBLL().GetContract(long.Parse(contratId));
            }
            if (!string.IsNullOrEmpty(insProId))
            {
                insPro = new crm_installed_product_dal().FindNoDeleteById(long.Parse(insProId));
            }
            if (!string.IsNullOrEmpty(seviceId))
            {
                contractService = new ctt_contract_service_dal().FindNoDeleteById(long.Parse(seviceId));
            }
            if (contractService == null || contract == null || insPro == null)
            {
                Response.Write("<script>alert('未获取到相关配置项,合同信息');window.close();</script>");
                return;
            }
        }
Beispiel #19
0
        protected bool noTime = false;      // 可以不输入开始结束时间(根据系统设置进行判断)
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                //  是否需要输入开始结束时间
                var isNeedTimeString = Request.QueryString["NoTime"];
                var noTimeSet        = new SysSettingBLL().GetSetById(SysSettingEnum.SDK_ENTRY_REQUIRED);
                if (!string.IsNullOrEmpty(isNeedTimeString))
                {
                    if (noTimeSet != null && noTimeSet.setting_value == "0")
                    {
                        noTime = true;
                    }
                }
                var callId = Request.QueryString["callId"];
                if (!string.IsNullOrEmpty(callId))
                {
                    thisCall = new sdk_service_call_dal().FindNoDeleteById(long.Parse(callId));
                }
                thisUser = new sys_resource_dal().FindNoDeleteById(GetLoginUserId());
                var resList = dic.FirstOrDefault(_ => _.Key == "sys_resource").Value as List <DictionaryEntryDto>;
                if (!IsPostBack)
                {
                    resource_id.DataTextField  = "show";
                    resource_id.DataValueField = "val";
                    var  entryProxySet = new SysSettingBLL().GetValueById(SysSettingEnum.SDK_ENTRY_PROXY);
                    bool isAgent       = false;
                    if (entryProxySet == ((int)DicEnum.PROXY_TIME_ENTRY.DISABLED).ToString())
                    {
                        if (resList != null && resList.Count > 0)
                        {
                            resList = resList.Where(_ => _.val == LoginUserId.ToString()).ToList();
                        }
                    }
                    else
                    {
                        var agentResList = new UserResourceBLL().GetAgentUser(LoginUserId, out isAgent);
                        if (agentResList != null && agentResList.Count > 0)
                        {
                            resList = (from a in agentResList
                                       select new DictionaryEntryDto()
                            {
                                val = a.id.ToString(), show = a.name
                            }).ToList();
                        }
                    }
                    resource_id.DataSource    = resList;
                    resource_id.SelectedValue = LoginUserId.ToString();
                    resource_id.DataBind();

                    var statusList = dic.FirstOrDefault(_ => _.Key == "ticket_status").Value as List <DictionaryEntryDto>;
                    //statusList.Remove(statusList.FirstOrDefault(_=>_.val==((int)DicEnum.TICKET_STATUS.NEW).ToString()));
                    status_id.DataTextField  = "show";
                    status_id.DataValueField = "val";
                    status_id.DataSource     = statusList;
                    status_id.DataBind();


                    cost_code_id.DataTextField  = "name";
                    cost_code_id.DataValueField = "id";
                    cost_code_id.DataSource     = new d_cost_code_dal().GetCostCodeByWhere((int)DicEnum.COST_CODE_CATE.GENERAL_ALLOCATION_CODE);
                    cost_code_id.DataBind();

                    notify_id.DataTextField  = "name";
                    notify_id.DataValueField = "id";
                    notify_id.DataSource     = new sys_notify_tmpl_dal().GetTempByEvent(DicEnum.NOTIFY_EVENT.TICKET_TIME_ENTRY_CREATED_EDITED);
                    notify_id.DataBind();
                }

                var taskId = Request.QueryString["task_id"];
                if (!string.IsNullOrEmpty(taskId))
                {
                    thisTask = new sdk_task_dal().FindNoDeleteById(long.Parse(taskId));
                }

                var id = Request.QueryString["id"];
                if (!string.IsNullOrEmpty(id))
                {
                    thisWorkEntry = new sdk_work_entry_dal().FindNoDeleteById(long.Parse(id));
                    if (thisWorkEntry != null)
                    {
                        if (thisWorkEntry.approve_and_post_date != null || thisWorkEntry.approve_and_post_user_id != null)
                        {
                            Response.Write("<script>alert('审批提交的工时不可以更改!');window.close();</script>");
                            Response.End();
                        }

                        if (!resList.Any(_ => _.val == thisWorkEntry.create_user_id.ToString()))
                        {
                            Response.Write("<script>alert('系统设置不能代理操作!');window.close();</script>");
                            return;
                        }
                        if (thisWorkEntry.end_time == null && noTimeSet != null && noTimeSet.setting_value == "0")
                        {
                            noTime = true;
                        }
                        entryList = new sdk_work_entry_dal().GetBatchList(thisWorkEntry.batch_id);
                        isAdd     = false;
                        thisTask  = new sdk_task_dal().FindNoDeleteById(thisWorkEntry.task_id);
                        if (!IsPostBack)
                        {
                            resource_id.ClearSelection();
                            resource_id.SelectedValue  = ((long)thisWorkEntry.resource_id).ToString();
                            cost_code_id.SelectedValue = ((long)thisWorkEntry.cost_code_id).ToString();
                            // status_id.SelectedValue = ((long)thisWorkEntry.)
                            // thisTask  = new crm_account_dal().FindNoDeleteById(thisWorkEntry.);
                        }

                        if (thisWorkEntry.contract_id != null)
                        {
                            thisContract = new ctt_contract_dal().FindNoDeleteById((long)thisWorkEntry.contract_id);
                        }
                        if (!IsPostBack)
                        {
                            isBilled.Checked  = thisWorkEntry.is_billable == 0;
                            ShowOnInv.Checked = thisWorkEntry.show_on_invoice == 1;
                            if (isBilled.Checked)
                            {
                                ShowOnInv.Enabled = true;
                            }
                        }
                    }
                    else
                    {
                        Response.Write("<script>alert('工时已被删除!')window.close();</script>");
                        Response.End();
                    }
                }
                #region 根据批次获取相关工时
                //var batchId = Request.QueryString["batchId"];
                //if (!string.IsNullOrEmpty(batchId))
                //{
                //    entryList = new sdk_work_entry_dal().GetBatchList(long.Parse(batchId));
                //    if(entryList!=null&& entryList.Count > 0)
                //    {
                //        thisWorkEntry = entryList[0];
                //        if (thisWorkEntry.approve_and_post_date != null || thisWorkEntry.approve_and_post_user_id != null)
                //        {
                //            Response.Write("<script>alert('审批提交的工时不可以更改!');window.close();</script>");
                //            Response.End();
                //        }

                //        if (!resList.Any(_ => _.val == thisWorkEntry.create_user_id.ToString()))
                //        {
                //            Response.Write("<script>alert('系统设置不能代理操作!')window.close();</script>");
                //            Response.End();
                //        }
                //        if (thisWorkEntry.end_time == null && noTimeSet != null && noTimeSet.setting_value == "0")
                //        {
                //            noTime = true;
                //        }
                //        entryList = new sdk_work_entry_dal().GetBatchList(thisWorkEntry.batch_id);
                //        isAdd = false;
                //        thisTask = new sdk_task_dal().FindNoDeleteById(thisWorkEntry.task_id);
                //        if (!IsPostBack)
                //        {
                //            resource_id.SelectedValue = ((long)thisWorkEntry.resource_id).ToString();
                //            cost_code_id.SelectedValue = ((long)thisWorkEntry.cost_code_id).ToString();
                //            // status_id.SelectedValue = ((long)thisWorkEntry.)
                //            // thisTask  = new crm_account_dal().FindNoDeleteById(thisWorkEntry.);

                //        }

                //        if (thisWorkEntry.contract_id != null)
                //        {
                //            thisContract = new ctt_contract_dal().FindNoDeleteById((long)thisWorkEntry.contract_id);
                //        }
                //        if (!IsPostBack)
                //        {
                //            isBilled.Checked = thisWorkEntry.is_billable == 0;
                //            ShowOnInv.Checked = thisWorkEntry.show_on_invoice == 1;
                //            if (isBilled.Checked)
                //            {
                //                ShowOnInv.Enabled = true;
                //            }
                //        }
                //    }
                //}
                #endregion
                if (thisTask != null)
                {
                    v_task      = new v_task_all_dal().FindById(thisTask.id);
                    thisProjetc = new pro_project_dal().FindNoDeleteById((long)thisTask.project_id);
                    if (thisProjetc != null)
                    {
                        thisAccount = new crm_account_dal().FindNoDeleteById(thisProjetc.account_id);
                        if (!IsPostBack)
                        {
                            status_id.SelectedValue = thisTask.status_id.ToString();
                        }
                    }
                }
                // 项目关联合同,并且合同中设置-工时录入需要输入开始结束时间
                if (thisProjetc != null && thisProjetc.contract_id != null)
                {
                    var thisCttContract = new ctt_contract_dal().FindNoDeleteById((long)thisProjetc.contract_id);
                    if (thisCttContract != null)
                    {
                        if (thisCttContract.timeentry_need_begin_end == 1)
                        {
                            noTime = false;
                        }
                    }
                }

                if (thisCall != null)
                {
                    showStartDate = EMT.Tools.Date.DateHelper.ConvertStringToDateTime(thisCall.start_time);
                    showEndDate   = EMT.Tools.Date.DateHelper.ConvertStringToDateTime(thisCall.end_time);
                }
                if (!string.IsNullOrEmpty(Request.QueryString["chooseDate"]))
                {
                    showStartDate = DateTime.Parse(Request.QueryString["chooseDate"]);
                    showEndDate   = DateTime.Parse(Request.QueryString["chooseDate"]);
                }
            }
            catch (Exception msg)
            {
                Response.Write($"<script>alert('{msg.Message}');window.close();</script>");
            }
        }
Beispiel #20
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                var cost_id     = Request.QueryString["id"];
                var contract_id = Request.QueryString["contract_id"];
                var project_id  = Request.QueryString["project_id"];
                var task_id     = Request.QueryString["task_id"];
                var ticket_id   = Request.QueryString["ticket_id"];
                var costCodeId  = Request.QueryString["cost_code_id"];
                if (!string.IsNullOrEmpty(costCodeId))
                {
                    costCode = new d_cost_code_dal().FindNoDeleteById(long.Parse(costCodeId));
                }

                #region  拉框赋值
                cost_type_id.DataTextField  = "show";
                cost_type_id.DataValueField = "val";
                cost_type_id.DataSource     = dic.FirstOrDefault(_ => _.Key == "chargeType").Value;
                cost_type_id.DataBind();
                cost_type_id.Items.Insert(0, new ListItem()
                {
                    Value = "0", Text = "   ", Selected = true
                });
                cost_type_id.SelectedValue = ((int)DicEnum.COST_TYPE.OPERATIONA).ToString();

                // status_id
                status_id.DataTextField  = "show";
                status_id.DataValueField = "val";
                var statuList = dic.FirstOrDefault(_ => _.Key == "chargeStatus").Value as List <DictionaryEntryDto>;

                #endregion
                if (!string.IsNullOrEmpty(contract_id))
                {
                    contract = new ctt_contract_dal().FindNoDeleteById(long.Parse(contract_id));
                    if (contract != null)
                    {
                        if (!IsPostBack)
                        {
                            isbillable.Checked = true;
                        }
                    }
                }
                if (!string.IsNullOrEmpty(cost_id))
                {
                    conCost = new ctt_contract_cost_dal().FindNoDeleteById(long.Parse(cost_id));
                    if (conCost != null)
                    {
                        isAdd    = false;
                        costCode = new d_cost_code_dal().FindNoDeleteById(conCost.cost_code_id);

                        cost_type_id.SelectedValue = conCost.cost_type_id == null ? ((int)DicEnum.COST_TYPE.OPERATIONA).ToString() : conCost.cost_type_id.ToString();
                        if (!IsPostBack)
                        {
                            status_id.SelectedValue = conCost.status_id.ToString();
                        }


                        if (conCost.contract_id != null)
                        {
                            contract = new ctt_contract_dal().FindNoDeleteById((long)conCost.contract_id);
                        }
                        if (conCost.project_id != null)
                        {
                            thisProject = new pro_project_dal().FindNoDeleteById((long)conCost.project_id);
                        }
                        if (conCost.task_id != null)
                        {
                            thisTask = new sdk_task_dal().FindNoDeleteById((long)conCost.task_id);
                            if (thisTask.type_id == (int)DicEnum.TASK_TYPE.SERVICE_DESK_TICKET)
                            {
                                thisTask   = null;
                                thisTicket = new sdk_task_dal().FindNoDeleteById((long)conCost.task_id);
                            }
                        }

                        if (!IsPostBack)
                        {
                            isbillable.Checked    = conCost.is_billable == 1;
                            AddConfigItem.Checked = conCost.create_ci == 1;
                        }

                        if (conCost.status_id == (int)DicEnum.COST_STATUS.UNDETERMINED)
                        {
                            statuList = statuList.Where(_ => _.val == (conCost.status_id).ToString() || _.val == ((int)DicEnum.COST_STATUS.PENDING_PURCHASE).ToString() || _.val == ((int)DicEnum.COST_STATUS.CANCELED).ToString()).ToList();
                        }
                        else if (conCost.status_id == (int)DicEnum.COST_STATUS.CANCELED)
                        {
                            statuList = statuList.Where(_ => _.val == (conCost.status_id).ToString() || _.val == ((int)DicEnum.COST_STATUS.PENDING_PURCHASE).ToString() || _.val == ((int)DicEnum.COST_STATUS.CANCELED).ToString()).ToList();
                        }
                        else
                        {
                            statuList = statuList.Where(_ => _.val == (conCost.status_id).ToString() || _.val == ((int)DicEnum.COST_STATUS.CANCELED).ToString()).ToList();
                        }
                    }
                }
                if (!string.IsNullOrEmpty(project_id))
                {
                    thisProject = new pro_project_dal().FindNoDeleteById(long.Parse(project_id));
                }
                if (!string.IsNullOrEmpty(task_id))
                {
                    thisTask = new sdk_task_dal().FindNoDeleteById(long.Parse(task_id));
                    if (thisTask != null && thisTask.project_id != null)
                    {
                        thisProject = new pro_project_dal().FindNoDeleteById((long)thisTask.project_id);
                    }
                }
                if (!string.IsNullOrEmpty(ticket_id))
                {
                    thisTicket = new sdk_task_dal().FindNoDeleteById(long.Parse(ticket_id));
                }
                if (thisTicket != null)
                {
                    thisAccount = new CompanyBLL().GetCompany(thisTicket.account_id);
                }

                status_id.DataSource = statuList;
                status_id.DataBind();
                //status_id.Items.Insert(0, new ListItem() { Value = "0", Text = "   ", Selected = true });
                if (!IsPostBack)
                {
                    if (isAdd)
                    {
                        status_id.SelectedValue = ((int)DicEnum.COST_STATUS.PENDING_DELIVERY).ToString();
                    }
                }
            }
            catch (Exception msg)
            {
                Response.End();
            }
        }
Beispiel #21
0
        protected void Page_Load(object sender, EventArgs e)
        {
            udfList      = new UserDefinedFieldsBLL().GetUdf(DicEnum.UDF_CATE.CONTRACTS);
            resourceList = new DAL.sys_resource_dal().GetSourceList();
            roleList     = new DAL.sys_role_dal().GetList();

            if (!IsPostBack)
            {
                long id = 0;
                if (string.IsNullOrEmpty(Request.QueryString["id"]) || !long.TryParse(Request.QueryString["id"], out id))
                {
                    Response.Close();
                    return;
                }

                contractCopy      = bll.GetContract(id);
                contractCopy.name = "【复制于】" + contractCopy.name;
                companyName       = new CompanyBLL().GetCompany(contractCopy.account_id).name;
                if (contractCopy.contact_id != null && contractCopy.contact_id > 0)
                {
                    contactList = new ContactBLL().GetContactByCompany(contractCopy.account_id);
                }
                udfValues = new UserDefinedFieldsBLL().GetUdfValue(DicEnum.UDF_CATE.CONTRACTS, id, udfList);

                if (contractCopy.type_id == (int)DicEnum.CONTRACT_TYPE.FIXED_PRICE)
                {
                    milestoneList = bll.GetMilestoneList(id);
                }

                if (contractCopy.type_id == (int)DicEnum.CONTRACT_TYPE.SERVICE)
                {
                    serviceList = new ContractServiceBLL().GetServiceList(id);
                }

                contractType = contractCopy.type_id;
                isFinish     = 0;
            }
            else
            {
                ContractAddDto dto = new ContractAddDto();
                dto.contract = AssembleModel <ctt_contract>();

                if (!string.IsNullOrEmpty(Request.Form["isSdtDefault"]) && Request.Form["isSdtDefault"].Equals("on"))
                {
                    dto.contract.is_sdt_default = 1;
                }

                if (!string.IsNullOrEmpty(Request.Form["needTimeSheet"]) && Request.Form["needTimeSheet"].Equals("on"))
                {
                    dto.contract.timeentry_need_begin_end = 1;
                }
                else
                {
                    dto.contract.timeentry_need_begin_end = 0;
                }

                if (dto.contract.type_id == (int)DicEnum.CONTRACT_TYPE.BLOCK_HOURS)
                {
                    if (!string.IsNullOrEmpty(Request.Form["enableOverage"]) && Request.Form["enableOverage"].Equals("on"))
                    {
                        dto.contract.enable_overage_billing_rate = 1;
                    }
                }

                if (dto.contract.type_id == (int)DicEnum.CONTRACT_TYPE.FIXED_PRICE)
                {
                    if (!string.IsNullOrEmpty(Request.Form["applyPayment"]) && Request.Form["applyPayment"].Equals("on"))
                    {
                        decimal price = 0;
                        if (decimal.TryParse(Request.Form["alreadyReceived"], out price) && price > 0)
                        {
                            dto.alreadyReceived = price;
                        }
                        if (decimal.TryParse(Request.Form["toBeInvoiced"], out price) && price > 0)
                        {
                            dto.toBeInvoiced = price;
                        }
                        long code = 0;
                        if (long.TryParse(Request.Form["defaultCostCode"], out code))
                        {
                            dto.defaultCostCode = code;
                        }
                    }
                }

                if (udfList != null && udfList.Count > 0)                      // 首先判断是否有自定义信息
                {
                    var list = new List <UserDefinedFieldValue>();
                    foreach (var udf in udfList)                            // 循环添加
                    {
                        var new_udf = new UserDefinedFieldValue()
                        {
                            id    = udf.id,
                            value = Request.Form[udf.id.ToString()] == "" ? null : Request.Form[udf.id.ToString()],
                        };
                        list.Add(new_udf);
                    }
                    dto.udf = list;
                }

                // 服务
                dto.serviceList = new List <ServiceInfoDto>();
                if (dto.contract.type_id == (int)DicEnum.CONTRACT_TYPE.SERVICE)
                {
                    if (!string.IsNullOrEmpty(Request.Form["AddServiceIds"]))   // 服务
                    {
                        string[] ids = Request.Form["AddServiceIds"].Split(',');
                        foreach (string id in ids)
                        {
                            ServiceInfoDto si = new ServiceInfoDto();
                            si.price     = decimal.Parse(Request.Form["price" + id]);
                            si.number    = decimal.Parse(Request.Form["num" + id]);
                            si.serviceId = long.Parse(id);
                            si.type      = 1;
                            dto.serviceList.Add(si);
                        }
                    }
                    if (!string.IsNullOrEmpty(Request.Form["AddSerBunIds"]))    // 服务包
                    {
                        string[] ids = Request.Form["AddSerBunIds"].Split(',');
                        foreach (string id in ids)
                        {
                            ServiceInfoDto si = new ServiceInfoDto();
                            si.price     = decimal.Parse(Request.Form["price" + id]);
                            si.number    = decimal.Parse(Request.Form["num" + id]);
                            si.serviceId = long.Parse(id);
                            si.type      = 2;
                            dto.serviceList.Add(si);
                        }
                    }
                }

                // 里程碑
                dto.milestone = new List <ctt_contract_milestone>();
                if (dto.contract.type_id == (int)DicEnum.CONTRACT_TYPE.FIXED_PRICE && (!string.IsNullOrEmpty(Request.Form["milestoneAddList"])))
                {
                    string[] ids = Request.Form["milestoneAddList"].Split(',');
                    foreach (string id in ids)
                    {
                        ctt_contract_milestone mil = new ctt_contract_milestone();
                        mil.name        = Request.Form["MilName" + id];
                        mil.description = Request.Form["MilDetail" + id];
                        decimal dollar = 0;
                        if (!decimal.TryParse(Request.Form["MilAmount" + id], out dollar))
                        {
                            dollar = 0;
                        }
                        mil.dollars      = dollar;
                        mil.due_date     = DateTime.Parse(Request.Form["MilDate" + id]);
                        mil.cost_code_id = long.Parse(Request.Form["MilCode" + id]);
                        mil.status_id    = int.Parse(Request.Form["isBill" + id]);
                        dto.milestone.Add(mil);
                    }
                }

                // 角色费率
                dto.rateList = new List <ContractRateDto>();
                if (dto.contract.type_id != (int)DicEnum.CONTRACT_TYPE.SERVICE &&
                    dto.contract.type_id != (int)DicEnum.CONTRACT_TYPE.PER_TICKET)
                {
                    foreach (var role in roleList)
                    {
                        if (Request.Form["cbRoleRate" + role.id] != null && Request.Form["cbRoleRate" + role.id].Equals("on"))
                        {
                            var roleRate = new ContractRateDto();
                            roleRate.roleId = role.id;
                            roleRate.rate   = decimal.Parse(Request.Form["txtRoleRate" + role.id]);
                            dto.rateList.Add(roleRate);
                        }
                    }
                }

                // 邮件通知
                dto.notifyUserIds = new List <long>();
                foreach (var res in resourceList)
                {
                    if (Request.Form["notify" + res.id] != null && Request.Form["notify" + res.id].Equals("on"))
                    {
                        dto.notifyUserIds.Add(res.id);
                    }
                }
                if (dto.notifyUserIds.Count != 0)
                {
                    dto.notifySubject = Request.Form["notifyTitle"];
                    dto.notifyMessage = Request.Form["notifyContent"];
                    dto.notifyEmails  = Request.Form["notifyEmails"];
                }

                contractId = bll.CopyContract(dto, GetLoginUserId());
                isFinish   = 1;

                udfValues    = new UserDefinedFieldsBLL().GetUdfValue(DicEnum.UDF_CATE.CONTRACTS, dto.contract.id, udfList);
                contractCopy = new ctt_contract();
                contractType = dto.contract.type_id;
            }

            Dictionary <string, object> dics = bll.GetField();

            contractCate = dics["cate"] as List <DictionaryEntryDto>;
            periodType   = dics["periodType"] as List <DictionaryEntryDto>;
            periodType.Remove(periodType.Find(pt => pt.val.Equals(((int)DicEnum.QUOTE_ITEM_PERIOD_TYPE.ONE_TIME).ToString())));
            billPostType = dics["billPostType"] as List <DictionaryEntryDto>;
            slaList      = bll.GetSLAList();

            contractTypeName = bll.GetContractTypeName(contractType);
        }
Beispiel #22
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                // 预付时间合同、预付费合同、事件合同的详情主界面

                var contract_id = Request.QueryString["contract_id"];
                if (!string.IsNullOrEmpty(contract_id))
                {
                    thisContract = new ctt_contract_dal().FindNoDeleteById(long.Parse(contract_id));
                }

                var thisId = Request.QueryString["id"];
                var srDal  = new sys_resource_dal();
                var ccDal  = new crm_contact_dal();
                if (!string.IsNullOrEmpty(thisId))
                {
                    thisRule = new ctt_contract_notify_rule_dal().FindNoDeleteById(long.Parse(thisId));
                    if (thisRule != null)
                    {
                        isAdd        = false;
                        thisContract = new ctt_contract_dal().FindNoDeleteById(thisRule.contract_id);
                        new ctt_contract_notify_rule_recipient_dal();
                        thisRuleResList  = srDal.GetConRuleList(thisRule.id);
                        otherRuleResList = srDal.GetNotInConRuleList(thisRule.id);

                        thisRuleConList  = ccDal.GetConRuleList(thisRule.id);
                        otherRuleConList = ccDal.GetNotInConRuleList(thisRule.id, thisContract.account_id);
                    }
                }
                else
                {
                    otherRuleResList = srDal.GetSourceList();
                    otherRuleConList = ccDal.GetContactByAccountId(thisContract.account_id);
                }

                if (thisContract == null)
                {
                    Response.Write("<script>window.close();</script>");
                    Response.End();
                }
                if (thisContract.type_id == (int)DicEnum.CONTRACT_TYPE.BLOCK_HOURS || thisContract.type_id == (int)DicEnum.CONTRACT_TYPE.RETAINER || thisContract.type_id == (int)DicEnum.CONTRACT_TYPE.PER_TICKET)
                {
                    // conTypeName
                    List <sys_notify_tmpl> thisTemp = null;
                    var sntDal = new sys_notify_tmpl_dal();
                    if (thisContract.type_id == (int)DicEnum.CONTRACT_TYPE.BLOCK_HOURS)
                    {
                        conTypeName = "预付时间";
                        thisTemp    = sntDal.GetTempByEvent(DicEnum.NOTIFY_EVENT.BLOCK_CONTRACT_RULE);
                    }
                    else if (thisContract.type_id == (int)DicEnum.CONTRACT_TYPE.RETAINER)
                    {
                        conTypeName = "预付费";
                        thisTemp    = sntDal.GetTempByEvent(DicEnum.NOTIFY_EVENT.RETAINER_CONTRACT_RULE);
                    }
                    else
                    {
                        conTypeName = "事件";
                        thisTemp    = sntDal.GetTempByEvent(DicEnum.NOTIFY_EVENT.PER_CONTRACT_RULE);
                    }
                    notify_tmpl_id.DataTextField  = "name";
                    notify_tmpl_id.DataValueField = "id";
                    notify_tmpl_id.DataSource     = thisTemp;
                    notify_tmpl_id.DataBind();
                    if (thisRule != null)
                    {
                        notify_tmpl_id.SelectedValue = thisRule.notify_tmpl_id.ToString();
                    }
                }
                else
                {
                    Response.Write("<script>alert('该合同类型暂不能添加通知规则');window.close();</script>");
                    Response.End();
                }
            }
            catch (Exception)
            {
                Response.End();
            }
        }
Beispiel #23
0
        /// <summary>
        /// 撤销定期服务审批
        /// </summary>
        /// <param name="user_id"></param>
        /// <param name="ids"></param>
        /// <returns></returns>
        public ERROR_CODE Revoke_Recurring_Services(long user_id, string ids, out string re)
        {
            re = string.Empty;
            var user = UserInfoBLL.GetUserInfo(user_id);

            if (user == null)
            {   // 查询不到用户,用户丢失
                return(ERROR_CODE.USER_NOT_FIND);
            }
            StringBuilder                   returnvalue = new StringBuilder();
            crm_account_deduction           cad         = new crm_account_deduction();       //审批并提交
            ctt_contract_cost               ccc         = new ctt_contract_cost();           //成本
            ctt_contract                    cc          = new ctt_contract();                //合同
            ctt_contract_service_period     ccsp        = new ctt_contract_service_period(); //合同服务周期
            ctt_contract_service_adjust     ccsa        = new ctt_contract_service_adjust(); //合同服务调整
            ctt_contract_service_period_dal ccsp_dal    = new ctt_contract_service_period_dal();
            ctt_contract_service_adjust_dal ccsa_dal    = new ctt_contract_service_adjust_dal();

            if (!string.IsNullOrEmpty(ids))
            {
                var idList = ids.Split(',');
                foreach (var id in idList)
                {
                    var oldcad = cad = GetAccountDed(long.Parse(id));
                    if (cad.invoice_id != null)
                    {
                        var ci = new ctt_invoice_dal().FindNoDeleteById((long)cad.invoice_id);
                        if (ci.is_voided != 1)
                        {
                            returnvalue.Append(id + "条目已经生成发票(发票ID:" + cad.invoice_id + "),请先作废该发票\n");
                        }
                    }
                    else
                    {
                        cad.delete_time    = Tools.Date.DateHelper.ToUniversalTimeStamp(DateTime.Now);
                        cad.delete_user_id = user.id;
                        // 插入日志
                        var add1_log = 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.ACCOUNT_DEDUCTION,
                            oper_object_id      = cad.id,// 操作对象id
                            oper_type_id        = (int)OPER_LOG_TYPE.DELETE,
                            oper_description    = cad_dal.CompareValue(oldcad, cad),
                            remark              = "删除审批并提交"
                        };                                       // 创建日志
                        new sys_oper_log_dal().Insert(add1_log); // 插入日志
                        if (!cad_dal.Update(cad))
                        {
                            return(ERROR_CODE.ERROR);
                        }
                        //类型为服务
                        if (cad.type_id == (int)ACCOUNT_DEDUCTION_TYPE.SERVICE)
                        {
                            var oldccsp = ccsp = ccsp_dal.FindSignleBySql <ctt_contract_service_period>($"select * from ctt_contract_service_period where contract_id={cad.contract_id} and delete_time=0");
                            ccsp.approve_and_post_date    = null;
                            ccsp.approve_and_post_user_id = null;
                            ccsp.period_adjusted_price    = ccsp.period_price * ccsp.quantity;
                            ccsp.update_time    = Tools.Date.DateHelper.ToUniversalTimeStamp(DateTime.Now);
                            ccsp.update_user_id = user.id;
                            var add2_log = 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.CONTRACT_SERVICE_PERIOD, //
                                oper_object_id      = ccsp.id,                                        // 操作对象id
                                oper_type_id        = (int)OPER_LOG_TYPE.DELETE,
                                oper_description    = cad_dal.CompareValue(oldccsp, ccsp),
                                remark              = "修改合同服务周期"
                            };                                       // 创建日志
                            new sys_oper_log_dal().Insert(add2_log); // 插入日志
                            if (!ccsp_dal.Update(ccsp))
                            {
                                return(ERROR_CODE.ERROR);
                            }
                        }
                        //类型为服务调整
                        if (cad.type_id == (int)ACCOUNT_DEDUCTION_TYPE.SERVICE_ADJUST)
                        {
                            var oldccsa = ccsa = ccsa_dal.FindSignleBySql <ctt_contract_service_adjust>($"select * from ctt_contract_service_adjust where contract_id={cad.contract_id} and delete_time=0");
                            cc = new ctt_contract_dal().FindSignleBySql <ctt_contract>($"select * from ctt_contract where id={cad.contract_id} and delete_time=0");
                            ccsa.approve_and_post_date        = null;
                            ccsa.approve_and_post_user_id     = null;
                            ccsa.adjust_prorated_price_change = (decimal)cc.setup_fee;
                            ccsa.update_time    = Tools.Date.DateHelper.ToUniversalTimeStamp(DateTime.Now);
                            ccsa.update_user_id = user.id;
                            var add2_log = 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.CONTRACT_SERVICE_ADJUST, //
                                oper_object_id      = ccsp.id,                                        // 操作对象id
                                oper_type_id        = (int)OPER_LOG_TYPE.DELETE,
                                oper_description    = cad_dal.CompareValue(oldccsa, ccsa),
                                remark              = "修改合同服务调整"
                            };                                       // 创建日志
                            new sys_oper_log_dal().Insert(add2_log); // 插入日志
                            if (ccsp_dal.Update(ccsp))
                            {
                            }
                        }
                        //类型为初始费用
                        if (cad.type_id == (int)ACCOUNT_DEDUCTION_TYPE.INITIAL_COST)
                        {
                            var oldcc = cc = new ctt_contract_dal().FindSignleBySql <ctt_contract>($"select * from ctt_contract where id={cad.contract_id} and delete_time=0");
                            cc.adjust_setup_fee = cc.setup_fee;
                            cc.setup_fee_approve_and_post_user_id = null;
                            cc.setup_fee_approve_and_post_date    = null;
                            cc.update_time    = Tools.Date.DateHelper.ToUniversalTimeStamp(DateTime.Now);
                            cc.update_user_id = user.id;
                            var add2_log = 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.CONTACTS,
                                oper_object_id      = cad.id,// 操作对象id
                                oper_type_id        = (int)OPER_LOG_TYPE.UPDATE,
                                oper_description    = cad_dal.CompareValue(oldcc, cc),
                                remark              = "修改合同初始费用"
                            };                                       // 创建日志
                            new sys_oper_log_dal().Insert(add2_log); // 插入日志
                            if (!new ctt_contract_dal().Update(cc))
                            {
                                return(ERROR_CODE.ERROR);
                            }
                        }
                    }
                }
            }
            if (!string.IsNullOrEmpty(returnvalue.ToString()))
            {
                re = returnvalue.ToString();
                return(ERROR_CODE.EXIST);
            }
            return(ERROR_CODE.SUCCESS);
        }
Beispiel #24
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                thisBookMark = new IndexBLL().GetSingBook(Request.RawUrl, LoginUserId);
                //var checkLimitType = Request.QueryString["type_id"];
                //if (checkLimitType == ((int)DicEnum.PROJECT_TYPE.ACCOUNT_PROJECT).ToString() || checkLimitType == ((int)DicEnum.PROJECT_TYPE.IN_PROJECT).ToString())
                //{
                //    var result = GetLimitValue(AuthLimitEnum.PROClientAdd);
                //    if (result == DicEnum.LIMIT_TYPE_VALUE.NO960)
                //    {
                //        Response.Write("alert(没有新增项目权限);window.close();");
                //        return;
                //    }

                //}
                //else if (checkLimitType == ((int)DicEnum.PROJECT_TYPE.PROJECT_DAY).ToString())
                //{
                //    var result = GetLimitValue(AuthLimitEnum.PROProposalAdd);
                //    if (result == DicEnum.LIMIT_TYPE_VALUE.NO960)
                //    {
                //        Response.Write("alert(没有新增项目提案权限);window.close();");
                //        return;
                //    }
                //}
                //else if (checkLimitType == ((int)DicEnum.PROJECT_TYPE.TEMP).ToString())
                //{
                //    var result = GetLimitValue(AuthLimitEnum.PROTemplatesAdd);
                //    if (result == DicEnum.LIMIT_TYPE_VALUE.NO960)
                //    {
                //        Response.Write("alert(没有新增项目模板权限);window.close();");
                //        return;
                //    }
                //}
                var accountIdString = Request.QueryString["account_id"];
                if (!string.IsNullOrEmpty(accountIdString))
                {
                    account = new CompanyBLL().GetCompany(long.Parse(accountIdString));
                }
                callBaclFunction = Request.QueryString["callFunc"];

                isFromTemp = Request.QueryString["isFromTemp"];
                isTemp     = Request.QueryString["isTemp"];


                var id = Request.QueryString["id"];
                project_udfList = new UserDefinedFieldsBLL().GetUdf(DicEnum.UDF_CATE.PROJECTS);
                if (!string.IsNullOrEmpty(id))
                {
                    thisProject = new pro_project_dal().FindNoDeleteById(long.Parse(id));
                    if (thisProject != null)
                    {
                        if (thisProject.contract_id != null)
                        {
                            contract = new ctt_contract_dal().FindNoDeleteById((long)thisProject.contract_id);
                        }
                        if (thisProject.type_id == (int)DicEnum.PROJECT_TYPE.TEMP)
                        {
                            isTemp = "1";
                        }
                        taskList             = new sdk_task_dal().GetProTask(thisProject.id);
                        account              = new crm_account_dal().FindNoDeleteById(thisProject.account_id);
                        project_udfValueList = new UserDefinedFieldsBLL().GetUdfValue(DicEnum.UDF_CATE.PROJECTS, thisProject.id, project_udfList);
                        isAdd = false;
                    }
                }
                else
                {
                    if (!IsPostBack)
                    {
                        is_active.Checked      = true;
                        excludeWeekend.Checked = true;
                        excludeHoliday.Checked = true;
                        warnTime_off.Checked   = true;
                    }
                }
                if (!IsPostBack)
                {
                    PageDataBind();
                }

                if (thisProject != null)
                {
                    #region 根据项目信息为页面数据赋值
                    if (!IsPostBack)
                    {
                        line_of_business_id.SelectedValue      = thisProject.line_of_business_id == null ? "0" : thisProject.line_of_business_id.ToString();
                        type_id.SelectedValue                  = thisProject.type_id == null ? "0" : thisProject.type_id.ToString();
                        status_id.SelectedValue                = thisProject.status_id.ToString();
                        department_id.SelectedValue            = thisProject.department_id == null ? "0" : thisProject.department_id.ToString();
                        organization_location_id.SelectedValue = thisProject.organization_location_id.ToString();
                        template_id.SelectedValue              = thisProject.template_id == null ? "0" : thisProject.template_id.ToString();
                        useResource_daily_hours.Checked        = thisProject.use_resource_daily_hours == 1;
                        owner_resource_id.SelectedValue        = thisProject.owner_resource_id == null ? "0" : thisProject.owner_resource_id.ToString();
                        excludeWeekend.Checked                 = thisProject.exclude_weekend == 1;
                        excludeHoliday.Checked                 = thisProject.exclude_holiday == 1;
                        warnTime_off.Checked = thisProject.warn_time_off == 1;
                        if (!string.IsNullOrEmpty(isTemp))
                        {
                            is_active.Checked = thisProject.status_id == (int)DicEnum.PROJECT_STATUS.NEW;
                        }
                    }
                    #endregion
                }
            }
            catch (Exception msg)
            {
                Response.End();
            }
        }
Beispiel #25
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                var contract_id = Request.QueryString["id"];
                contract = new ctt_contract_dal().FindNoDeleteById(long.Parse(contract_id));
                var conAccount = new CompanyBLL().GetCompany(contract.account_id);

                thisBookMark = new IndexBLL().GetSingBook(Request.Url.LocalPath + "?id=" + contract_id, LoginUserId);
                #region 记录浏览历史
                var history = new sys_windows_history()
                {
                    title = "合同详情:" + contract.name + conAccount.name,
                    url   = Request.RawUrl,
                };
                new IndexBLL().BrowseHistory(history, LoginUserId);
                #endregion
                var type = Request.QueryString["type"];
                switch (type)
                {
                case "InternalCost":
                    viewContractIframe.Src = "../Common/SearchBodyFrame.aspx?cat=" + (int)EMT.DoneNOW.DTO.DicEnum.QUERY_CATE.CONTRACT_INTERNAL_COST + "&type=" + (int)EMT.DoneNOW.DTO.QueryType.InternalCost + "&id=" + contract.id;
                    ShowTitle.Text         = "内部成本-" + contract.name;
                    break;

                case "item":
                    viewContractIframe.Style["height"] = "300";
                    second.Style["height"]             = "600";
                    viewContractIframe.Src             = "../Common/SearchBodyFrame.aspx?cat=" + (int)EMT.DoneNOW.DTO.DicEnum.QUERY_CATE.RELATION_CONFIGITEM + "&type=" + (int)EMT.DoneNOW.DTO.QueryType.Relation_ConfigItem + "&id=" + contract_id;
                    second.Src     = "../Common/SearchBodyFrame.aspx?cat=" + (int)EMT.DoneNOW.DTO.DicEnum.QUERY_CATE.NORELATION_CONFIGITEM + "&type=" + (int)EMT.DoneNOW.DTO.QueryType.Norelation_ConfigItem + "&id=" + contract.account_id + "&contract_id=" + contract.id;
                    ShowTitle.Text = "配置项-" + contract.name;
                    break;

                case "charge":
                    viewContractIframe.Src = "../Common/SearchBodyFrame.aspx?isCheck=1&cat=" + (int)EMT.DoneNOW.DTO.DicEnum.QUERY_CATE.CONTRACT_CHARGE + "&type=" + (int)EMT.DoneNOW.DTO.QueryType.Contract_Charge + "&id=" + contract.id;
                    ShowTitle.Text         = "成本-" + contract.name;
                    break;

                case "defaultCost":
                    viewContractIframe.Src = "../Common/SearchBodyFrame.aspx?cat=" + (int)EMT.DoneNOW.DTO.DicEnum.QUERY_CATE.CONTRACT_DEFAULT_COST + "&type=" + (int)EMT.DoneNOW.DTO.QueryType.CONTRACT_DEFAULT_COST + "&id=" + contract.id;
                    ShowTitle.Text         = "默认成本-" + contract.name;
                    break;

                case "rate":
                    viewContractIframe.Src = "../Common/SearchBodyFrame.aspx?cat=" + (int)EMT.DoneNOW.DTO.DicEnum.QUERY_CATE.CONTRACT_TIME_RATE + "&type=" + (int)EMT.DoneNOW.DTO.QueryType.CONTRACT_RATE + "&id=" + contract.id;
                    ShowTitle.Text         = "预付时间系数-" + contract.name;
                    break;

                case "udf":
                    viewContractIframe.Src = "../Common/SearchBodyFrame.aspx?cat=" + (int)DicEnum.QUERY_CATE.CONTRACT_UDF + "&type=" + (int)QueryType.ContractUDF + "&id=" + contract.id;
                    ShowTitle.Text         = "自定义字段-" + contract.name;
                    break;

                case "block":
                    viewContractIframe.Src = "../Common/SearchBodyFrame.aspx?cat=" + (int)DicEnum.QUERY_CATE.CONTRACT_BLOCK + "&type=" + (int)QueryType.ContractBlock + "&id=" + contract.id;
                    ShowTitle.Text         = "预付费用-" + contract.name;
                    break;

                case "blockTime":
                    viewContractIframe.Src = "../Common/SearchBodyFrame.aspx?cat=" + (int)DicEnum.QUERY_CATE.CONTRACT_BLOCK_TIME + "&type=" + (int)QueryType.ContractBlockTime + "&id=" + contract.id;
                    ShowTitle.Text         = "预付时间-" + contract.name;
                    break;

                case "blockTicket":
                    viewContractIframe.Src = "../Common/SearchBodyFrame.aspx?cat=" + (int)DicEnum.QUERY_CATE.CONTRACT_BLOCK_TICKET + "&type=" + (int)QueryType.ContractBlockTicket + "&id=" + contract.id;
                    ShowTitle.Text         = "事件-" + contract.name;
                    break;

                case "roleRate":
                    viewContractIframe.Src = "../Common/SearchBodyFrame.aspx?cat=" + (int)DicEnum.QUERY_CATE.CONTRACT_RATE + "&type=" + (int)QueryType.ContractRate + "&id=" + contract.id;
                    ShowTitle.Text         = "费率-" + contract.name;
                    break;

                case "milestone":
                    viewContractIframe.Src = "../Common/SearchBodyFrame.aspx?cat=" + (int)DicEnum.QUERY_CATE.CONTRACT_MILESTONES + "&type=" + (int)QueryType.ContractMilestone + "&id=" + contract.id;
                    ShowTitle.Text         = "里程碑-" + contract.name;
                    break;

                case "service":
                    viewContractIframe.Src = "../Common/SearchBodyFrame.aspx?cat=" + (int)DicEnum.QUERY_CATE.CONTRACT_SERVICE + "&type=" + (int)QueryType.ContractService + "&id=" + contract.id;
                    second.Src             = "../Common/SearchBodyFrame.aspx?cat=" + (int)DicEnum.QUERY_CATE.CONTRACT_SERVICE_TRANS_HISTORY + "&type=" + (int)QueryType.ContractServiceTransHistory + "&id=" + contract.id;
                    ShowTitle.Text         = "服务-" + contract.name;
                    break;

                case "note":

                    ShowTitle.Text         = "合同备注-" + contract.name + (conAccount == null?"":$"({conAccount.name})");
                    viewContractIframe.Src = "ContractNoteShow?contract_id=" + contract.id;
                    break;

                case "rule":
                    viewContractIframe.Src = "../Common/SearchBodyFrame.aspx?cat=" + (int)DicEnum.QUERY_CATE.CONTRACT_NOTIFY_RULE + "&type=" + (int)QueryType.CONTRACT_NOTIFY_RULE + "&id=" + contract.id;
                    // 通知发送规则 - 合同名称(客户名称); contract_notify_rule
                    ShowTitle.Text = "通知发送规则-" + contract.name + (conAccount == null ? "" : $"({conAccount.name})");
                    break;

                case "project":
                    viewContractIframe.Src = "../Common/SearchBodyFrame.aspx?cat=" + (int)DicEnum.QUERY_CATE.CONTRACT_PROJECT + "&type=" + (int)QueryType.CONTRACT_PROJECT + "&con1175=" + contract.id;
                    ShowTitle.Text         = "合同项目-" + contract.name + (conAccount == null ? "" : $"({conAccount.name})");
                    break;

                case "exclusions":
                    ShowTitle.Text         = "例外因素-" + contract.name + (conAccount == null ? "" : $"({conAccount.name})");
                    viewContractIframe.Src = "ContractExclusions?contract_id=" + contract.id;
                    break;

                case "ticket":
                    ShowTitle.Text         = "合同工单";
                    viewContractIframe.Src = "../Common/SearchFrameSet.aspx?cat=" + (int)DicEnum.QUERY_CATE.MY_QUEUE_ACTIVE + "&type=" + (int)QueryType.MY_QUEUE_ACTIVE + "&group=215&param1=4876&param2=" + contract.id + "&param4=AddHidden";
                    break;

                default:
                    ShowTitle.Text         = "摘要-" + contract.name;
                    viewContractIframe.Src = "ContractSummary.aspx?id=" + contract.id;

                    break;
                }
            }
            catch (Exception)
            {
                Response.End();
            }
        }
Beispiel #26
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                var ticketIds = Request.QueryString["ticketIds"];
                var sdDal     = new sdk_task_dal();
                if (!string.IsNullOrEmpty(ticketIds))
                {
                    ticketList = sdDal.GetTicketByIds(ticketIds);
                }
                if (ticketList != null && ticketList.Count > 0)
                {
                    if (ticketList.Count == 1)
                    {
                        isSingle = true;
                    }
                    else
                    {
                        isSingle = false;
                    }
                    thisTicket = ticketList[0];
                }
                else
                {
                    Response.Write("<script>alert('未查询到相关工单信息!');window.close();</script>");
                    return;
                }
                var udfBLL = new UserDefinedFieldsBLL();
                if (thisTicket == null)
                {
                    Response.Write("<script>alert('未查询到相关工单信息!');window.close();</script>");
                }
                else
                {
                    thisAccount = new CompanyBLL().GetCompany(thisTicket.account_id);
                    thisUser    = new sys_resource_dal().FindNoDeleteById(LoginUserId);
                    #region 获取相关属性是否可以更改
                    if (ticketList.Any(_ => _.id != thisTicket.id))
                    {
                        isManyTitle = true;
                    }
                    else
                    {
                        isManyTitle = false;
                    }
                    if (ticketList.Any(_ => _.id != thisTicket.id))
                    {
                        isManydesc = true;
                    }
                    else
                    {
                        isManydesc = false;
                    }
                    if (ticketList.Any(_ => _.id != thisTicket.id && _.department_id != thisTicket.department_id))
                    {
                        isManyDep = true;
                    }
                    else
                    {
                        isManyDep = false;
                    }
                    if (ticketList.Any(_ => _.id != thisTicket.id && _.issue_type_id != thisTicket.issue_type_id))
                    {
                        isManyissType = true;
                    }
                    else
                    {
                        isManyissType = false;
                    }
                    if (ticketList.Any(_ => _.id != thisTicket.id && (_.owner_resource_id != thisTicket.owner_resource_id && _.role_id != thisTicket.role_id)))
                    {
                        isManyPri = true;
                    }
                    else
                    {
                        isManyPri = false;
                        if (thisTicket.owner_resource_id != null && thisTicket.role_id != null)
                        {
                            thisPriRes = new sys_resource_dal().FindNoDeleteById((long)thisTicket.owner_resource_id);
                            thisRole   = new sys_role_dal().FindNoDeleteById((long)thisTicket.role_id);
                            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];
                            }
                        }
                    }

                    if (ticketList.Any(_ => _.id != thisTicket.id && _.cate_id != thisTicket.cate_id))
                    {
                        isManyTicketCate = true;
                    }
                    else
                    {
                        isManyTicketCate = false;
                    }
                    if (ticketList.Any(_ => _.id != thisTicket.id && _.estimated_hours != thisTicket.estimated_hours))
                    {
                        isManyEstHour = true;
                    }
                    else
                    {
                        isManyEstHour = false;
                    }
                    if (ticketList.Any(_ => _.id != thisTicket.id && _.estimated_end_time != thisTicket.estimated_end_time))
                    {
                        isManyDueTime = true;
                    }
                    else
                    {
                        isManyDueTime = false;
                    }
                    if (ticketList.Any(_ => _.id != thisTicket.id && _.account_id != thisTicket.account_id))
                    {
                        isManyAccount = true;
                    }
                    else
                    {
                        isManyAccount = false;
                    }
                    if (ticketList.Any(_ => _.id != thisTicket.id && _.contract_id != thisTicket.contract_id))
                    {
                        isManyContract = true;
                    }
                    else
                    {
                        isManyContract = false;
                        if (thisTicket.contract_id != null)
                        {
                            thisContract = new ctt_contract_dal().FindNoDeleteById((long)thisTicket.contract_id);
                        }
                    }
                    if (ticketList.Any(_ => _.id != thisTicket.id && _.status_id != thisTicket.status_id))
                    {
                        isManyStatus = true;
                    }
                    else
                    {
                        isManyStatus = false;
                    }
                    if (ticketList.Any(_ => _.id != thisTicket.id && _.service_id != thisTicket.service_id))
                    {
                        isManySerivce = true;
                    }
                    else
                    {
                        isManySerivce = false;
                    }
                    if (ticketList.Any(_ => _.id != thisTicket.id && _.priority_type_id != thisTicket.priority_type_id))
                    {
                        isManyPrio = true;
                    }
                    else
                    {
                        isManyPrio = false;
                    }
                    if (ticketList.Any(_ => _.id != thisTicket.id && _.cost_code_id != thisTicket.cost_code_id))
                    {
                        isManyWork = true;
                    }
                    else
                    {
                        isManyWork = false;
                        if (thisTicket.cost_code_id != null)
                        {
                            thisWorkType = new d_cost_code_dal().FindNoDeleteById((long)thisTicket.cost_code_id);
                        }
                    }

                    if (ticketList.Any(_ => _.id != thisTicket.id && _.sub_issue_type_id != thisTicket.sub_issue_type_id))
                    {
                        isManySubIssType = true;
                    }
                    else
                    {
                        isManySubIssType = false;
                    }
                    // protected bool isManyStatus;
                    #endregion

                    udfValue = udfBLL.GetUdfValue(DicEnum.UDF_CATE.TASK, thisTicket.id, udfTaskPara);
                    if (udfTaskPara != null && udfTaskPara.Count > 0)
                    {
                        foreach (var udfTask in udfTaskPara)
                        {
                            var thisValue = "";
                            if (udfValue.FirstOrDefault(_ => _.id == udfTask.id) != null)
                            {
                                thisValue = udfValue.FirstOrDefault(_ => _.id == udfTask.id).value.ToString();
                            }
                            var count = new UserDefinedFieldsBLL().GetSameValueCount(DicEnum.UDF_CATE.TASK, ticketIds, udfTask.col_name, thisValue.ToString());
                            if (count > 1 && (!isSingle))
                            {
                                udfValue.FirstOrDefault(_ => _.id == udfTask.id).value = "多个值-保持不变";
                            }
                        }
                    }

                    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);
                        }
                    }
                }

                if (IsPostBack)
                {
                    var stDal      = new sdk_task_dal();
                    var ticBll     = new TicketBLL();
                    var accBll     = new CompanyBLL();
                    var notiResIds = new System.Text.StringBuilder();
                    foreach (var tic in ticketList)
                    {
                        var ticket = stDal.FindNoDeleteById(tic.id);
                        if (ticket == null)
                        {
                            continue;
                        }
                        var user = UserInfoBLL.GetUserInfo(LoginUserId);

                        #region 获取相关参数

                        #region 标题,描述,队列,主负责人
                        var pageTitle = ticket.title;
                        if (!isManyTitle)
                        {
                            pageTitle = Request.Form["title"];
                        }
                        var pageDesc = ticket.description;
                        if (!isManydesc)
                        {
                            pageDesc = Request.Form["description"];
                        }

                        var pageDepIdString    = Request.Form["department_id"];
                        var pagePriResIdString = Request.Form["pri_res"];
                        if (string.IsNullOrEmpty(pageDepIdString) && string.IsNullOrEmpty(pagePriResIdString))
                        {
                            Response.Write("<script>alert('队列和主负责人请填写其中一项!');</script>");
                            return;
                        }
                        long?pageDepId;
                        if (!string.IsNullOrEmpty(pageDepIdString) && pageDepIdString != "0")
                        {
                            pageDepId = long.Parse(pageDepIdString);
                        }
                        else if (string.IsNullOrEmpty(pageDepIdString))
                        {
                            pageDepId = null;
                        }
                        else
                        {
                            pageDepId = ticket.department_id;
                        }

                        long?pagePriResId;
                        if (!string.IsNullOrEmpty(pagePriResIdString) && pagePriResIdString != "0")
                        {
                            pagePriResId = long.Parse(pagePriResIdString);
                        }
                        else if (string.IsNullOrEmpty(pagePriResIdString))
                        {
                            pagePriResId = null;
                        }
                        else
                        {
                            pagePriResId = ticket.owner_resource_id;
                        }
                        #endregion

                        #region 种类,预估时间,到期时间,合同名称
                        var pageCateId       = ticket.cate_id;
                        var pageCateIdString = Request.Form["ticket_cate"];
                        if (!string.IsNullOrEmpty(pageCateIdString) && pageCateIdString != "0")
                        {
                            pageCateId = int.Parse(pageCateIdString);
                        }
                        else if (string.IsNullOrEmpty(pagePriResIdString))
                        {
                            Response.Write("<script>alert('请选择工单种类!');</script>");
                            return;
                        }
                        else
                        {
                            pageCateId = ticket.cate_id;
                        }

                        var estHours     = ticket.estimated_hours;
                        var pageEstHours = Request.Form["est_hours"];
                        if (!string.IsNullOrEmpty(pageEstHours) && pageEstHours.Trim() != "多个值-保持不变")
                        {
                            estHours = decimal.Parse(pageEstHours);
                        }
                        var dueTime     = ticket.estimated_end_time;
                        var pageDueTime = Request.Form["due_time"];
                        if (!string.IsNullOrEmpty(pageDueTime) && pageDueTime.Trim() != "多个值-保持不变")
                        {
                            dueTime = Tools.Date.DateHelper.ToUniversalTimeStamp(DateTime.Parse(pageDueTime));
                        }
                        var contractName = ticket.contract_id;
                        var pageContract = Request.Form["contractName"];
                        if (!string.IsNullOrEmpty(pageContract) && pageContract != "0")
                        {
                            contractName = long.Parse(pageContract);
                        }
                        else if (string.IsNullOrEmpty(pageContract))
                        {
                            contractName = null;
                        }
                        #endregion

                        #region 状态,服务包,优先级,工作类型,问题类型,子问题类型
                        var pageStatusId        = ticket.status_id;
                        var pageStuatusIdString = Request.Form["statusId"];
                        if (!string.IsNullOrEmpty(pageStuatusIdString) && pageStuatusIdString != "0")
                        {
                            pageStatusId = int.Parse(pageStuatusIdString);
                        }
                        else if (string.IsNullOrEmpty(pageStuatusIdString))
                        {
                            Response.Write("<script>alert('请选择工单状态!');</script>");
                            return;
                        }

                        var pageServiceId       = ticket.service_id;
                        var pageServiceIdString = Request.Form["serviceId"];
                        if (!string.IsNullOrEmpty(pageServiceIdString) && pageServiceIdString != "0")
                        {
                            pageServiceId = int.Parse(pageServiceIdString);
                        }
                        else if (string.IsNullOrEmpty(pageServiceIdString))
                        {
                            pageServiceId = null;
                        }

                        var pagePrioId       = ticket.priority_type_id;
                        var pagePrioIdString = Request.Form["priorityId"];
                        if (!string.IsNullOrEmpty(pagePrioIdString) && pagePrioIdString != "0")
                        {
                            pagePrioId = int.Parse(pagePrioIdString);
                        }
                        else if (string.IsNullOrEmpty(pagePrioIdString))
                        {
                            Response.Write("<script>alert('请选择工单优先级!');</script>");
                            return;
                        }

                        var workTypeId     = ticket.cost_code_id;
                        var pageWorkTypeId = Request.Form["workTypeId"];
                        if (!string.IsNullOrEmpty(pageWorkTypeId) && pageWorkTypeId != "0")
                        {
                            workTypeId = long.Parse(pageWorkTypeId);
                        }
                        else if (string.IsNullOrEmpty(pageWorkTypeId))
                        {
                            contractName = null;
                        }

                        var pageIssId       = ticket.issue_type_id;
                        var pageIssIdString = Request.Form["IssueType"];
                        if (!string.IsNullOrEmpty(pageIssIdString) && pageIssIdString != "0")
                        {
                            pageIssId = int.Parse(pageIssIdString);
                        }
                        else if (string.IsNullOrEmpty(pageIssIdString))
                        {
                            Response.Write("<script>alert('请选择问题类型!');</script>");
                            return;
                        }

                        var pageSubIssId       = ticket.sub_issue_type_id;
                        var pageSubIssIdString = Request.Form["SubIssueType"];
                        if (!string.IsNullOrEmpty(pageSubIssIdString) && pageSubIssIdString != "0")
                        {
                            pageSubIssId = int.Parse(pageSubIssIdString);
                        }
                        else if (string.IsNullOrEmpty(pageSubIssIdString))
                        {
                            Response.Write("<script>alert('请选择子问题类型!');</script>");
                            return;
                        }
                        #endregion

                        #region 自定义字段相关
                        var thisUdfValue = udfBLL.GetUdfValue(DicEnum.UDF_CATE.TASK, tic.id, udfTaskPara);
                        if (udfTaskPara != null && udfTaskPara.Count > 0)
                        {
                            var list = new List <UserDefinedFieldValue>();
                            foreach (var udf in udfTaskPara)
                            {
                                var new_udf = new UserDefinedFieldValue()
                                {
                                    id = udf.id
                                };
                                var thisvv = Request.Form[udf.id.ToString()];
                                if (udf.data_type == (int)DicEnum.UDF_DATA_TYPE.LIST)
                                {
                                    if (thisvv == "0")
                                    {
                                        new_udf.value = thisUdfValue.FirstOrDefault(_ => _.id == udf.id) == null ? "" : thisUdfValue.FirstOrDefault(_ => _.id == udf.id).value;
                                    }
                                    else
                                    {
                                        new_udf.value = thisvv == "" ? null : thisvv;
                                    }
                                }
                                else
                                {
                                    if (thisvv == "多个值-保持不变")
                                    {
                                        new_udf.value = thisUdfValue.FirstOrDefault(_ => _.id == udf.id) == null ? "" : thisUdfValue.FirstOrDefault(_ => _.id == udf.id).value;
                                    }
                                    else
                                    {
                                        new_udf.value = thisvv == "" ? null : thisvv;
                                    }
                                }
                                list.Add(new_udf);
                            }
                            udfBLL.UpdateUdfValue(DicEnum.UDF_CATE.TASK, udfTaskPara, ticket.id, list, user, DicEnum.OPER_LOG_OBJ_CATE.PROJECT_TASK);
                        }
                        #endregion

                        #endregion

                        #region 修改工单
                        ticket.title         = pageTitle;
                        ticket.description   = pageDesc;
                        ticket.department_id = pageDepId;
                        long?roleId = null;
                        if (pagePriResId != null)
                        {
                            var resDep = new sys_resource_department_dal().FindById((long)pagePriResId);
                            if (resDep != null)
                            {
                                pagePriResId = resDep.resource_id;
                                roleId       = resDep.role_id;
                            }
                            else
                            {
                                pagePriResId = null;
                                roleId       = null;
                            }
                        }
                        ticket.owner_resource_id  = pagePriResId;
                        ticket.role_id            = roleId;
                        ticket.cate_id            = pageCateId;
                        ticket.estimated_hours    = estHours;
                        ticket.estimated_end_time = dueTime;
                        ticket.contract_id        = contractName;
                        ticket.status_id          = pageStatusId;
                        ticket.service_id         = pageServiceId;
                        ticket.priority_type_id   = pagePrioId;
                        ticket.cost_code_id       = workTypeId;
                        ticket.issue_type_id      = pageIssId;
                        ticket.sub_issue_type_id  = pageSubIssId;

                        ticBll.EditTicket(ticket, LoginUserId);
                        #endregion

                        #region 生成备注
                        ticBll.AddModifyTicketNote(ticket.id, LoginUserId);
                        #endregion


                        #region 单个工单时 修改其他员工相关
                        if (isSingle)
                        {
                            var OtherResId = Request.Form["OtherResId"];
                            ticBll.TicketResManage(ticket.id, OtherResId, LoginUserId);
                        }
                        #endregion

                        #region 获取需要发送邮件的员工的Id
                        if (CkPriRes.Checked && ticket.owner_resource_id != null)
                        {
                            notiResIds.Append(ticket.owner_resource_id + ",");
                        }
                        if (CKcreate.Checked)
                        {
                            notiResIds.Append(ticket.create_user_id + ",");
                        }
                        if (CKaccMan.Checked)
                        {
                            var thisAccount = accBll.GetCompany(ticket.account_id);
                            if (thisAccount != null && thisAccount.resource_id != null)
                            {
                                notiResIds.Append(thisAccount.resource_id + ",");
                            }
                        }
                        #endregion
                    }


                    #region 通知相关
                    if (CCMe.Checked)
                    {
                        notiResIds.Append(LoginUserId + ",");
                    }
                    var resIds = Request.Form["resIds"];
                    if (!string.IsNullOrEmpty(resIds))
                    {
                        notiResIds.Append(resIds + ",");
                    }
                    var notify_id = Request.Form["notify_id"];
                    if (!string.IsNullOrEmpty(notify_id) && notify_id != "0")
                    {
                    }
                    #endregion
                    ClientScript.RegisterStartupScript(this.GetType(), "提示信息", "<script>alert('保存成功');self.opener.location.reload();window.close();</script>");
                }
            }
            catch (Exception msg)
            {
                Response.Write("<script>alert('" + msg.Message + "!');window.close();</script>");
            }
        }
Beispiel #27
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                var id = Request.QueryString["id"];
                thisTask = new sdk_task_dal().FindNoDeleteById(long.Parse(id));
                if (thisTask != null && thisTask.project_id != null)
                {
                    thisBookMark = new IndexBLL().GetSingBook(Request.Url.LocalPath + "?id=" + id, LoginUserId);
                    tvbDto.Add(new DictionaryEntryDto("type", "类型", 0));
                    tvbDto.Add(new DictionaryEntryDto("time", "操作时间", 0));
                    tvbDto.Add(new DictionaryEntryDto("resouName", "员工", 0));
                    tvbDto.Add(new DictionaryEntryDto("workHours", "实际工作时间", 0));
                    tvbDto.Add(new DictionaryEntryDto("notTiltle", "说明/标题", 0));
                    tvbDto.Add(new DictionaryEntryDto("billabled", "是否计费", 0));
                    tvbDto.Add(new DictionaryEntryDto("billed", "已计费", 0));

                    expDto.Add(new DictionaryEntryDto("type_id", "类型", 0));
                    expDto.Add(new DictionaryEntryDto("add_date", "费用日期", 0));
                    expDto.Add(new DictionaryEntryDto("create_user_id", "创建人", 0));
                    expDto.Add(new DictionaryEntryDto("expense_cost_code_id", "费用类别", 0));
                    expDto.Add(new DictionaryEntryDto("amount", "总额", 0));
                    expDto.Add(new DictionaryEntryDto("is_billable", "计费的", 0));
                    expDto.Add(new DictionaryEntryDto("approve_and_post_user_id", "已计费", 0));


                    v_task = new v_task_all_dal().FindById(thisTask.id);
                    if (thisTask.type_id == (int)DicEnum.TASK_TYPE.PROJECT_ISSUE)
                    {
                        taskType = "问题";
                    }
                    else if (thisTask.type_id == (int)DicEnum.TASK_TYPE.PROJECT_TASK)
                    {
                        taskType = "任务";
                    }
                    else
                    {
                        Response.End();
                    }
                    #region 记录浏览历史
                    var account = new CompanyBLL().GetCompany(thisTask.account_id);
                    var history = new sys_windows_history()
                    {
                        title = $"查看{taskType}:" + (thisProject != null ? thisProject.name : "") + " " + thisTask.title + " " + (account != null ? account.name : ""),
                        url   = Request.RawUrl,
                    };
                    new IndexBLL().BrowseHistory(history, LoginUserId);
                    #endregion
                    thisProject = new pro_project_dal().FindNoDeleteById((long)thisTask.project_id);
                    if (thisProject != null)
                    {
                        thisAccount = new crm_account_dal().FindNoDeleteById(thisProject.account_id);
                        if (thisProject.contract_id != null)
                        {
                            thisContract = new ctt_contract_dal().FindNoDeleteById((long)thisProject.contract_id);
                        }
                    }
                    thisTaskResList = new sdk_task_resource_dal().GetTaskResByTaskId(thisTask.id);
                    var roleList = dic.FirstOrDefault(_ => _.Key == "role").Value as List <sys_role>;
                    var sysList  = dic.FirstOrDefault(_ => _.Key == "sys_resource").Value as List <DictionaryEntryDto>;

                    #region 工时备注附件
                    var tasEntryList = new sdk_work_entry_dal().GetByTaskId(thisTask.id);
                    if (tasEntryList != null && tasEntryList.Count > 0)
                    {
                        var newList = (from a in tasEntryList
                                       join b in roleList on a.role_id equals b.id
                                       join c in sysList on a.resource_id equals long.Parse(c.val)
                                       select new TaskViewDto {
                            id = a.id, type = "entry", time = Tools.Date.DateHelper.ConvertStringToDateTime((long)(a.end_time ?? a.start_time)), resouName = c.show + "(" + b.name + ")", workHours = a.hours_worked, notTiltle = a.summary_notes, billabled = a.is_billable == 1?"✓":"", billed = a.approve_and_post_date == null?"": "✓", startDate = Tools.Date.DateHelper.ConvertStringToDateTime((long)a.start_time), workTypeId = a.cost_code_id, contractId = a.contract_id, showOnInv = a.show_on_invoice == 1, serviceId = a.service_id
                        }).ToList();

                        tvdList.AddRange(newList);
                    }
                    var conAttDal      = new com_attachment_dal();
                    var allTaskAttList = new List <com_attachment>();
                    var taskNoteList   = new com_activity_dal().GetActiList($" and (task_id ={thisTask.id} or object_id={thisTask.id} )");
                    if (taskNoteList != null && taskNoteList.Count > 0)
                    {
                        var newList = (from a in taskNoteList
                                       join c in sysList on a.resource_id equals long.Parse(c.val) into temp
                                       from tt in temp.DefaultIfEmpty()
                                       select new TaskViewDto {
                            id = a.id, type = "note", time = Tools.Date.DateHelper.ConvertStringToDateTime(a.create_time), resouName = tt == null ? "" : tt.show, notTiltle = a.name, noteDescr = a.description
                        }).ToList();
                        tvdList.AddRange(newList);

                        foreach (var thisTaskNote in taskNoteList)
                        {
                            var thisNoteAttList = conAttDal.GetAttListByOid(thisTaskNote.id);
                            if (thisNoteAttList != null && thisNoteAttList.Count > 0)
                            {
                                allTaskAttList.AddRange(thisNoteAttList);
                            }
                        }
                    }
                    var taskAttList = conAttDal.GetAttListByOid(thisTask.id);
                    if (taskAttList != null && taskAttList.Count > 0)
                    {
                        allTaskAttList.AddRange(taskAttList);
                    }
                    if (allTaskAttList.Count > 0)
                    {
                        var newList = (from a in allTaskAttList
                                       join c in sysList on a.create_user_id equals long.Parse(c.val) into temp
                                       from tt in temp.DefaultIfEmpty()
                                       select new TaskViewDto {
                            id = a.id, type = "atach", time = Tools.Date.DateHelper.ConvertStringToDateTime(a.create_time), resouName = tt == null?"":tt.show, notTiltle = a.title, fileType = a.type_id
                        }).ToList();
                        tvdList.AddRange(newList);
                    }
                    if (tvdList != null && tvdList.Count > 0)
                    {
                        tvbOrder = Request.QueryString["tvbOrder"];
                        tvdList  = tvdList.OrderBy(_ => _.time).ToList();
                        if (!string.IsNullOrEmpty(tvbOrder))
                        {
                            var tvbOrderArr = tvbOrder.Split(new char[] { '_' }, StringSplitOptions.RemoveEmptyEntries);
                            var orderFile   = tvbDto.FirstOrDefault(_ => _.val == tvbOrderArr[0]);
                            if (tvbOrderArr[1] == "desc")
                            {
                                //tvdList = (from a in tvdList
                                //           orderby tvbOrderArr[0]  descending
                                //           select a).ToList();
                                tvdList.Sort(delegate(TaskViewDto t1, TaskViewDto t2) {
                                    return(GetObjectPropertyValue(t2, tvbOrderArr[0]).CompareTo(GetObjectPropertyValue(t1, tvbOrderArr[0])));
                                });
                                orderFile.select = orderFile != null ? 2 : orderFile.select;
                            }
                            else
                            {
                                //tvdList = (from a in tvdList
                                //           orderby tvbOrderArr[0]
                                //           select a).ToList();
                                tvdList.Sort(delegate(TaskViewDto t1, TaskViewDto t2) {
                                    return(GetObjectPropertyValue(t1, tvbOrderArr[0]).CompareTo(GetObjectPropertyValue(t2, tvbOrderArr[0])));
                                });
                                orderFile.select = orderFile != null ? 1 : orderFile.select;
                            }
                        }
                    }
                    #endregion

                    #region 费用
                    taskExpList = new sdk_expense_dal().GetExpByTaskId(thisTask.id);
                    if (taskExpList != null && taskExpList.Count > 0)
                    {
                        taskExpList = taskExpList.OrderByDescending(_ => _.add_date).ToList();
                        expOrder    = Request.QueryString["expOrder"];
                        if (!string.IsNullOrEmpty(expOrder))
                        {
                            var expOrderArr = expOrder.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
                            var orderFile   = expDto.FirstOrDefault(_ => _.val == expOrderArr[0]);
                            if (expOrderArr[1] == "desc")
                            {
                                //taskExpList = (from a in taskExpList
                                //           orderby expOrderArr[0] descending
                                //           select a).ToList();
                                taskExpList.Sort(delegate(sdk_expense t1, sdk_expense t2) {
                                    return(GetObjectPropertyValue(t2, expOrderArr[0]).CompareTo(GetObjectPropertyValue(t1, expOrderArr[0])));
                                });
                                orderFile.select = orderFile != null ? 2 : orderFile.select;
                            }
                            else
                            {
                                //taskExpList = (from a in taskExpList
                                //           orderby expOrderArr[0]
                                //           select a).ToList();
                                taskExpList.Sort(delegate(sdk_expense t1, sdk_expense t2) {
                                    return(GetObjectPropertyValue(t1, expOrderArr[0]).CompareTo(GetObjectPropertyValue(t2, expOrderArr[0])));
                                });

                                orderFile.select = orderFile != null ? 1 : orderFile.select;
                            }
                        }
                    }
                    #endregion
                }
                else
                {
                    Response.End();
                }
            }
            catch (Exception msg)
            {
                Response.End();
            }
        }
Beispiel #28
0
        /// <summary>
        /// 获取到需要用到的参数
        /// </summary>
        /// <returns></returns>
        private CloseOpportunityDto GetParam()
        {
            var thisOppo = AssembleModel <crm_opportunity>();

            opportunity.stage_id           = thisOppo.stage_id;
            opportunity.resource_id        = thisOppo.resource_id;
            opportunity.primary_product_id = thisOppo.primary_product_id;
            opportunity.competitor_id      = thisOppo.competitor_id;
            opportunity.win_reason_type_id = thisOppo.win_reason_type_id;
            opportunity.win_reason         = thisOppo.win_reason;
            if (!string.IsNullOrEmpty(Request.Form["CloseDate"]))
            {
                opportunity.actual_closed_time = Tools.Date.DateHelper.ToUniversalTimeStamp(DateTime.Parse(Request.Form["CloseDate"]));
            }

            CloseOpportunityDto param = new CloseOpportunityDto()
            {
                opportunity     = this.opportunity,
                activateProject = activeproject.Checked,
                createContract  = addContractRequest.Checked,
                addServicesToExistingContract = addContractServices.Checked,
                createTicketPostSaleQueue     = addRequest.Checked,
            };

            var convertTo = Request.Form["optProject"];

            switch (convertTo)
            {
            case "rbProjectCost":
                param.convertToServiceTicket = true;
                break;

            case "RadioPC":
                param.convertToProject = true;
                break;

            case "rbContractCost":
                param.convertToNewContractt = true;
                break;

            case "RadioCCEx":
                param.convertToOldContract = true;
                break;

            case "RadioBI":
                param.convertToTicket = true;
                break;

            default:
                break;
            }

            if (addContractRequest.Checked) // 创建合同
            {
                var contract = new ctt_contract()
                {
                    name        = Request.Form["contract_name"],
                    start_date  = Convert.ToDateTime(Request.Form["start_date"]),
                    period_type = int.Parse(Request.Form["period_type"]),
                };

                if (Request.Form["RadioBtnEndDate"] == "on")  // 通过开始和结束时间添加
                {
                    contract.end_date = Convert.ToDateTime(Request.Form["end_date"]);
                }

                if (Request.Form["RadioBtnEndAfter"] == "on")  // 通过重复周期添加
                {
                    contract.occurrences = int.Parse(Request.Form["occurrences"]);
                }
                param.contract = contract;
            }
            if (addContractServices.Checked)  // 添加到现有合同
            {
                ctt_contract contract = new ctt_contract()
                {
                    id = string.IsNullOrEmpty(Request.Form["contract_id"]) ? 0 : long.Parse(Request.Form["contract_id"]),
                };
                param.contract       = contract;
                param.effective_date = Convert.ToDateTime(Request.Form["effective_date"]);
                if (!string.IsNullOrEmpty(Request.Form["isAddService"]))
                {
                    param.isAddService = true;
                }
                if (!string.IsNullOrEmpty(Request.Form["isUpdatePrice"]))
                {
                    param.isUpdatePrice = true;
                }
                if (!string.IsNullOrEmpty(Request.Form["isUpdateCost"]))
                {
                    param.isUpdateCost = true;
                }
            }

            Dictionary <long, string> dic = new Dictionary <long, string>();

            param.isIncludePO = isIncludePO.Checked;
            if (isIncludePO.Checked)
            {
                if (proAndOneTimeItem != null && proAndOneTimeItem.Count > 0)
                {
                    foreach (var item in proAndOneTimeItem)
                    {
                        if (!string.IsNullOrEmpty(Request.Form[item.id.ToString() + "_select"]))
                        {
                            dic.Add(item.id, Request.Form[item.id.ToString() + "_select"]);
                        }
                    }
                }
            }
            param.isIncludeShip = isIncludeShip.Checked;
            if (isIncludeShip.Checked)
            {
                if (shipItem != null && shipItem.Count > 0)
                {
                    foreach (var item in shipItem)
                    {
                        if (!string.IsNullOrEmpty(Request.Form[item.id.ToString() + "_select"]))
                        {
                            dic.Add(item.id, Request.Form[item.id.ToString() + "_select"]);
                        }
                    }
                }
            }
            param.isIncludeCharges = isIncludeCharges.Checked;
            if (isIncludeCharges.Checked)
            {
                if (degressionItem != null && degressionItem.Count > 0)
                {
                    foreach (var item in degressionItem)
                    {
                        if (!string.IsNullOrEmpty(Request.Form[item.id.ToString() + "_select"]))
                        {
                            dic.Add(item.id, Request.Form[item.id.ToString() + "_select"]);
                        }
                        else if (item.object_id != null)
                        {
                            dic.Add(item.id, item.object_id.ToString());
                        }
                    }
                }
            }
            param.costCodeList = dic;

            param.isNotiCreate = !string.IsNullOrEmpty(Request.Form["isNotiCre"]);
            if (!string.IsNullOrEmpty(Request.Form["notifi_temp"]))
            {
                param.notifi_temp = long.Parse(Request.Form["notifi_temp"]);
            }
            param.resIds     = Request.Form["resIds"];
            param.otherMails = Request.Form["otherMails"];
            return(param);
        }
Beispiel #29
0
        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>");
            }
        }
Beispiel #30
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                showResList = new UserResourceBLL().GetAgentUser(LoginUserId, out isAllowAgentRes);

                isComplete = !string.IsNullOrEmpty(Request.QueryString["is_complete"]);
                if (!IsPostBack)
                {
                    GetPageDataBind();
                }
                var ticket_id = Request.QueryString["ticket_id"];
                if (!string.IsNullOrEmpty(ticket_id))
                {
                    thisTicket = new sdk_task_dal().FindNoDeleteById(long.Parse(ticket_id));
                    if (thisTicket != null)
                    {
                        if (thisTicket.contact_id != null)
                        {
                            thisContract = new ctt_contract_dal().FindNoDeleteById((long)thisTicket.contract_id);
                        }
                        if (thisTicket.cost_code_id != null)
                        {
                            cost_code_id.SelectedValue = thisTicket.cost_code_id.ToString();
                        }
                    }
                }
                var service_id = Request.QueryString["service_id"];
                if (!string.IsNullOrEmpty(service_id))
                {
                    thisCall = new sdk_service_call_dal().FindNoDeleteById(long.Parse(service_id));
                }
                var id = Request.QueryString["id"];
                if (!string.IsNullOrEmpty(id))
                {
                    ticketLabour = new sdk_work_entry_dal().FindNoDeleteById(long.Parse(id));
                    if (ticketLabour != null)
                    {
                        isAdd      = false;
                        thisTicket = new sdk_task_dal().FindNoDeleteById(ticketLabour.task_id);
                        if (ticketLabour.resource_id != null)
                        {
                            resource_id.SelectedValue = ((long)ticketLabour.resource_id).ToString();
                        }
                        if (ticketLabour.cost_code_id != null)
                        {
                            cost_code_id.ClearSelection();
                            cost_code_id.SelectedValue = ticketLabour.cost_code_id.ToString();
                        }
                        if (ticketLabour.role_id != null)
                        {
                            role_id.SelectedValue = ticketLabour.role_id.ToString();
                        }
                        if (ticketLabour.contract_id != null)
                        {
                            thisContract = new ctt_contract_dal().FindNoDeleteById((long)ticketLabour.contract_id);
                        }
                    }
                }

                if (thisTicket != null)
                {
                    thisAccount = new CompanyBLL().GetCompany(thisTicket.account_id);
                    if (!isComplete)
                    {
                        status_id.SelectedValue = (thisTicket.status_id).ToString();
                    }
                    else
                    {
                        status_id.SelectedValue = ((int)DicEnum.TICKET_STATUS.DONE).ToString();
                    }
                }
                else
                {
                    Response.Write("<script>alert('未查询到该工单信息!');window.close();</script>");
                }

                if (thisAccount != null)
                {
                    accAlert = new crm_account_alert_dal().FindAlert(thisAccount.id, DicEnum.ACCOUNT_ALERT_TYPE.COMPANY_DETAIL_ALERT);
                }
            }
            catch (Exception msg)
            {
                Response.Write("<script>alert('" + msg.Message + "');window.close();</script>");
            }
        }