Ejemplo n.º 1
0
        public bool EditProduct(ivt_product product, long userId)
        {
            var oldProduct = _dal.FindNoDeleteById(product.id);

            if (oldProduct == null)
            {
                return(false);
            }
            product.update_time    = Tools.Date.DateHelper.ToUniversalTimeStamp();
            product.update_user_id = userId;
            _dal.Update(product);
            OperLogBLL.OperLogUpdate <ivt_product>(product, oldProduct, product.id, userId, OPER_LOG_OBJ_CATE.PRODUCT, "");
            return(true);
        }
Ejemplo n.º 2
0
 protected void Page_Load(object sender, EventArgs e)
 {
     id = Convert.ToInt32(Request.QueryString["id"]);                                //获取id
     GetMenus();
     product_udfList = new UserDefinedFieldsBLL().GetUdf(DicEnum.UDF_CATE.PRODUCTS); //自定义
     if (!IsPostBack)
     {
         var dic = pbll.GetField();
         this.Item_Type.DataTextField  = "show";
         this.Item_Type.DataValueField = "val";
         this.Item_Type.DataSource     = dic.FirstOrDefault(_ => _.Key == "Item_Type").Value;
         this.Item_Type.DataBind();
         this.Item_Type.Items.Insert(0, new ListItem()
         {
             Value = "0", Text = "   ", Selected = true
         });
         this.Period_Type.DataTextField  = "show";
         this.Period_Type.DataValueField = "val";
         this.Period_Type.DataSource     = dic.FirstOrDefault(_ => _.Key == "Period_Type").Value;
         this.Period_Type.DataBind();
         this.Period_Type.Items.Insert(0, new ListItem()
         {
             Value = "0", Text = "   ", Selected = true
         });
         if (id > 0)
         {
             product   = pbll.GetProduct(id);
             udfv_list = new UserDefinedFieldsBLL().GetUdfValue(DicEnum.UDF_CATE.PRODUCTS, id, product_udfList);
             if (product == null)
             {
                 Response.Write("<script>alert('获取相关信息失败,无法修改!');window.close();self.opener.location.reload();</script>");
             }
             else
             {
                 bind();
                 vendorlist = pbll.GetVendorList(product.id);
                 foreach (var ve in vendorlist)
                 {
                     VendorList.Add(new VendorDto()
                     {
                         vendor = ve, vendorname = pbll.GetVendorName((long)ve.vendor_account_id)
                     });
                 }
             }
         }
     }
 }
Ejemplo n.º 3
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>");
            }
        }
Ejemplo n.º 4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            var  insProId = Request.QueryString["insProId"];
            long id;

            if (!string.IsNullOrEmpty(insProId) && long.TryParse(insProId, out id))
            {
                insPro = new DAL.crm_installed_product_dal().FindNoDeleteById(id);
            }
            if (insPro != null)
            {
                product = new DAL.ivt_product_dal().FindNoDeleteById(insPro.product_id);
            }
            else
            {
                Response.Write("<script>alert('未获取到相关配置项!');window.close();</script>");
                return;
            }
        }
Ejemplo n.º 5
0
        /// <summary>
        /// 新增产品和相关供应商信息
        /// </summary>
        /// <param name="product">产品</param>
        /// <param name="vendordata">供应商集合</param>
        /// <param name="udf">自定义字段值</param>
        /// <param name="user_id">操作用户</param>
        /// <returns></returns>
        public ERROR_CODE InsertProductAndVendor(ivt_product product, VendorData vendordata, List <UserDefinedFieldValue> udf, long user_id)
        {
            //产品
            var user = UserInfoBLL.GetUserInfo(user_id);

            if (user == null)
            {   // 查询不到用户,用户丢失
                return(ERROR_CODE.USER_NOT_FIND);
            }
            product.id = (int)(_dal.GetNextIdCom());

            product.create_time    = product.update_time = Tools.Date.DateHelper.ToUniversalTimeStamp(DateTime.Now);
            product.create_user_id = product.update_user_id = user_id;

            //唯一性校验
            var propro = _dal.FindSignleBySql <ivt_product>($"select * from ivt_product where name='{ product.name}' and delete_time=0 ");

            if (propro != null)
            {
                return(ERROR_CODE.EXIST);
            }

            _dal.Insert(product);
            //更新日志
            var add_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.PRODUCT,
                oper_object_id      = product.id,// 操作对象id
                oper_type_id        = (int)OPER_LOG_TYPE.ADD,
                oper_description    = _dal.AddValue(product),
                remark              = "新增产品信息"
            };                                      // 创建日志

            new sys_oper_log_dal().Insert(add_log); // 插入日志

            //供应商
            foreach (var ve in vendordata.VENDOR)
            {
                ivt_product_vendor veve = new ivt_product_vendor();
                if (ve.operate == 3)
                {
                    veve.id                = (int)(_dal.GetNextIdCom());
                    veve.update_time       = veve.create_time = Tools.Date.DateHelper.ToUniversalTimeStamp(DateTime.Now);
                    veve.create_user_id    = user_id;
                    veve.product_id        = product.id;
                    veve.is_active         = ve.is_active;
                    veve.is_default        = ve.is_default;
                    veve.vendor_account_id = ve.vendor_account_id;
                    veve.vendor_cost       = ve.vendor_cost;
                    veve.vendor_product_no = ve.vendor_product_no;
                    _dal1.Insert(veve);

                    var add_vendor_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.PRODUCT_VENDOR,
                        oper_object_id      = veve.id,// 操作对象id
                        oper_type_id        = (int)OPER_LOG_TYPE.ADD,
                        oper_description    = _dal1.AddValue(veve),
                        remark              = "新增供应商信息"
                    };                                             // 创建日志
                    new sys_oper_log_dal().Insert(add_vendor_log); // 插入日志
                }
            }


            #region 保存产品扩展信息

            var udf_contact_list = new UserDefinedFieldsBLL().GetUdf(DicEnum.UDF_CATE.PRODUCTS);                                                                // 产品的自定义字段
            var udf_con_list     = udf;                                                                                                                         // 传过来的产品
            new UserDefinedFieldsBLL().SaveUdfValue(DicEnum.UDF_CATE.PRODUCTS, user_id, product.id, udf_contact_list, udf_con_list, OPER_LOG_OBJ_CATE.PRODUCT); // 保存成功即插入日志
            #endregion

            return(ERROR_CODE.SUCCESS);
        }
Ejemplo n.º 6
0
        /// <summary>
        /// 修改更新产品和相关供应商信息
        /// </summary>
        /// <param name="product">产品</param>
        /// <param name="vendordata">供应商集合</param>
        /// <param name="udf">自定义字段值</param>
        /// <param name="user_id">操作用户</param>
        /// <returns></returns>
        public ERROR_CODE UpdateProductAndVendor(ivt_product product, VendorData vendordata, List <UserDefinedFieldValue> udf, long user_id)
        {
            var user = UserInfoBLL.GetUserInfo(user_id);

            if (user == null)
            {   // 查询不到用户,用户丢失
                return(ERROR_CODE.USER_NOT_FIND);
            }
            //产品更新
            product.update_time    = Tools.Date.DateHelper.ToUniversalTimeStamp(DateTime.Now);
            product.update_user_id = user_id;

            //唯一性校验
            var         propro    = _dal.FindSignleBySql <ivt_product>($"select * from ivt_product where name='{product.name}' and delete_time=0 ");
            ivt_product oldpropro = _dal.FindSignleBySql <ivt_product>($"select * from ivt_product where id='{product.id}' and delete_time=0 ");

            if (propro != null && product.id != propro.id)
            {
                return(ERROR_CODE.EXIST);
            }
            //更新日志
            var add_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.PRODUCT,
                oper_object_id      = product.id,// 操作对象id
                oper_type_id        = (int)OPER_LOG_TYPE.UPDATE,
                oper_description    = _dal.CompareValue(oldpropro, product),
                remark              = "修改产品信息"
            };                                      // 创建日志

            new sys_oper_log_dal().Insert(add_log); // 插入日志
            if (!_dal.Update(product))
            {
                return(ERROR_CODE.ERROR);
            }
            //供应商更新
            foreach (var ve in vendordata.VENDOR)
            {
                ivt_product_vendor veve = new ivt_product_vendor();
                //删除
                if (ve.operate == 1)
                {
                    var de = _dal1.FindById(ve.id);
                    if (de != null)
                    {
                        de.delete_time    = Tools.Date.DateHelper.ToUniversalTimeStamp(DateTime.Now);
                        de.delete_user_id = user_id;
                        _dal1.Update(de);
                        var add_vendor_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.PRODUCT_VENDOR,
                            oper_object_id      = veve.id,// 操作对象id
                            oper_type_id        = (int)OPER_LOG_TYPE.DELETE,
                            oper_description    = _dal1.AddValue(veve),
                            remark              = "删除供应商信息"
                        };                                             // 创建日志
                        new sys_oper_log_dal().Insert(add_vendor_log); // 插入日志
                    }
                }

                //更新
                if (ve.operate == 2)
                {
                    veve = _dal1.FindById(ve.id);
                    if (veve != null)
                    {
                        veve.update_time       = Tools.Date.DateHelper.ToUniversalTimeStamp(DateTime.Now);
                        veve.update_user_id    = user_id;
                        veve.product_id        = product.id;
                        veve.is_active         = ve.is_active;
                        veve.is_default        = ve.is_default;
                        veve.vendor_account_id = ve.vendor_account_id;
                        veve.vendor_cost       = ve.vendor_cost;
                        veve.vendor_product_no = ve.vendor_product_no;
                        var oldve = GetSingelVendor(veve.id);
                        _dal1.Update(veve);
                        var add_vendor_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.PRODUCT_VENDOR,
                            oper_object_id      = veve.id,// 操作对象id
                            oper_type_id        = (int)OPER_LOG_TYPE.UPDATE,
                            oper_description    = _dal1.CompareValue(oldve, veve),
                            remark              = "修改供应商信息"
                        };                                             // 创建日志
                        new sys_oper_log_dal().Insert(add_vendor_log); // 插入日志
                    }
                }

                //新增
                if (ve.operate == 3)
                {
                    veve.id                = (int)(_dal.GetNextIdCom());
                    veve.update_time       = veve.create_time = Tools.Date.DateHelper.ToUniversalTimeStamp(DateTime.Now);
                    veve.create_user_id    = user_id;
                    veve.product_id        = product.id;
                    veve.is_active         = ve.is_active;
                    veve.is_default        = ve.is_default;
                    veve.vendor_account_id = ve.vendor_account_id;
                    veve.vendor_cost       = ve.vendor_cost;
                    veve.vendor_product_no = ve.vendor_product_no;
                    _dal1.Insert(veve);
                    var add_vendor_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.PRODUCT_VENDOR,
                        oper_object_id      = veve.id,// 操作对象id
                        oper_type_id        = (int)OPER_LOG_TYPE.ADD,
                        oper_description    = _dal1.AddValue(veve),
                        remark              = "新增供应商信息"
                    };                                             // 创建日志
                    new sys_oper_log_dal().Insert(add_vendor_log); // 插入日志
                }
            }

            var udfBll           = new UserDefinedFieldsBLL();
            var udf_contact_list = udfBll.GetUdf(DicEnum.UDF_CATE.PRODUCTS); // 产品的自定义字段

            udfBll.UpdateUdfValue(UDF_CATE.PRODUCTS, udf_contact_list, product.id, udf, new UserInfoDto {
                id = user.id, name = user.name
            }, OPER_LOG_OBJ_CATE.PRODUCT);

            return(ERROR_CODE.SUCCESS);
        }
Ejemplo n.º 7
0
        //处理数据
        #region 处理需要保存的数据
        private bool save_deal()
        {
            if (id > 0)
            {
                product = pbll.GetProduct(id);
            }
            //需要进行唯一性校验
            product.name = this.Product_Name.Text.ToString();
            string cate, code;

            //物料
            if (!string.IsNullOrEmpty(Request.Form["kkCallBackHidden"].ToString()))
            {
                code = Convert.ToString(Request.Form["kkCallBackHidden"]);
                code = code.TrimEnd(',');
                product.cost_code_id = Convert.ToInt32(code);
            }
            //产品种类
            if (Request.Form["accCallBackHidden"] != null && !string.IsNullOrEmpty(Request.Form["accCallBackHidden"].ToString()))
            {
                cate            = Convert.ToString(Request.Form["accCallBackHidden"]);
                cate            = cate.TrimEnd(',');
                product.cate_id = Convert.ToInt32(cate);
            }
            product.description = this.Product_Description.Text.ToString();
            if (!string.IsNullOrEmpty(this.Unit_Cost.Text.ToString()))
            {
                product.unit_cost = Convert.ToDecimal(this.Unit_Cost.Text.ToString());
            }
            if (!string.IsNullOrEmpty(this.Unit_Price.Text.ToString()))
            {
                product.unit_price = Convert.ToDecimal(this.Unit_Price.Text.ToString());
            }
            if (!string.IsNullOrEmpty(this.MSRP.Text.ToString()))
            {
                product.msrp = Convert.ToDecimal(this.MSRP.Text.ToString());
            }
            product.internal_id = this.Internal_Product_ID.Text.ToString();
            product.external_id = this.External_Product_ID.Text.ToString();
            product.link        = this.Product_Link.Text.ToString();
            if (this.Item_Type.SelectedValue.ToString() != "0")
            {
                product.installed_product_cate_id = Convert.ToInt32(this.Item_Type.SelectedValue.ToString());
            }
            if (this.Period_Type.SelectedValue.ToString() != "0")
            {
                product.period_type_id = Convert.ToInt32(this.Period_Type.SelectedValue.ToString());
            }
            if (this.Active.Checked)
            {
                product.is_active = 1;
            }
            if (this.Serialized.Checked)
            {
                product.is_serialized = 1;
            }
            if (this.does_not_require_procurement.Checked)
            {
                product.does_not_require_procurement = 1;
            }
            product.manu_name       = this.Manufacturer.Text.ToString();
            product.manu_product_no = this.Manufacturer_Product_Number.Text.ToString();
            product.sku             = this.Product_SKU.Text.ToString();
            string t = Request.Form["vendor_data"].ToString();

            t = t.Replace("[,", "[").Replace(",]", "]");
            var tt = new EMT.Tools.Serialize().DeserializeJson <VendorData>(t);

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

            #endregion

            //更新
            if (id > 0)
            {
                var result = pbll.UpdateProductAndVendor(product, tt, udfv_list, GetLoginUserId());
                switch (result)
                {
                case ERROR_CODE.EXIST: Response.Write("<script>alert(\"已经存在该名称的产品,请修改后保存!\");</script>"); break; //存在相同名称产品

                case ERROR_CODE.ERROR: Response.Write("<script>alert(\"保存失败!\");</script>"); break;              //操作失败

                case ERROR_CODE.USER_NOT_FIND:
                    Response.Write("<script>alert('查询不到用户,请重新登陆');</script>");
                    Response.Redirect("../Login.aspx");; break;     //获取操作者信息失败

                case ERROR_CODE.SUCCESS: Response.Write("<script>alert(\"产品修改成功!\");</script>");
                    return(true);                                                                                                       //成功

                default: Response.Write("<script>alert('异常错误,返回上一级!');window.close();self.opener.location.reload();</script>");; break; //失败
                }
            }
            //新增
            else
            {
                var result = pbll.InsertProductAndVendor(product, tt, udfv_list, GetLoginUserId());
                switch (result)
                {
                case ERROR_CODE.EXIST: Response.Write("<script>alert(\"已经存在该名称的产品,请修改后保存!\");</script>"); break; //存在相同名称产品

                case ERROR_CODE.ERROR: Response.Write("<script>alert(\"保存失败!\");</script>"); break;              //操作失败

                case ERROR_CODE.USER_NOT_FIND:
                    Response.Write("<script>alert('查询不到用户,请重新登陆');</script>");
                    Response.Redirect("../Login.aspx");; break;                                                                         //获取操作者信息失败

                case ERROR_CODE.SUCCESS: Response.Write("<script>alert(\"产品新增成功!\");</script>"); return(true);                          //成功

                default: Response.Write("<script>alert('异常错误,返回上一级!');window.close();self.opener.location.reload();</script>");; break; //失败
                }
            }
            return(false);
        }
Ejemplo n.º 8
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                thisBookMark     = new IndexBLL().GetSingBook(Request.RawUrl, LoginUserId);
                iProduct_udfList = new UserDefinedFieldsBLL().GetUdf(DicEnum.UDF_CATE.CONFIGURATION_ITEMS);
                var contract_id = Request.QueryString["contract_id"];
                if (!string.IsNullOrEmpty(contract_id))
                {
                    contract = new ctt_contract_dal().FindNoDeleteById(long.Parse(contract_id));
                    if (contract != null)
                    {
                        account = new CompanyBLL().GetCompany(contract.account_id);
                    }
                }
                var contactId = Request.QueryString["contact_id"];
                if (!string.IsNullOrEmpty(contactId))
                {
                    contact = new ContactBLL().GetContact(long.Parse(contactId));
                    if (contact != null)
                    {
                        account = new CompanyBLL().GetCompany(contact.account_id);
                    }
                }


                var id = Request.QueryString["id"];
                if (!string.IsNullOrEmpty(id))
                {
                    iProduct = new crm_installed_product_dal().GetInstalledProduct(long.Parse(id));
                    if (iProduct != null)
                    {
                        account = new CompanyBLL().GetCompany((long)iProduct.account_id);
                        product = new ivt_product_dal().FindNoDeleteById(iProduct.product_id);
                    }
                }
                var account_id = Request.QueryString["account_id"];
                if (!string.IsNullOrEmpty(account_id))
                {
                    account = new CompanyBLL().GetCompany(long.Parse(account_id));
                }
                //var contactList = new crm_contact_dal().GetContactByAccountId(account.id);
                //var serviceList = new ivt_service_dal().GetServiceList($" and vendor_id = {account.id}");
                #region 配置下拉框数据源

                var udfGroup = new d_general_dal().GetGeneralByTableId((int)GeneralTableEnum.UDF_FILED_GROUP);
                List <d_general> cateList = null;
                if (udfGroup != null && udfGroup.Count > 0)
                {
                    cateList = udfGroup.Where(_ => _.parent_id == (int)UDF_CATE.CONFIGURATION_ITEMS).ToList();
                }
                installed_product_cate_id.DataTextField  = "name";
                installed_product_cate_id.DataValueField = "id";
                installed_product_cate_id.DataSource     = cateList;
                installed_product_cate_id.DataBind();
                installed_product_cate_id.Items.Insert(0, new ListItem()
                {
                    Value = "", Text = "   ", Selected = true
                });

                //contact_id.DataTextField = "name";
                //contact_id.DataValueField = "id";
                //contact_id.DataSource = contactList;
                //contact_id.DataBind();
                //contact_id.Items.Insert(0, new ListItem() { Value = "", Text = "   ", Selected = true });

                //
                //service.DataTextField = "name";
                //service.DataValueField = "id";
                //service.DataSource = serviceList;
                //service.DataBind();
                //service.Items.Insert(0, new ListItem() { Value = "0", Text = "   ", Selected = true });
                //service.Enabled = false; // 所选合同如果是服务类型的,则此下拉框可选。可选内容为合同项
                #endregion
                if (iProduct != null)
                {
                    //account_id = iProduct.account_id.ToString();
                    iProduct_udfValueList = new UserDefinedFieldsBLL().GetUdfValue(DicEnum.UDF_CATE.CONFIGURATION_ITEMS, iProduct.id, iProduct_udfList);
                    var isCopy = Request.QueryString["isCopy"];

                    product = new EMT.DoneNOW.BLL.ProductBLL().GetProduct(iProduct.product_id);

                    isAdd = false;
                    if (!string.IsNullOrEmpty(isCopy) && isCopy == "1")
                    {
                        isAdd = true;
                    }
                    if (!isAdd)
                    {
                        #region 记录浏览历史
                        var history = new sys_windows_history()
                        {
                            title = "配置项:" + (product == null ? "" : product.name) + account.name,
                            url   = Request.RawUrl,
                        };
                        new IndexBLL().BrowseHistory(history, LoginUserId);
                        #endregion
                    }


                    if (iProduct.contract_id != null)
                    {
                        contract = new ctt_contract_dal().FindNoDeleteById((long)iProduct.contract_id);
                    }
                    if (iProduct.cate_id != null)
                    {
                        installed_product_cate_id.SelectedValue = iProduct.cate_id.ToString();
                    }


                    if (iProduct.contact_id != null)
                    {
                        contact_id.SelectedValue = iProduct.contact_id.ToString();
                    }
                    viewSubscription_iframe.Src = "../Common/SearchBodyFrame.aspx?cat=" + (int)EMT.DoneNOW.DTO.DicEnum.QUERY_CATE.CONFIGSUBSCRIPTION + "&type=" + (int)EMT.DoneNOW.DTO.QueryType.CONFIGSUBSCRIPTION + "&id=" + iProduct.id;

                    view_ticket_iframe.Src = "../Common/SearchBodyFrame.aspx?cat=" + (int)EMT.DoneNOW.DTO.DicEnum.QUERY_CATE.MY_QUEUE_ACTIVE + "&type=" + (int)EMT.DoneNOW.DTO.QueryType.MY_QUEUE_ACTIVE + "&group=215&con3962=" + iProduct.id + "&param1=ShowPara";
                    // todo 订阅的通用查询
                    // "../Common/SearchBodyFrame.aspx?cat=" + (int)EMT.DoneNOW.DTO.DicEnum.QUERY_CATE.CONTACT_COMPANY_VIEW + "&type=" + (int)EMT.DoneNOW.DTO.QueryType.ContactCompanyView + "&id=" + id;
                    thisNoteAtt = new com_attachment_dal().GetAttListByOid(iProduct.id);
                    if (!isAdd)
                    {
                        if (iProduct.parent_id != null)
                        {
                            parentInsPro = new crm_installed_product_dal().GetInstalledProduct((long)iProduct.parent_id);
                        }
                        childInsProList = new crm_installed_product_dal().GetChildInsPro(iProduct.id);
                    }
                }
                if (!IsPostBack)
                {
                    is_active_.Checked = true;
                    if (iProduct != null)
                    {
                        is_active_.Checked = iProduct.is_active == 1;
                    }
                }
            }
            catch (Exception msg)
            {
                Response.Write("<script>alert('" + msg.Message + "');window.close();</script>");
            }
        }
Ejemplo n.º 9
0
        protected void Page_Load(object sender, EventArgs e)
        {
            thisBookMark = new IndexBLL().GetSingBook(Request.RawUrl, LoginUserId);
            if (!IsPostBack)
            {
                Bind();  // 绑定页面下拉数据
            }
            if (noteTypeList != null && noteTypeList.Count > 0)
            {
                noteTypeList = noteTypeList.Where(_ => _.ext2 == ((int)DicEnum.TASK_TYPE.RECURRING_TICKET_MASTER).ToString()).ToList();
            }
            if (publishList != null && publishList.Count > 0)
            {
                publishList = publishList.Where(_ => _.ext2 == ((int)DicEnum.ACTIVITY_CATE.TICKET_NOTE).ToString()).ToList();
            }
            var ticketId = Request.QueryString["id"];

            if (!string.IsNullOrEmpty(ticketId))
            {
                thisTicket = new sdk_task_dal().FindNoDeleteById(long.Parse(ticketId));
            }
            if (thisTicket != null)
            {
                isAdd    = false;
                objectId = thisTicket.id;
                #region 获取工单基本信息
                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)
                {
                    priRes   = 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 (thisTicket.contract_id != null)
                {
                    thisContract = new ctt_contract_dal().FindNoDeleteById((long)thisTicket.contract_id);
                }
                status_id.SelectedValue = thisTicket.status_id.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.cate_id != null)
                {
                    cate_id.SelectedValue = thisTicket.cate_id.ToString();
                }
                if (thisTicket.cost_code_id != null)
                {
                    cost_code_id.SelectedValue = thisTicket.cost_code_id.ToString();
                }
                if (thisTicket.department_id != null)
                {
                    department_id.SelectedValue = thisTicket.department_id.ToString();
                }
                if (thisTicket.installed_product_id != null)
                {
                    insPro = new crm_installed_product_dal().FindNoDeleteById((long)thisTicket.installed_product_id);
                }
                if (insPro != null)
                {
                    thisProduct = new ivt_product_dal().FindNoDeleteById(insPro.product_id);
                }
                #endregion

                #region 获取工单周期信息
                thisticketRes = new sdk_recurring_ticket_dal().GetByTicketId(thisTicket.id);
                #endregion
                ticketUdfValueList = new UserDefinedFieldsBLL().GetUdfValue(DicEnum.UDF_CATE.TASK, thisTicket.id, tickUdfList);

                #region 记录浏览历史
                var history = new sys_windows_history()
                {
                    title = $"编辑定期服务主工单:" + thisTicket.no + " " + thisTicket.title + " " + (thisAccount != null ? thisAccount.name : ""),
                    url   = Request.RawUrl,
                };
                new IndexBLL().BrowseHistory(history, LoginUserId);
                #endregion
            }
        }
Ejemplo n.º 10
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                var cid        = Request.QueryString["contract_id"];
                var project_id = Request.QueryString["project_id"];
                var ccid       = Request.QueryString["cost_id"];
                if (!string.IsNullOrEmpty(cid))
                {
                    contract = new ctt_contract_dal().FindNoDeleteById(long.Parse(cid));
                }
                if (!string.IsNullOrEmpty(project_id))
                {
                    thisProject = new pro_project_dal().FindNoDeleteById(long.Parse(project_id));
                }

                conCost = new ctt_contract_cost_dal().FindNoDeleteById(long.Parse(ccid));
                if (conCost != null)
                {
                    if (conCost.product_id != null)
                    {
                        product = new ivt_product_dal().FindNoDeleteById((long)conCost.product_id);
                    }
                    else
                    {
                        product = new ivt_product_dal().GetDefaultProduct();
                    }
                    if (conCost.quantity != null)
                    {
                        var thisSubList = new crm_installed_product_dal().GetInsProByCostId(conCost.id, (long)conCost.quantity);
                        int num         = (int)conCost.quantity;
                        if (thisSubList != null && thisSubList.Count > 0)
                        {
                            num          = (int)conCost.quantity - thisSubList.Count;
                            exisCostList = new ctt_contract_cost_dal().GetItemByNum(conCost.id, thisSubList.Count);
                        }
                        if (num > 0)
                        {
                            costList = new ctt_contract_cost_dal().GetItemByNum(conCost.id, num);
                        }
                    }
                    if (costList != null && costList.Count > 0)
                    {
                    }
                }
                if (conCost == null)
                {
                    Response.Write("<script>alert('未查询到成本');window.close();</script>");
                    return;
                }
                if (conCost.create_ci == 1)
                {
                    Response.Write("<script>alert('成本已创建配置项!');window.close();</script>");
                    return;
                }
            }
            catch (Exception)
            {
                Response.End();
            }
        }