コード例 #1
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>");
            }
        }
コード例 #2
0
        /// <summary>
        /// 获取待审批条目的类型
        /// </summary>
        void GetItemType(HttpContext context)
        {
            long   id = 0;
            string itemType = string.Empty;
            string contract_id = ""; string task_id = "";

            if (!string.IsNullOrEmpty(context.Request.QueryString["id"]) && long.TryParse(context.Request.QueryString["id"], out id))
            {
                var cost         = new DAL.ctt_contract_cost_dal().FindNoDeleteById(id);
                var entry        = new DAL.sdk_work_entry_dal().FindNoDeleteById(id);
                var service      = new DAL.ctt_contract_service_dal().FindNoDeleteById(id);
                var milestone    = new DAL.ctt_contract_milestone_dal().FindNoDeleteById(id);
                var expense      = new DAL.sdk_expense_dal().FindNoDeleteById(id);
                var subscription = new DAL.crm_subscription_dal().FindNoDeleteById(id);

                if (cost != null)
                {
                    itemType = "cost"; contract_id = cost.contract_id.ToString(); task_id = cost.task_id.ToString();
                }
                else if (entry != null)
                {
                    itemType = "entry"; contract_id = entry.contract_id.ToString();
                }
                else if (service != null)
                {
                    itemType = "service"; contract_id = service.contract_id.ToString();
                }
                else if (milestone != null)
                {
                    itemType = "milestone"; contract_id = milestone.contract_id.ToString();
                }
                else if (expense != null)
                {
                    itemType = "expense";
                }
                else if (subscription != null)
                {
                    itemType = "subscription";
                }

                WriteResponseJson(new { itemType = itemType, contract_id = contract_id, task_id = task_id });
            }
        }