コード例 #1
0
 public AccountController()
 {
     NguoidungService      = IoC.Resolve <INGUOIDUNGService>();
     _iLogSystemService    = IoC.Resolve <ILogSystemService>();
     UserDataService       = IoC.Resolve <IuserService>();
     authenticationService = IoC.Resolve <FanxiAuthenticationBase>();
 }
コード例 #2
0
 public NHOMCHUCNANGController()
 {
     _IMODULEService              = IoC.Resolve <IMODULEService>();
     _INHOMCHUCNANGService        = IoC.Resolve <INHOMCHUCNANGService>();
     _iLogSystemService           = IoC.Resolve <ILogSystemService>();
     _INHOMCHUCNANG_OBJECTService = IoC.Resolve <INHOMCHUCNANG_OBJECTService>();
 }
コード例 #3
0
 public RolePermissionController()
 {
     _iLogSystemService = IoC.Resolve <ILogSystemService>();
     _iroleService      = IoC.Resolve <IroleService>();
     _iobjService       = IoC.Resolve <IobjectService>();
     _ipmsService       = IoC.Resolve <IpermissionService>();
     _iTypeRoleService  = IoC.Resolve <ITYPE_ROLEService>();
 }
コード例 #4
0
 public ObjectController()
 {
     _iService                    = IoC.Resolve <IobjectService>();
     _ipmsService                 = IoC.Resolve <IpermissionService>();
     _iLogSystemService           = IoC.Resolve <ILogSystemService>();
     _INHOMCHUCNANGService        = IoC.Resolve <INHOMCHUCNANGService>();
     _INHOMCHUCNANG_OBJECTService = IoC.Resolve <INHOMCHUCNANG_OBJECTService>();
 }
コード例 #5
0
 public PermissionController()
 {
     _iPMSService             = IoC.Resolve <IpermissionService>();
     _iServiceObj             = IoC.Resolve <IobjectService>();
     _iTypeRoleService        = IoC.Resolve <ITYPE_ROLEService>();
     _iroleService            = IoC.Resolve <IroleService>();
     _iLogSystemService       = IoC.Resolve <ILogSystemService>();
     _ITYPE_PERMISSIONService = IoC.Resolve <ITYPE_PERMISSIONService>();
 }
コード例 #6
0
 public QuanLyNguoiDungController()
 {
     CurrentNguoidung    = ((EISContext)FXContext.Current).CurrentNguoidung;
     UserDataService     = IoC.Resolve <IuserService>();
     RoleService         = IoC.Resolve <IroleService>();
     DmcosokcbService    = IoC.Resolve <IDMCOSOKCBService>();
     Nguoidung           = IoC.Resolve <INGUOIDUNGService>();
     DmDonviService      = IoC.Resolve <IDM_DONVIService>();
     ApplicationsService = IoC.Resolve <IApplicationsService>();
     _iLogSystemService  = IoC.Resolve <ILogSystemService>();
     TypeRoleService     = IoC.Resolve <ITYPE_ROLEService>();
     GetValueCommon();
 }
コード例 #7
0
        public ActionResult CancelInvApprove(string[] cbeinv, string hdPattern, string Serial)
        {
            Company         currentCom = ((EInvoiceContext)FXContext.Current).CurrentCompany;
            IInvoiceService IInvSrv    = InvServiceFactory.GetService(hdPattern, currentCom.id);

            try
            {
                int[] invIds = (from s in cbeinv select Convert.ToInt32(s)).ToArray();
                if (invIds.Length < 0)
                {
                    Messages.AddErrorMessage("Bạn chưa chọn hóa đơn để hủy.");
                    return(RedirectToAction("CancelInvNotReIndex", new { Pattern = hdPattern, Serial = Serial }));
                }
                ILogSystemService businessLog = IoC.Resolve <ILogSystemService>();
                IList <IInvoice>  invLst      = IInvSrv.GetByID(currentCom.id, invIds);
                int succCount = 0;
                IInvSrv.BeginTran();
                var context = (EInvoiceContext)FXContext.Current;
                foreach (var item in invIds)
                {
                    IInvoice Oinvoice = IInvSrv.GetByID(currentCom.id, hdPattern, item);
                    if (Oinvoice.Status == InvoiceStatus.CanceledInv || Oinvoice.Status == InvoiceStatus.ReplacedInv || Oinvoice.Status == InvoiceStatus.AdjustedInv)
                    {
                        continue;
                    }
                    succCount++;
                    Oinvoice.Status = InvoiceStatus.CanceledInv;
                    Oinvoice.Note  += "  || Thực hiện hủy Hóa đơn (Không thay thế):   Người hủy:" + context.CurrentUser.username + "   Ngày hủy:" + DateTime.Now.ToString();
                    IInvSrv.Update(Oinvoice);
                    log.Info("INVCANCEL_" + context.CurrentUser.username + "_" + hdPattern + "_" + Oinvoice.Serial + "_" + Oinvoice.No + "_" + DateTime.Now);
                    businessLog.WriteLogCancel(currentCom.id, context.CurrentUser.username, Oinvoice.Pattern, Oinvoice.Serial, Oinvoice.No.ToString("0000000"), Oinvoice.ArisingDate, Oinvoice.Amount, Oinvoice.CusName, Oinvoice.CusAddress, Oinvoice.CusCode, Oinvoice.CusTaxCode, BusinessLogType.Cancel);
                }
                if (succCount == 0)
                {
                    Messages.AddErrorFlashMessage("Kiểm tra lại hóa đơn hủy, có thể đã được thanh toán hoặc sửa đổi.");
                }
                else
                {
                    IInvSrv.CommitTran();
                    Messages.AddFlashMessage("Tổng số hóa đơn hủy là:" + succCount);
                }
                return(RedirectToAction("CancelInvNotReIndex", new { Pattern = hdPattern, Serial = Serial }));
            }
            catch (Exception ex)
            {
                Messages.AddErrorFlashMessage("Có lỗi trong quá trình xử lý, vui lòng thực hiện lại!");
                log.Error(" CancelInvApprove -" + ex.Message);
                IInvSrv.RolbackTran();
                return(RedirectToAction("CancelInvNotReIndex", new { Pattern = hdPattern, Serial = Serial }));
            }
        }
コード例 #8
0
ファイル: BaseController.cs プロジェクト: thachgiasoft/Code
 protected bool TryLogSystem(string yourEvent, string yourComment)
 {
     try
     {
         ILogSystemService _iLogSystemService = IoC.Resolve <ILogSystemService>();
         var nguoidung = ((EISContext)FXContext.Current).CurrentNguoidung;
         _iLogSystemService.CreateNew(nguoidung.TENDANGNHAP.Trim(), yourEvent.Trim(), yourComment.Trim(),
                                      Helper.GetIPAddress.GetVisitorIPAddress(), HttpContext.Request.Browser.Browser);
         return(true);
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.Message);
         return(false);
     }
 }
コード例 #9
0
        public ActionResult Index(LogIndexModel model, int?page)
        {
            int total                  = 0;
            int pagesize               = 10;
            int currentPageIndex       = page.HasValue ? page.Value - 1 : 0;
            ILogSystemService logSrv   = IoC.Resolve <ILogSystemService>();
            string            kw       = !string.IsNullOrEmpty(model.keyword) ? model.keyword.Trim() : null;
            DateTime          DateFrom = String.IsNullOrEmpty(model.fromdate) ? DateTime.MinValue : DateTime.ParseExact(model.fromdate, "dd/MM/yyyy", null);
            DateTime          DateTo   = String.IsNullOrEmpty(model.todate) ? DateTime.MaxValue : DateTime.ParseExact(model.todate, "dd/MM/yyyy", null);

            if (DateFrom == DateTo)
            {
                DateTo = DateFrom.AddHours(12);
            }
            var list = logSrv.GetByFilter(kw, DateFrom, DateTo, currentPageIndex, pagesize, out total);

            model.LogData = new PagedList <LogData>(list, currentPageIndex, pagesize, total);
            return(View(model));
        }
コード例 #10
0
ファイル: LauncherService.cs プロジェクト: war-man/vInvoice
        public void PublishAdjust(IInvoice OriINV, IList <ProductInv> lst, InvoiceBase INV, string AttacheFile = "")
        {
            Company currentCom = ((EInvoiceContext)FXContext.Current).CurrentCompany;

            try
            {
                Launcher.Instance.PublishAdjust(OriINV, lst, INV, AttacheFile);
                Message = "OK:";
                try
                {
                    ILogSystemService businessLog = IoC.Resolve <ILogSystemService>();
                    businessLog.WriteLogReplaceAdjust(currentCom.id, OriINV.Pattern, OriINV.Serial, OriINV.No, OriINV.PublishDate, OriINV.Amount, INV.Pattern, INV.Serial, INV.No, INV.PublishDate, INV.Amount, INV.CusName, INV.CusAddress, INV.CusCode, INV.CusTaxCode, HttpContext.Current.User.Identity.Name, BusinessLogType.Adjust);
                    businessLog.CommitChanges();
                }
                catch { }
            }
            catch (Exception ex)
            {
                Message = ex.Message;
            }
        }
コード例 #11
0
 public IHttpActionResult RemoteCancel(RemoteInvoice data)
 {
     try
     {
         Company  currentCompany = ((EInvoiceContext)FXContext.Current).CurrentCompany;
         XElement elem           = XElement.Parse(data.InvData);
         IEnumerable <XElement>       listTemp = elem.Elements("key");
         IDictionary <string, byte[]> dictInv  = new Dictionary <string, byte[]>();
         IInvoiceService   IInvSrv             = InvServiceFactory.GetService(data.InvPattern, currentCompany.id);
         var               context             = (EInvoiceContext)FXContext.Current;
         ILogSystemService businessLog         = IoC.Resolve <ILogSystemService>();
         int               succCount           = 0;
         foreach (var item in listTemp)
         {
             IInvoice Oinvoice = IInvSrv.GetByFkey(currentCompany.id, item.Value);
             if (Oinvoice == null || Oinvoice.Status == InvoiceStatus.CanceledInv || Oinvoice.Status == InvoiceStatus.ReplacedInv || Oinvoice.Status == InvoiceStatus.AdjustedInv)
             {
                 continue;
             }
             succCount++;
             Oinvoice.Status = InvoiceStatus.CanceledInv;
             Oinvoice.Note  += "  || Thực hiện hủy Hóa đơn (Không thay thế):   Người hủy:" + context.CurrentUser.username + "   Ngày hủy:" + DateTime.Now.ToString();
             IInvSrv.Update(Oinvoice);
             businessLog.WriteLogCancel(currentCompany.id, context.CurrentUser.username, Oinvoice.Pattern, Oinvoice.Serial, Oinvoice.No.ToString("0000000"), Oinvoice.ArisingDate, Oinvoice.Amount, Oinvoice.CusName, Oinvoice.CusAddress, Oinvoice.CusCode, Oinvoice.CusTaxCode, BusinessLogType.Cancel);
         }
         if (succCount == 0)
         {
             return(Ok <string>("ERROR:Kiểm tra lại hóa đơn hủy, có thể đã được thanh toán hoặc sửa đổi."));
         }
         else
         {
             IInvSrv.CommitTran();
             return(Ok <string>("OK:Tổng số hóa đơn hủy là:" + succCount));
         }
     }
     catch (Exception ex)
     {
         return(Ok("ERROR"));
     }
 }
コード例 #12
0
        private string processCancelInv(string fkey, string pattern = null, string serial = null, decimal invNo = 0)
        {
            Company _currentCompany = ((EInvoiceContext)FXContext.Current).CurrentCompany;
            int     comID           = _currentCompany.id;

            if (_currentCompany == null)
            {
                return("ERR:7");                        //username khong phu hop - ko tim thay company phu hop voi [username]
            }
            int isPattern = string.IsNullOrEmpty(pattern) ? 0 : 1;
            IPublishInvoiceService _PubInvSrv = IoC.Resolve <IPublishInvoiceService>();

            switch ((isPattern))
            {
            case 0:
                PublishInvoice pubinv = _PubInvSrv.GetFirst(comID, new int[] { 1, 2 });
                if (pubinv != null)
                {
                    pattern = pubinv.InvPattern;
                    serial  = pubinv.InvSerial;
                    _PubInvSrv.UnbindSession(pubinv);
                }
                else
                {
                    return("ERR:20");     //tham so pattern va serial khong hop le
                }
                break;

            case 1:
                PublishInvoice pubFirst = _PubInvSrv.GetbyPattern(comID, pattern, new int[] { 1, 2 }).FirstOrDefault();
                if (pubFirst == null)
                {
                    return("ERR:20");
                }
                else
                {
                    serial = !string.IsNullOrWhiteSpace(serial) ? serial : pubFirst.InvSerial;
                    _PubInvSrv.UnbindSession(pubFirst);
                }
                break;
            }
            IInvoiceService iinvSrc = InvServiceFactory.GetService(pattern, comID);

            try
            {
                IInvoice currentInv = InvServiceFactory.NewInstance(pattern, comID);
                if (invNo > 0)
                {
                    currentInv = iinvSrc.GetByNo(comID, pattern, serial, invNo);
                }
                else
                {
                    currentInv = iinvSrc.GetByFkey(comID, fkey);
                }
                if (null == currentInv)
                {
                    return("ERR:2");  //khong ton tai hoa don
                }
                Launcher t = Launcher.Instance;
                t.Cancel(new IInvoice[] { currentInv });
                ILogSystemService businessLog = IoC.Resolve <ILogSystemService>();
                businessLog.WriteLogCancel(comID, HttpContext.Current.User.Identity.Name, currentInv.Pattern, currentInv.Serial, currentInv.No.ToString("0000000"), currentInv.PublishDate, currentInv.Amount, currentInv.CusName, currentInv.CusAddress, currentInv.CusCode, currentInv.CusTaxCode, BusinessLogType.Cancel);
                businessLog.CommitChanges();
                return("OK:");
            }
            catch (Exception ex)
            {
                log.Error("cancelInv " + ex);
                return("ERR:6 " + ex.Message);
            }
        }
コード例 #13
0
        private string processReplace(string xmlData, string pattern, string fkey, string serial = null, decimal invNo = 0, int convert = 0)
        {
            if (FXContext.Current == null)
            {
                return("ERR:1");
            }
            try
            {
                XmlSchemaValidator validator = new XmlSchemaValidator();
                if (!validator.ValidXmlDoc(xmlData, "", AppDomain.CurrentDomain.BaseDirectory + @"xmlvalidate\replacevatinvoice.xsd"))
                {
                    //customer xml string not valid, don't do any thing
                    log.Info("processReplace " + validator.ValidationError);
                    return("ERR:3 err:" + validator.ValidationError);  //du lieu dau vao khong hop le
                }

                if (convert == 1)
                {
                    xmlData = DataHelper.convertTCVN3ToUnicode(xmlData);
                }
                Company _currentCompany = ((EInvoiceContext)FXContext.Current).CurrentCompany;
                int     comID           = _currentCompany.id;
                if (_currentCompany == null)
                {
                    return("ERR:7");                        //username khong phu hop - ko tim thay company phu hop voi [username]
                }
                ICustomerService _cusSvr = IoC.Resolve <ICustomerService>();

                string invNumList = "";

                int isPattern = string.IsNullOrEmpty(pattern) ? 0 : 1;
                IPublishInvoiceService _PubInvSrv = IoC.Resolve <IPublishInvoiceService>();
                switch ((isPattern))
                {
                case 0:
                    PublishInvoice pubinv = _PubInvSrv.GetFirst(comID, new int[] { 1, 2 });
                    if (pubinv != null)
                    {
                        pattern = pubinv.InvPattern;
                        serial  = pubinv.InvSerial;
                        _PubInvSrv.UnbindSession(pubinv);
                    }
                    else
                    {
                        return("ERR:20");     //tham so pattern va serial khong hop le
                    }
                    break;

                case 1:
                    PublishInvoice pubFirst = _PubInvSrv.GetbyPattern(comID, pattern, new int[] { 1, 2 }).FirstOrDefault();
                    if (pubFirst == null)
                    {
                        return("ERR:20");
                    }
                    else
                    {
                        serial = !string.IsNullOrWhiteSpace(serial) ? serial : pubFirst.InvSerial;
                        _PubInvSrv.UnbindSession(pubFirst);
                    }
                    break;
                }

                IInvoiceService iinvSrc    = InvServiceFactory.GetService(pattern, comID);
                IInvoice        currentInv = InvServiceFactory.NewInstance(pattern, comID);
                if (invNo > 0)
                {
                    currentInv = iinvSrc.GetByNo(comID, pattern, serial, invNo);
                }
                else
                {
                    currentInv = iinvSrc.GetByFkey(comID, fkey);
                }
                if (null == currentInv)
                {
                    log.Error("Không tồn tại hóa đơn.");
                    return("ERR:2");  //khong ton tai hoa don, hoa don da duoc thay the roi;
                }

                string invPattern = null, invSerial = null, errorMessage = "";
                if (!LaunchInvoices.Instance.ExistNoInPubInv(comID, currentInv.Pattern, currentInv.Serial, out invPattern, out invSerial, out errorMessage))
                {
                    log.Error("het so hoa don trong dai.");
                    return("ERR:6 " + fkey);   //het so hoa don trong dai
                }
                IInvoice inv = (InvoiceBase)InvServiceFactory.NewInstance(invPattern, comID);
                try
                {
                    XElement xeles = XElement.Parse(xmlData);
                    DataHelper.DeserializeEinvFromXML(xmlData, inv);
                    inv.No       = 0;
                    inv.Name     = currentInv.Name;
                    inv.Pattern  = invPattern;
                    inv.Serial   = invSerial;
                    inv.CreateBy = System.Web.HttpContext.Current.User.Identity.Name;
                    var Typecus = (from c in _cusSvr.Query where c.ComID == comID && c.Code == inv.CusCode && c.CusType == 1 select c.CusType).SingleOrDefault();
                    if (Typecus == 0)
                    {
                        inv.CusSignStatus = cusSignStatus.NocusSignStatus;
                    }
                    else
                    {
                        inv.CusSignStatus = cusSignStatus.NoSignStatus;
                    }
                    if (currentInv.Status == InvoiceStatus.SignedInv || currentInv.Status == InvoiceStatus.AdjustedInv)
                    {
                        IList <ProductInv> products = new List <ProductInv>();
                        foreach (IProductInv ii in inv.Products)
                        {
                            products.Add((ProductInv)ii);
                        }
                        Launcher.Instance.PublishReplace(currentInv, products, (InvoiceBase)inv, "");
                        invNumList += inv.Fkey ?? " ";
                    }
                    else
                    {
                        return("ERR:9 " + currentInv.Status);
                    }
                }
                catch (EInvoice.Core.Launching.NoFactory.OpenTranException ex)
                {
                    log.Error(ex);
                    return("ERR:14");
                }
                catch (Exception ex)
                {
                    log.Error("replaceInv err5: " + ex);
                    return("ERR:5 " + ex.Message);//loi phat hanh hoa don
                }
                ILogSystemService businessLog = IoC.Resolve <ILogSystemService>();
                businessLog.WriteLogReplaceAdjust(comID, currentInv.Pattern, currentInv.Serial, currentInv.No, currentInv.PublishDate, currentInv.Amount, inv.Pattern, inv.Serial, inv.No, inv.PublishDate, inv.Amount, inv.CusName, inv.CusAddress, inv.CusCode, inv.CusTaxCode, HttpContext.Current.User.Identity.Name, BusinessLogType.Replace);
                businessLog.CommitChanges();
                //invNumList = invNumList.Remove(invNumList.Length - 1, 1);
                return("OK_" + invNumList);
            }
            catch (Exception ex)
            {
                log.Error("replaceInv: " + ex);
                return("ERR:5 " + ex.Message);
            }
        }
コード例 #14
0
 public LogSystemController()
 {
     LogService      = IoC.Resolve <ILogSystemService>();
     nguoidung       = ((EISContext)FX.Context.FXContext.Current).CurrentNguoidung;
     gridViewHanders = new GridViewCustomBindingHandlers();
 }
コード例 #15
0
 public LogManagerController()
 {
     logFolder  = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, ConfigurationManager.AppSettings["FolderLog"]);
     logService = IoC.Resolve <ILogSystemService>();
 }