Пример #1
0
        private static String OrderAdminRemoveInvoice(HttpContext context)
        {
            try
            {
                if (NBrightBuyUtils.CheckManagerRights())
                {
                    var ajaxInfo = NBrightBuyUtils.GetAjaxInfo(context);
                    var itemId   = ajaxInfo.GetXmlPropertyInt("genxml/hidden/itemid");
                    if (itemId > 0)
                    {
                        var ordData = new OrderData(itemId);
                        if (ordData != null)
                        {
                            // save relitive path also
                            if (File.Exists(ordData.PurchaseInfo.GetXmlProperty("genxml/hidden/invoicefilepath")))
                            {
                                File.Delete(ordData.PurchaseInfo.GetXmlProperty("genxml/hidden/invoicefilepath"));
                            }


                            ordData.PurchaseInfo.SetXmlProperty("genxml/hidden/invoicefilepath", "");
                            ordData.PurchaseInfo.SetXmlProperty("genxml/hidden/invoicefilename", "");
                            ordData.PurchaseInfo.SetXmlProperty("genxml/hidden/invoicefileext", "");
                            ordData.PurchaseInfo.SetXmlProperty("genxml/hidden/invoicefilerelpath", "");
                            ordData.PurchaseInfo.SetXmlProperty("genxml/hidden/invoicedownloadname", "");
                            ordData.AddAuditMessage(NBrightBuyUtils.ResourceKey("OrderAdmin.cmdDeleteInvoice"), "invremove", UserController.Instance.GetCurrentUserInfo().Username, "False");

                            ordData.Save();
                        }
                    }

                    return("");
                }
                return("");
            }
            catch (Exception ex)
            {
                return(ex.ToString());
            }
        }