public int Add(string name, string prefix, string start_number,
                       string debit_account_id_str, string credit_account_id_str)
        {
            int add = -1;

            try
            {
                int debit_account_id  = int.Parse(debit_account_id_str),
                    credit_account_id = int.Parse(credit_account_id_str);
                JournalType type      = new JournalType()
                {
                    name              = name,
                    prefix            = prefix,
                    start_number      = start_number,
                    debit_account_id  = debit_account_id,
                    credit_account_id = credit_account_id,
                    deleted           = 0
                };
                conn.Insert(type);
                add = type.id;
            }
            catch (Exception e)
            {
                Debug.WriteLine(e.ToString());
                add = -1;
            }
            return(add);
        }
예제 #2
0
    public void CreateJournalEntry(string txt, JournalType type)
    {
        GameObject obj = (GameObject)Instantiate(journalEntryPrefab);

        obj.transform.SetParent(journalList.transform);

        string totalTxt = "";

        switch (type)
        {
        case JournalType.System:
            totalTxt = "<color=#FCA311>[System] </color>";
            break;

        case JournalType.Combat:
            totalTxt = "<color=#7D1128>[Combat] </color>";
            break;

        case JournalType.Item:
            totalTxt = "<color=#2E354C>[Item] </color>";
            break;

        case JournalType.LevelUp:
            totalTxt = "<color=#FEC601>[LVLUP] </color>";
            break;

        case JournalType.Status:
            totalTxt = "<color=#E2DDB1>[Status] </color>";
            break;
        }

        obj.GetComponentInChildren <Text>().text = totalTxt + txt;
        DeleteOldJournalEntries();
    }
예제 #3
0
        private DbInsertStatement GetQuery_InsertQuery(JournalType _obj)
        {
            Dictionary <string, DbFieldEntry> fields = GetFields(_obj);

            fields["JournalTypeID"] = DbMgr.CreateStringFieldEntry(_obj.JournalTypeID);
            return(DbMgr.CreateInsertClause("JournalTypes", fields));
        }
예제 #4
0
 public JournalEntryDocumentUnit(int?batchid, bool isreversingentry, DateTime?dateofreversal, bool isrecurringentry, DateTime?datetorecur, DateTime?finaldate,
                                 DateTime?lastpostdate, string batchinfo, bool?isbatchremoved, string description, TypeOfAccountingDocument typeofaccountingdocumentid, TypeofObject?typeofobjectid,
                                 long?recurdocid, long?reversedocid, DateTime?documentdate, DateTime transactiondate, DateTime?dateposted, long?originaldocumentid, decimal?controltotal, string documentreference,
                                 string voucherreference, short?typeofcurrencyid, int?currencyadjustmentid, string postbatchdescription, bool isposted, bool isautoposted, bool ischanged,
                                 int?postedbyuserid, int?bankreccontrolid, bool isselected, bool isactive, bool isapproved, TypeOfInactiveStatus?typeofinactivestatusid,
                                 bool?isbankrecomitted, bool?isictjournal, int?ictcompanyid, long?ictaccountingdocumentid, double?currencyoverriderate,
                                 decimal?functionalcurrencycontroltotal, short?typeofcurrencyrateid, string memoline, bool?is13period, decimal?homecurrencyamount, decimal?customforexrate,
                                 bool isposubmitforapproval, bool?iscpastran, int?cpasprojcloseid, int?cpasprojid, long organizationunitid, JournalType journaltypeid)
     : base(description: description, typeofaccountingdocumentid: typeofaccountingdocumentid, typeofobjectid: typeofobjectid, recurdocid: recurdocid, reversedocid: reversedocid, documentdate: documentdate,
            transactiondate: transactiondate, dateposted: dateposted, originaldocumentid: organizationunitid, controltotal: controltotal, documentreference: documentreference,
            voucherreference: voucherreference, typeofcurrencyid: typeofcurrencyid, currencyadjustmentid: currencyadjustmentid,
            postbatchdescription: postbatchdescription, isposted: isposted, isautoposted: isautoposted, ischanged: ischanged,
            postedbyuserid: postedbyuserid, bankreccontrolid: bankreccontrolid, isselected: isselected, isactive: isactive, isapproved: isapproved,
            typeofinactivestatusid: typeofinactivestatusid, isbankrecomitted: isbankrecomitted, isictjournal: isictjournal,
            ictcompanyid: ictcompanyid, ictaccountingdocumentid: ictaccountingdocumentid, currencyoverriderate: currencyoverriderate,
            functionalcurrencycontroltotal: functionalcurrencycontroltotal, typeofcurrencyrateid: typeofcurrencyid, memoline: memoline,
            is13period: is13period, homecurrencyamount: homecurrencyamount, customforexrate: customforexrate, isposubmitforapproval: isposubmitforapproval,
            iscpastran: iscpastran, cpasprojcloseid: cpasprojcloseid, cpasprojid: cpasprojid, organizationunitid: organizationunitid)
 {
     BatchId          = batchid;
     IsReversingEntry = isreversingentry;
     DateOfReversal   = dateofreversal;
     IsRecurringEntry = isrecurringentry;
     DateToRecur      = datetorecur;
     FinalDate        = finaldate;
     LastPostDate     = lastpostdate;
     BatchInfo        = batchinfo;
     IsBatchRemoved   = isbatchremoved;
     JournalTypeId    = journaltypeid;
 }
예제 #5
0
        private void CopyJournal(MenuJournal _element)
        {
            uiText = _element.uiText;
            pages  = new List <JournalPage>();
            foreach (JournalPage page in _element.pages)
            {
                pages.Add(new JournalPage(page));
            }

            numPages      = _element.numPages;
            startFromPage = _element.startFromPage;
            if (startFromPage)
            {
                showPage = _element.showPage;
            }
            else
            {
                showPage = 1;
            }
            anchor              = _element.anchor;
            textEffects         = _element.textEffects;
            fullText            = "";
            actionListOnAddPage = _element.actionListOnAddPage;
            journalType         = _element.journalType;
            pageOffset          = _element.pageOffset;
            otherJournalTitle   = _element.otherJournalTitle;;

            base.Copy(_element);
        }
        private string GetJournalNumber(int type)
        {
            int         next_number = 0;
            JournalType jType       = (from jt in conn.Table <JournalType>()
                                       where jt.id == type
                                       select jt
                                       ).First <JournalType>();
            string prefix       = jType.prefix;
            bool   NGTableEntry = (from generator in conn.Table <NumberGenerator>()
                                   where generator.prefix == prefix
                                   select generator
                                   ).Any <NumberGenerator>();

            if (NGTableEntry)
            {
                NumberGenerator Gen = (from generator in conn.Table <NumberGenerator>()
                                       where generator.prefix == prefix
                                       select generator
                                       ).First <NumberGenerator>();
                next_number = Gen.value + 1;
                Gen.value  += 1;
                conn.Update(Gen);
            }
            else
            {
                next_number = int.Parse(jType.start_number);
                conn.Insert(new NumberGenerator()
                {
                    prefix = prefix,
                    value  = next_number
                });
            }

            return(prefix + " - " + next_number);
        }
 /// <summary>
 /// Creates a new empty <see cref="IJournal"/> <see langword="object"/> that does not increment the ID counter (<strong><i>Note: The ID must be set(Changed) after creation, as the <see cref="object"/> is initialized with an ID of zero</i></strong>)
 /// </summary>
 /// <param name="_type">The type of <see cref="IJournal"/> to be created</param>
 /// <returns>A new instance of type <see cref="IJournal"/> where the ID is set to zero.</returns>
 public static IJournal CreateEmpty(JournalType _type)
 {
     return(_type switch
     {
         JournalType.PregnancyJournal => new PregnancyJournal(0),
         JournalType.TravelerJournal => new TravelerJournal(0),
         _ => null,
     });
예제 #8
0
        public bool SaveJournalType(JournalType model)
        {
            var user = GetUserFromToken();

            model = CreateFootPrintForEdit(model, user);
            _journalTypeRepository.Add(model);
            return(_journalTypeRepository.Commit());
        }
예제 #9
0
파일: ModelHelper.cs 프로젝트: sevenate/nfm
        /// <summary>
        /// Create deposit or withdrawal transaction: (<paramref name="price"/> * <paramref name="quantity"/>) amount of assets
        /// to/from the <paramref name="accountId"/> with optional <paramref name="comment"/> and
        /// group it under <paramref name="categoryId"/> if necessary.
        /// </summary>
        /// <param name="mc">Entity Framework model container.</param>
        /// <param name="operationDate">Operation date.</param>
        /// <param name="accountId">Account 1 ID</param>
        /// <param name="journalType"><see cref="JournalType.Deposit"/> or <see cref="JournalType.Withdrawal"/> only</param>
        /// <param name="categoryId">The category ID.</param>
        /// <param name="price">Price of the item.</param>
        /// <param name="quantity">Quantity of the item.</param>
        /// <param name="comment">Comment notes.</param>
        internal static void CreateTransaction(
            ModelContainer mc,
            DateTime operationDate,
            int accountId,
            JournalType journalType,
            int?categoryId,
            decimal price,
            decimal quantity,
            string comment)
        {
            var amount = price * quantity;

            var targetAccount = GetAccountById(mc, accountId);
            var cashAccount   = GetSystemAccount(mc, targetAccount.AssetType.Id);

            var transaction = new Transaction
            {
                JournalType = (byte)journalType,
                Price       = price,
                Quantity    = quantity,
                Comment     = comment
            };

            if (categoryId.HasValue)
            {
                transaction.Category = GetCategoryById(mc, categoryId.Value);
            }

            var creditAccount = journalType == JournalType.Deposit
                                                ? targetAccount
                                                : cashAccount;

            var debitAccount = journalType == JournalType.Deposit
                                                ? cashAccount
                                                : targetAccount;

            var creditPosting = new Posting
            {
                Account   = creditAccount,
                AssetType = creditAccount.AssetType,
                Date      = operationDate,
                Amount    = amount,
                Journal   = transaction
            };

            var debitPosting = new Posting
            {
                Account   = debitAccount,
                AssetType = debitAccount.AssetType,
                Date      = operationDate,
                Amount    = -amount,
                Journal   = transaction
            };

            mc.Journals.AddObject(transaction);
            mc.Postings.AddObject(creditPosting);
            mc.Postings.AddObject(debitPosting);
        }
        public JournalType Get(int id)
        {
            JournalType type = (from sub in conn.Table <JournalType>()
                                where sub.id == id
                                select sub
                                ).First <JournalType>();

            return(type);
        }
        public JournalType GetHavingPrefix(string prefix)
        {
            JournalType type = (from sub in conn.Table <JournalType>()
                                where sub.prefix == prefix
                                select sub
                                ).First <JournalType>();

            return(type);
        }
예제 #12
0
 //Used to add journals
 public Journal(string name, int id, string description, int order, bool found, JournalType type, AudioClip audioName)
 {
     journalName      = name;
     journalID        = id;
     journalDesc      = description;
     journalOrder     = order;
     journalFound     = found;
     journalType      = type;
     journalAudioName = audioName;
 }
예제 #13
0
 public IHttpActionResult SaveJournalType(JournalType model)
 {
     if (string.IsNullOrEmpty(model.Id))
     {
         return(Ok(_service.SaveJournalType(model)));
     }
     else
     {
         return(Ok(_service.UpdateJournalType(model)));
     }
 }
예제 #14
0
        public bool UpdateJournalType(JournalType model)
        {
            var updateEntity = _journalTypeRepository.GetById(model.Id);

            updateEntity.Name = model.Name;
            updateEntity.Note = model.Note;
            var user = this.GetUserFromToken();

            updateEntity.Modified   = DateTime.Now;
            updateEntity.ModifiedBy = user.Id;
            return(_repository.Commit());
        }
예제 #15
0
        /// <summary>
        /// Clears ignore list.
        /// </summary>
        /// <param name="type"></param>
        public void ClearIgnore(JournalType type)
        {
            switch (type)
            {
            case JournalType.Chat:
                Stealth.Client.ClearChatUserIgnore();
                break;

            case JournalType.Journal:
                Stealth.Client.ClearJournalIgnore();
                break;
            }
        }
예제 #16
0
        public JournalType GetJournalType(Journal journal)
        {
            JournalType journalType = new JournalType();

            journalType.Identification = new IdentificationType
            {
                Identification       = journal.ID.ToString(),
                IdentificationSchema = "UUID"
            };


            return(journalType);
        }
예제 #17
0
        /// <summary>
        /// Adds user to ignore list.
        /// </summary>
        /// <param name="user"></param>
        /// <param name="type"></param>
        public void Ignore(string user, JournalType type)
        {
            switch (type)
            {
            case JournalType.Chat:
                Stealth.Client.AddChatUserIgnore(user);
                break;

            case JournalType.Journal:
                Stealth.Client.AddJournalIgnore(user);
                break;
            }
        }
예제 #18
0
 public JournalType CreateFootPrintForEdit(JournalType entity, UserViewModel user)
 {
     entity.Id             = Guid.NewGuid().ToString();
     entity.Modified       = DateTime.Now;
     entity.ModifiedBy     = user.Id;
     entity.Created        = DateTime.Now;
     entity.CreatedBy      = user.Id;
     entity.CreatedCompany = user.CreatedCompany;
     entity.Active         = true;
     entity.DeletedBy      = null;
     entity.DeletionTime   = null;
     return(entity);
 }
예제 #19
0
        private int CreateJournal(int account_id, string journalDate, string openingBalance, string note)
        {
            Windows.Storage.ApplicationDataCompositeValue composite = settings.GetSettingsComposite();
            int income_id = int.Parse(composite["IncomeAccountId"].ToString());

            JournalType journalType = jtVM.GetHavingPrefix("IOJ");
            string      typeString = journalType.id.ToString(), partyString = "-1", referenceString = "-1";
            double      amount = double.Parse(openingBalance);
            Dictionary <int, double> accountInfo = new Dictionary <int, double>()
            {
                { account_id, amount },
                { income_id, amount *-1 }
            };

            return(journalVM.Add(journalDate, typeString, partyString, referenceString, note, accountInfo, amount, amount));
        }
예제 #20
0
        /// <summary>
        /// Delete passed journal type.
        /// </summary>
        /// <param name="type"></param>
        public void ClearJournal(JournalType type)
        {
            switch (type)
            {
            case JournalType.Debug:
                Debug.Flush();
                break;

            case JournalType.Journal:
                Stealth.Client.ClearJournal();
                break;

            case JournalType.System:
                Stealth.Client.ClearSystemJournal();
                break;
            }
        }
예제 #21
0
        /// <summary>
        /// Function sends message to specific message system.
        /// </summary>
        /// <param name="Msg"></param>
        /// <param name="type"></param>
        public void AddMessage(string Msg, JournalType type)
        {
            switch (type)
            {
            case JournalType.Debug:
                Debug.WriteLine(Msg);
                break;

            case JournalType.Journal:
                Stealth.Client.AddToJournal(Msg);
                break;

            case JournalType.System:
                Stealth.Client.AddToSystemJournal(Msg);
                break;
            }
        }
예제 #22
0
        protected override OpResult _Store(JournalType _obj)
        {
            if (_obj == null)
            {
                return(OpResult.NotifyStoreAction(OpResult.ResultStatus.ObjectIsNull, _obj, "JournalType object cannot be created as it is null"));
            }

            if (Exists(_obj))
            {
                ExecuteNonQuery(GetQuery_UpdateQuery(_obj));
                return(OpResult.NotifyStoreAction(OpResult.ResultStatus.Updated, _obj));
            }

            ExecuteNonQuery(GetQuery_InsertQuery(_obj));
            _obj.FromDb = true;

            return(OpResult.NotifyStoreAction(OpResult.ResultStatus.Created, _obj));
        }
예제 #23
0
        private void CopyJournal(MenuJournal _element, bool fromEditor, bool ignoreUnityUI)
        {
            if (ignoreUnityUI)
            {
                uiText = null;
            }
            else
            {
                uiText = _element.uiText;
            }

            pages = new List <JournalPage>();
            foreach (JournalPage page in _element.pages)
            {
                JournalPage newPage = new JournalPage(page);
                if (fromEditor)
                {
                    newPage.lineID = -1;
                }

                pages.Add(newPage);
            }

            numPages      = _element.numPages;
            startFromPage = _element.startFromPage;
            if (startFromPage)
            {
                showPage = _element.showPage;
            }
            else
            {
                showPage = 1;
            }
            anchor              = _element.anchor;
            textEffects         = _element.textEffects;
            outlineSize         = _element.outlineSize;
            fullText            = "";
            actionListOnAddPage = _element.actionListOnAddPage;
            journalType         = _element.journalType;
            pageOffset          = _element.pageOffset;
            otherJournalTitle   = _element.otherJournalTitle;;

            base.Copy(_element);
        }
예제 #24
0
		public static void AddJournal(JournalType journalType, string description = null)
		{
			var journalEvent = new Journal()
			{
				JournalType = journalType,
				Description = description
			};

			try
			{
				using (var context = DatabaseContext.Initialize())
				{
					context.Journal.Add(journalEvent);
					context.SaveChanges();
				}
			}

			catch (Exception e)
			{
				MessageBoxService.ShowException(e);
			}
		}
예제 #25
0
        /**
         * Initialises the element when it is created within MenuManager.
         */
        public override void Declare()
        {
            uiText = null;

            pages = new List <JournalPage>();
            pages.Add(new JournalPage());
            numPages    = 1;
            showPage    = 1;
            isVisible   = true;
            isClickable = false;
            numSlots    = 1;
            anchor      = TextAnchor.MiddleCenter;
            SetSize(new Vector2(10f, 5f));
            textEffects         = TextEffects.None;
            fullText            = "";
            actionListOnAddPage = null;
            journalType         = JournalType.NewJournal;
            pageOffset          = 0;
            otherJournalTitle   = "";

            base.Declare();
        }
예제 #26
0
        public override void ShowGUI(Menu menu)
        {
            string apiPrefix = "AC.PlayerMenus.GetElementWithName (\"" + menu.title + "\", \"" + title + "\")";

            MenuSource source = menu.menuSource;

            EditorGUILayout.BeginVertical("Button");

            journalType = (JournalType)CustomGUILayout.EnumPopup("Journal type:", journalType, apiPrefix + ".journalType");
            if (journalType == JournalType.DisplayExistingJournal)
            {
                EditorGUILayout.HelpBox("This Journal will share pages from another Journal element in the same Menu.", MessageType.Info);
                otherJournalTitle = CustomGUILayout.TextField("Existing element name:", otherJournalTitle, apiPrefix + ".otherJournalTitle");
                pageOffset        = CustomGUILayout.IntField("Page offset #:", pageOffset, apiPrefix + ".pageOffset");

                if (pages == null || pages.Count != 1)
                {
                    pages.Clear();
                    pages.Add(new JournalPage());
                }

                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.LabelField("Placeholder text:", GUILayout.Width(146f));
                pages[0].text = CustomGUILayout.TextArea(pages[0].text, GUILayout.MaxWidth(370f), apiPrefix + ".pages[0].text");
                showPage      = 1;
                EditorGUILayout.EndHorizontal();

                if (source == MenuSource.AdventureCreator)
                {
                    anchor      = (TextAnchor)CustomGUILayout.EnumPopup("Text alignment:", anchor, apiPrefix + ".anchor");
                    textEffects = (TextEffects)CustomGUILayout.EnumPopup("Text effect:", textEffects, apiPrefix + ".textEffects");
                    if (textEffects != TextEffects.None)
                    {
                        outlineSize = CustomGUILayout.Slider("Effect size:", outlineSize, 1f, 5f, apiPrefix + ".outlineSize");
                    }
                }
                else
                {
                    EditorGUILayout.EndVertical();
                    EditorGUILayout.BeginVertical("Button");
                    uiText = LinkedUiGUI <Text> (uiText, "Linked Text:", source);
                }
            }
            else
            {
                if (pages == null || pages.Count == 0)
                {
                    pages.Clear();
                    pages.Add(new JournalPage());
                }
                numPages = pages.Count;

                for (int i = 0; i < pages.Count; i++)
                {
                    EditorGUILayout.BeginHorizontal();

                    if (pages[i].lineID >= 0)
                    {
                        EditorGUILayout.LabelField("Page #" + (i + 1).ToString() + ", Text ID #" + pages[i].lineID + ":");
                    }
                    else
                    {
                        EditorGUILayout.LabelField("Page #" + (i + 1).ToString() + ":");
                    }

                    if (GUILayout.Button(Resource.CogIcon, GUILayout.Width(20f), GUILayout.Height(15f)))
                    {
                        sideMenu = i;
                        SideMenu();
                    }
                    EditorGUILayout.EndHorizontal();

                    pages[i].text = CustomGUILayout.TextArea(pages[i].text, GUILayout.MaxWidth(370f), apiPrefix + ".pages[" + i.ToString() + "].text");
                    GUILayout.Box("", GUILayout.ExpandWidth(true), GUILayout.Height(1));
                }

                if (GUILayout.Button("Create new page", EditorStyles.miniButton))
                {
                    Undo.RecordObject(this, "Create journal page");
                    pages.Add(new JournalPage());
                }

                numPages = pages.Count;

                EditorGUILayout.EndVertical();
                EditorGUILayout.BeginVertical("Button");

                if (numPages > 1)
                {
                    showPage      = CustomGUILayout.IntSlider("Preview page #:", showPage, 1, numPages, apiPrefix + ".showPage");
                    startFromPage = CustomGUILayout.Toggle("Start from this page?", startFromPage, apiPrefix + ".startFromPage");
                }
                else
                {
                    showPage = 1;
                }

                if (source == MenuSource.AdventureCreator)
                {
                    anchor      = (TextAnchor)CustomGUILayout.EnumPopup("Text alignment:", anchor, apiPrefix + ".anchor");
                    textEffects = (TextEffects)CustomGUILayout.EnumPopup("Text effect:", textEffects, apiPrefix + ".textEffects");
                }
                else
                {
                    EditorGUILayout.EndVertical();
                    EditorGUILayout.BeginVertical("Button");
                    uiText = LinkedUiGUI <Text> (uiText, "Linked Text:", source);
                }

                actionListOnAddPage = (ActionListAsset)CustomGUILayout.ObjectField <ActionListAsset> ("ActionList on add page:", actionListOnAddPage, false, apiPrefix + ".actionListOnAddPage");
            }
            EditorGUILayout.EndVertical();

            base.ShowGUI(menu);
        }
예제 #27
0
        private void CopyJournal(MenuJournal _element)
        {
            uiText = _element.uiText;
            pages = new List<JournalPage>();
            foreach (JournalPage page in _element.pages)
            {
                pages.Add (new JournalPage (page));
            }

            numPages = _element.numPages;
            startFromPage = _element.startFromPage;
            if (startFromPage)
            {
                showPage = _element.showPage;
            }
            else
            {
                showPage = 1;
            }
            anchor = _element.anchor;
            textEffects = _element.textEffects;
            fullText = "";
            actionListOnAddPage = _element.actionListOnAddPage;
            journalType = _element.journalType;
            pageOffset = _element.pageOffset;
            otherJournalTitle = _element.otherJournalTitle;;

            base.Copy (_element);
        }
예제 #28
0
        public static int Count(int BookingId = 0, int UserId = 0, DateTime?StartDate = null, DateTime?EndDate = null, JournalType Type = JournalType.None)
        {
            using (var ctx = new AgrishareEntities())
            {
                var query = ctx.Journals.Where(o => !o.Deleted);

                if (BookingId > 0)
                {
                    query = query.Where(o => o.BookingId == BookingId);
                }

                if (UserId > 0)
                {
                    query = query.Where(o => o.UserId == UserId);
                }

                if (StartDate.HasValue)
                {
                    var startDate = StartDate.Value.StartOfDay();
                    query = query.Where(o => o.DateCreated >= startDate);
                }

                if (EndDate.HasValue)
                {
                    var endDate = EndDate.Value.StartOfDay();
                    query = query.Where(o => o.DateCreated <= endDate);
                }

                if (Type != JournalType.None)
                {
                    query = query.Where(e => e.TypeId == Type);
                }

                return(query.Count());
            }
        }
예제 #29
0
		public static void AddJournalForUser(JournalType journalType, ModelBase modelBase = null, string Description = null)
		{
			var journalEvent = new Journal();
			if (modelBase != null)
			{
				if (modelBase is User)
					journalEvent.ClassType = ClassType.IsUser;
				if (modelBase is Consumer)
					journalEvent.ClassType = ClassType.IsConsumer;
				if (modelBase is Tariff)
					journalEvent.ClassType = ClassType.IsTariff;
				if (modelBase is Device)
					journalEvent.ClassType = ClassType.IsDevice;

				journalEvent.ObjectUID = modelBase.UID;
				journalEvent.ObjectName = modelBase.Name;
			}
			else
			{
				journalEvent.ClassType = ClassType.IsSystem;
			}
			journalEvent.UserName = CurrentUser.Name;
			journalEvent.UserUID = CurrentUser.UID;
			journalEvent.JournalType = journalType;
			journalEvent.Description = Description;

			try
			{
				using (var context = DatabaseContext.Initialize())
				{
					context.Journal.Add(journalEvent);
					context.SaveChanges();
				}
			}

			catch (Exception e)
			{
				MessageBoxService.ShowException(e);
			}
		}
예제 #30
0
		public FilterEventViewModel(JournalType journalType)
		{
			JournalType = journalType;
		}
예제 #31
0
        public string GetExistJournalDetails(string JeNumber, int LineRef, out JournalType.JournalDetailsDataType _ExistData)
            {
            _ExistData = new JournalType.JournalDetailsDataType();
            MySqlCommand oSqlCommand = new MySqlCommand();
            string sqlQuery = "Select "
          + "JeNumber,"
          + "LineRef,"
          + "AccountID,"
          + "Description,"
          + "CurRate,"
          + "Cr,"
          + "Dr,"
          + "AcTrRef,Vat"
          + " from tbljournaldetails"
          + " Where 1=1 "
                + " and JeNumber=@JeNumber"
                + " and LineRef=@LineRef";
            oSqlCommand.Parameters.AddWithValue("@JeNumber", JeNumber);
            oSqlCommand.Parameters.AddWithValue("@LineRef", LineRef);
            DataRow r = Mycommon.GetDataRowAccount(sqlQuery, oSqlCommand,"Get Exist data JournalDetails");
            if (r != null)
                {
                try
                    {
                    bool resp = false;
                    _ExistData.JeNumber = r["JeNumber"].ToString();
                    int inLineRef = 0;
                    resp = int.TryParse(r["LineRef"].ToString(), out inLineRef);
                    _ExistData.LineRef = inLineRef;
                    _ExistData.AccountID = r["AccountID"].ToString();
                    _ExistData.Description = r["Description"].ToString();
                    decimal deCurRate = 0;
                    resp = decimal.TryParse(r["CurRate"].ToString(), out deCurRate);
                    _ExistData.CurRate = deCurRate;
                    decimal deCr = 0;
                    resp = decimal.TryParse(r["Cr"].ToString(), out deCr);
                    _ExistData.Cr = deCr;
                    decimal deDr = 0;
                    resp = decimal.TryParse(r["Dr"].ToString(), out deDr);
                    _ExistData.Dr = deDr;

                    decimal deVat = 0;
                    resp = decimal.TryParse(r["Vat"].ToString(), out deVat);
                    _ExistData.Vat = deVat;
                    _ExistData.AcTrRef = r["AcTrRef"].ToString();
                   
                    return "True";
                    }
                catch (Exception ex)
                    {
                    return ex.Message;
                    }
                }
            else
                return "data not found ";
            }
예제 #32
0
 public string UpdateJournalDetails(JournalType.JournalDetailsDataType _Update, MySqlConnection _ActCon)
     {
     MySqlCommand oSqlCommand = new MySqlCommand();
     string sqlQuery = "Update tbljournaldetails Set "
         + "JeNumber=@JeNumber,"
         + "LineRef=@LineRef,"
         + "AccountID=@AccountID,"
         + "Description=@Description,"
         + "CurRate=@CurRate,"
         + "Cr=@Cr,"
         + "Dr=@Dr,"
         + "AcTrRef=@AcTrRef,Vat=@Vat"
         + " Where 1=1 "
         + " and JeNumber=@JeNumber"
         + " and LineRef=@LineRef";
     try
         {
         oSqlCommand.Parameters.AddWithValue("@JeNumber", _Update.JeNumber);
         oSqlCommand.Parameters.AddWithValue("@LineRef", _Update.LineRef);
         oSqlCommand.Parameters.AddWithValue("@AccountID", _Update.AccountID);
         oSqlCommand.Parameters.AddWithValue("@Description", _Update.Description);
         oSqlCommand.Parameters.AddWithValue("@CurRate", _Update.CurRate);
         oSqlCommand.Parameters.AddWithValue("@Cr", _Update.Cr);
         oSqlCommand.Parameters.AddWithValue("@Dr", _Update.Dr);
         oSqlCommand.Parameters.AddWithValue("@AcTrRef", _Update.AcTrRef);
         oSqlCommand.Parameters.AddWithValue("@Vat", _Update.Vat);
         string respond = Mycommon.ExicuteAnyCommandAccountWithTrans(sqlQuery, oSqlCommand, _ActCon, "Update JournalDetails");
         return respond;
         }
     catch (Exception ex)
         {
         return ex.Message;
         }
     }
예제 #33
0
        //==============

        public string SaveJournalDetails(JournalType.JournalDetailsDataType _SaveData,MySqlConnection _ActCon)
            {
            MySqlCommand oSqlCommand = new MySqlCommand();
            string sqlQuery = "Insert Into tbljournaldetails ("
              + "JeNumber,"
              + "LineRef,"
              + "AccountID,"
              + "Description,"
              + "CurRate,"
              + "Cr,"
              + "Dr,"
              + "AcTrRef,Vat)"
               + " Values ("
               + "@JeNumber,"
               + "@LineRef,"
               + "@AccountID,"
               + "@Description,"
               + "@CurRate,"
               + "@Cr,"
               + "@Dr,"
               + "@AcTrRef,@Vat)";
            try
                {
                oSqlCommand.Parameters.AddWithValue("@JeNumber", _SaveData.JeNumber);
                oSqlCommand.Parameters.AddWithValue("@LineRef", _SaveData.LineRef);
                oSqlCommand.Parameters.AddWithValue("@AccountID", _SaveData.AccountID);
                oSqlCommand.Parameters.AddWithValue("@Description", _SaveData.Description);
                oSqlCommand.Parameters.AddWithValue("@CurRate", _SaveData.CurRate);
                oSqlCommand.Parameters.AddWithValue("@Cr", _SaveData.Cr);
                oSqlCommand.Parameters.AddWithValue("@Dr", _SaveData.Dr);
                oSqlCommand.Parameters.AddWithValue("@AcTrRef", _SaveData.AcTrRef);
                oSqlCommand.Parameters.AddWithValue("@Vat", _SaveData.Vat);
                string respond = Mycommon.ExicuteAnyCommandAccountWithTrans(sqlQuery, oSqlCommand, _ActCon, "Save JournalDetails");
                return respond;
                }
            catch (Exception ex)
                {
                return ex.Message;
                }
            }
예제 #34
0
        public string GetExistJournalData(string JounalID, out JournalType.JournalDataDataType _ExistData)
            {
            _ExistData = new JournalType.JournalDataDataType();
            MySqlCommand oSqlCommand = new MySqlCommand();
            string sqlQuery = "Select "
          + "SysID,"
          + "JounalID,"
          + "TimePeriod,"
          + "CompanyID,"
          + "Reason,"
          + "JeStatus,"
          + "Jedate,"
          + "JeUser,"
          + "LastAccDate,"
          + "JeTime,"
          + "ApproveBy,"
          + "ApproveDate,"
          + "ApproveTime,"
          + "AcountedBy,"
          + "AccountDate,"
          + "AccountedTime"
          + " from tbljournalheader"
          + " Where 1=1 "
                + " and JounalID=@JounalID";
            oSqlCommand.Parameters.AddWithValue("@JounalID", JounalID);
            DataRow r = Mycommon.GetDataRowAccount(sqlQuery, oSqlCommand, "Get Exist data JournalData");
            if (r != null)
                {
                try
                    {
                    bool resp = false;
                    int inSysID = 0;
                    resp = int.TryParse(r["SysID"].ToString(), out inSysID);
                    _ExistData.SysID = inSysID;
                    _ExistData.JounalID = r["JounalID"].ToString();
                    int inTimePeriod = 0;
                    resp = int.TryParse(r["TimePeriod"].ToString(), out inTimePeriod);
                    _ExistData.TimePeriod = inTimePeriod;
                    int inCompanyID = 0;
                    resp = int.TryParse(r["CompanyID"].ToString(), out inCompanyID);
                    _ExistData.CompanyID = inCompanyID;
                    _ExistData.Reason = r["Reason"].ToString();
                    int inJeStatus = 0;
                    resp = int.TryParse(r["JeStatus"].ToString(), out inJeStatus);
                    _ExistData.JeStatus = inJeStatus;
                    DateTime dtJedate = new DateTime(1900, 1, 1);
                    resp = DateTime.TryParse(r["Jedate"].ToString(), out dtJedate);
                    if (resp)
                        _ExistData.Jedate = dtJedate;
                    else
                        _ExistData.Jedate = new DateTime(1900, 1, 1);
                    _ExistData.JeUser = r["JeUser"].ToString();
                    DateTime dtLastAccDate = new DateTime(1900, 1, 1);
                    resp = DateTime.TryParse(r["LastAccDate"].ToString(), out dtLastAccDate);
                    if (resp)
                        _ExistData.LastAccDate = dtLastAccDate;
                    else
                        _ExistData.LastAccDate = new DateTime(1900, 1, 1);
                    _ExistData.JeTime = r["JeTime"].ToString();
                    _ExistData.ApproveBy = r["ApproveBy"].ToString();
                    DateTime dtApproveDate = new DateTime(1900, 1, 1);
                    resp = DateTime.TryParse(r["ApproveDate"].ToString(), out dtApproveDate);
                    if (resp)
                        _ExistData.ApproveDate = dtApproveDate;
                    else
                        _ExistData.ApproveDate = new DateTime(1900, 1, 1);
                    _ExistData.ApproveTime = r["ApproveTime"].ToString();
                    _ExistData.AcountedBy = r["AcountedBy"].ToString();
                    DateTime dtAccountDate = new DateTime(1900, 1, 1);
                    resp = DateTime.TryParse(r["AccountDate"].ToString(), out dtAccountDate);
                    if (resp)
                        _ExistData.AccountDate = dtAccountDate;
                    else
                        _ExistData.AccountDate = new DateTime(1900, 1, 1);
                    _ExistData.AccountedTime = r["AccountedTime"].ToString();

                    List<JournalType.JournalDetailsDataType> _DataList = new List<JournalType.JournalDetailsDataType>();
                    string respond = GetJournalDetailsList(JounalID, out _DataList);
                    _ExistData.DetailList = _DataList;
                    return "True";
                    }
                catch (Exception ex)
                    {
                    return ex.Message;
                    }
                }
            else
                return "data not found ";
            }
예제 #35
0
 public string UpdateJournalData(JournalType.JournalDataDataType _Update,MySqlConnection _ActCon)
     {
     MySqlCommand oSqlCommand = new MySqlCommand();
     string sqlQuery = "Update tbljournalheader Set "
       
         + "JounalID=@JounalID,"
         + "TimePeriod=@TimePeriod,"
         + "CompanyID=@CompanyID,"
         + "Reason=@Reason,"
         + "JeStatus=@JeStatus,"
         + "Jedate=@Jedate,"
         + "JeUser=@JeUser,"
         + "LastAccDate=curDate(),"
         + "JeTime=curTime()"
         + " Where 1=1 "
         + " and JounalID=@JounalID";
     try
         {
       
         oSqlCommand.Parameters.AddWithValue("@JounalID", _Update.JounalID);
         oSqlCommand.Parameters.AddWithValue("@TimePeriod", _Update.TimePeriod);
         oSqlCommand.Parameters.AddWithValue("@CompanyID", _Update.CompanyID);
         oSqlCommand.Parameters.AddWithValue("@Reason", _Update.Reason);
         oSqlCommand.Parameters.AddWithValue("@JeStatus", _Update.JeStatus);
         oSqlCommand.Parameters.AddWithValue("@Jedate", _Update.Jedate);
         oSqlCommand.Parameters.AddWithValue("@JeUser", _Update.JeUser);
         
         
         string respond = Mycommon.ExicuteAnyCommandAccountWithTrans(sqlQuery, oSqlCommand, _ActCon, "Update JournalData");
         return respond;
         }
     catch (Exception ex)
         {
         return ex.Message;
         }
     }
예제 #36
0
 public string SaveJournalData(JournalType.JournalDataDataType _SaveData, MySqlConnection _ActCon,out string JeNumber)
     {
     MySqlCommand oSqlCommand = new MySqlCommand();
     JeNumber = GetNewJEnumber(_ActCon);
     string sqlQuery = "Insert Into tbljournalheader ("
   + "JounalID,"
   + "TimePeriod,"
   + "CompanyID,"
   + "Reason,"
   + "JeStatus,"
   + "Jedate,"
   + "JeUser,"
   + "LastAccDate,"
   + "JeTime)"
    + " Values ("
     + "@JounalID,"
    + "@TimePeriod,"
    + "@CompanyID,"
    + "@Reason,"
    + "@JeStatus,"
    + "@Jedate,"
    + "@JeUser,"
    + "curDate(),"
    + "curTime())";
     try
         {
       
         oSqlCommand.Parameters.AddWithValue("@JounalID", JeNumber);
         oSqlCommand.Parameters.AddWithValue("@TimePeriod", _SaveData.TimePeriod);
         oSqlCommand.Parameters.AddWithValue("@CompanyID", _SaveData.CompanyID);
         oSqlCommand.Parameters.AddWithValue("@Reason", _SaveData.Reason);
         oSqlCommand.Parameters.AddWithValue("@JeStatus", _SaveData.JeStatus);
         oSqlCommand.Parameters.AddWithValue("@Jedate", _SaveData.Jedate);
         oSqlCommand.Parameters.AddWithValue("@JeUser", _SaveData.JeUser);
    
        
         string respond = Mycommon.ExicuteAnyCommandAccountWithTrans(sqlQuery, oSqlCommand,_ActCon, "Save JournalData");
         return respond;
         }
     catch (Exception ex)
         {
         return ex.Message;
         }
     }
예제 #37
0
        public override void ShowGUI(Menu menu)
        {
            string apiPrefix = "(AC.PlayerMenus.GetElementWithName (\"" + menu.title + "\", \"" + title + "\") as AC.MenuJournal)";

            MenuSource source = menu.menuSource;

            EditorGUILayout.BeginVertical("Button");

            journalType = (JournalType)CustomGUILayout.EnumPopup("Journal type:", journalType, apiPrefix + ".journalType", "What type of journal this is");
            if (journalType == JournalType.DisplayExistingJournal || journalType == JournalType.DisplayActiveDocument)
            {
                if (journalType == JournalType.DisplayExistingJournal)
                {
                    EditorGUILayout.HelpBox("This Journal will share pages from another Journal element in the same Menu.", MessageType.Info);
                    otherJournalTitle = CustomGUILayout.TextField("Existing element name:", otherJournalTitle, apiPrefix + ".otherJournalTitle", "The name of the Journal element within the same Menu that is used as reference");
                    pageOffset        = CustomGUILayout.IntField("Page offset #:", pageOffset, apiPrefix + ".pageOffset", "The difference in page index between this and the reference Journal");
                }

                if (pages == null || pages.Count != 1)
                {
                    pages.Clear();
                    pages.Add(new JournalPage());
                }

                showPage = 1;

                if (source == MenuSource.AdventureCreator)
                {
                    EditorGUILayout.BeginHorizontal();
                    EditorGUILayout.LabelField("Placeholder text:", GUILayout.Width(146f));
                    pages[0].text = CustomGUILayout.TextArea(pages[0].text, GUILayout.MaxWidth(370f), apiPrefix + ".pages[0].text");
                    EditorGUILayout.EndHorizontal();
                }
            }
            else if (journalType == JournalType.NewJournal)
            {
                if (pages == null)
                {
                    pages = new List <JournalPage>();
                    pages.Clear();
                    pages.Add(new JournalPage());
                }
                numPages = pages.Count;

                for (int i = 0; i < pages.Count; i++)
                {
                    EditorGUILayout.BeginHorizontal();

                    if (pages[i].lineID >= 0)
                    {
                        CustomGUILayout.LabelField("Page #" + (i + 1).ToString() + ", Text ID #" + pages[i].lineID + ":", apiPrefix + ".pages[" + i.ToString() + "].text");
                    }
                    else
                    {
                        CustomGUILayout.LabelField("Page #" + (i + 1).ToString() + ":", apiPrefix + ".pages[" + i.ToString() + "].text");
                    }

                    if (GUILayout.Button("", CustomStyles.IconCog))
                    {
                        sideMenu = i;
                        SideMenu();
                    }
                    EditorGUILayout.EndHorizontal();

                    pages[i].text = CustomGUILayout.TextArea(pages[i].text, GUILayout.MaxWidth(370f), apiPrefix + ".pages[" + i.ToString() + "].text");
                    GUILayout.Box("", GUILayout.ExpandWidth(true), GUILayout.Height(1));
                }

                if (GUILayout.Button("Create new page", EditorStyles.miniButton))
                {
                    Undo.RecordObject(this, "Create journal page");
                    pages.Add(new JournalPage());
                }

                numPages = pages.Count;

                EditorGUILayout.EndVertical();
                EditorGUILayout.BeginVertical("Button");

                if (numPages > 1)
                {
                    showPage      = CustomGUILayout.IntSlider("Preview page #:", showPage, 1, numPages, apiPrefix + ".showPage", "The index number of the current page being shown ");
                    startFromPage = CustomGUILayout.Toggle("Start from this page?", startFromPage, apiPrefix + ".startFromPage", "If True, then the page index above will be the first open when the game begins");
                }
                else if (numPages == 1)
                {
                    showPage = 1;
                }
                else
                {
                    showPage = 0;
                }
            }

            if (source == MenuSource.AdventureCreator)
            {
                anchor      = (TextAnchor)CustomGUILayout.EnumPopup("Text alignment:", anchor, apiPrefix + ".anchor", "The text alignment");
                textEffects = (TextEffects)CustomGUILayout.EnumPopup("Text effect:", textEffects, apiPrefix + ".textEffects", "The special FX applied to the text");
                if (textEffects != TextEffects.None)
                {
                    outlineSize = CustomGUILayout.Slider("Effect size:", outlineSize, 1f, 5f, apiPrefix + ".outlineSize", "The outline thickness");
                }
            }
            else
            {
                EditorGUILayout.EndVertical();
                EditorGUILayout.BeginVertical("Button");

                                #if TextMeshProIsPresent
                uiText = LinkedUiGUI <TMPro.TextMeshProUGUI> (uiText, "Linked Text:", source);
                                #else
                uiText = LinkedUiGUI <Text> (uiText, "Linked Text:", source);
                                #endif
            }

            if (journalType == JournalType.NewJournal)
            {
                actionListOnAddPage = (ActionListAsset)CustomGUILayout.ObjectField <ActionListAsset> ("ActionList on add page:", actionListOnAddPage, false, apiPrefix + ".actionListOnAddPage", "An ActionList to run whenever a new page is added");
            }

            EditorGUILayout.EndVertical();

            base.ShowGUI(menu);
        }
예제 #38
0
        /**
         * Initialises the element when it is created within MenuManager.
         */
        public override void Declare()
        {
            uiText = null;

            pages = new List<JournalPage>();
            pages.Add (new JournalPage ());
            numPages = 1;
            showPage = 1;
            isVisible = true;
            isClickable = false;
            numSlots = 1;
            anchor = TextAnchor.MiddleCenter;
            SetSize (new Vector2 (10f, 5f));
            textEffects = TextEffects.None;
            fullText = "";
            actionListOnAddPage = null;
            journalType = JournalType.NewJournal;
            pageOffset = 0;
            otherJournalTitle = "";

            base.Declare ();
        }
예제 #39
0
        public override void ShowGUI(MenuSource source)
        {
            EditorGUILayout.BeginVertical ("Button");

            journalType = (JournalType) EditorGUILayout.EnumPopup ("Journal type:", journalType);
            if (journalType == JournalType.DisplayExistingJournal)
            {
                EditorGUILayout.HelpBox ("This Journal will share pages from another Journal element in the same Menu.", MessageType.Info);
                otherJournalTitle = EditorGUILayout.TextField ("Existing element name:", otherJournalTitle);
                pageOffset = EditorGUILayout.IntField ("Page offset #:", pageOffset);

                if (pages == null || pages.Count != 1)
                {
                    pages.Clear ();
                    pages.Add (new JournalPage ());
                }

                EditorGUILayout.BeginHorizontal ();
                EditorGUILayout.LabelField ("Placeholder text:", GUILayout.Width (146f));
                pages[0].text = EditorGUILayout.TextArea (pages[0].text);
                showPage = 1;
                EditorGUILayout.EndHorizontal ();

                if (source == MenuSource.AdventureCreator)
                {
                    anchor = (TextAnchor) EditorGUILayout.EnumPopup ("Text alignment:", anchor);
                    textEffects = (TextEffects) EditorGUILayout.EnumPopup ("Text effect:", textEffects);
                }
                else
                {
                    EditorGUILayout.EndVertical ();
                    EditorGUILayout.BeginVertical ("Button");
                    uiText = LinkedUiGUI <Text> (uiText, "Linked Text:", source);
                }
            }
            else
            {
                if (pages == null || pages.Count == 0)
                {
                    pages.Clear ();
                    pages.Add (new JournalPage ());
                }
                numPages = pages.Count;

                for (int i=0; i<pages.Count; i++)
                {
                    EditorGUILayout.BeginHorizontal ();
                    EditorGUILayout.LabelField ("Page #" + (i+1).ToString () + ":");
                    if (GUILayout.Button ("-", GUILayout.Width (20f)))
                    {
                        Undo.RecordObject (this, "Delete journal page");
                        pages.RemoveAt (i);
                        break;
                    }
                    EditorGUILayout.EndHorizontal ();

                    pages[i].text = EditorGUILayout.TextArea (pages[i].text);
                    GUILayout.Box ("", GUILayout.ExpandWidth (true), GUILayout.Height(1));
                }

                if (GUILayout.Button ("Create new page", EditorStyles.miniButton))
                {
                    Undo.RecordObject (this, "Create journal page");
                    pages.Add (new JournalPage ());
                }

                numPages = pages.Count;

                EditorGUILayout.EndVertical ();
                EditorGUILayout.BeginVertical ("Button");

                if (numPages > 1)
                {
                    showPage = EditorGUILayout.IntSlider ("Preview page #:", showPage, 1, numPages);
                    startFromPage = EditorGUILayout.Toggle ("Start from this page?", startFromPage);
                }
                else
                {
                    showPage = 1;
                }

                if (source == MenuSource.AdventureCreator)
                {
                    anchor = (TextAnchor) EditorGUILayout.EnumPopup ("Text alignment:", anchor);
                    textEffects = (TextEffects) EditorGUILayout.EnumPopup ("Text effect:", textEffects);
                }
                else
                {
                    EditorGUILayout.EndVertical ();
                    EditorGUILayout.BeginVertical ("Button");
                    uiText = LinkedUiGUI <Text> (uiText, "Linked Text:", source);
                }

                actionListOnAddPage = (ActionListAsset) EditorGUILayout.ObjectField ("ActionList on add page:", actionListOnAddPage, typeof (ActionListAsset), false);
            }
            EditorGUILayout.EndVertical ();

            base.ShowGUI (source);
        }
예제 #40
0
        public string DoJournal(JournalType.JournalDataDataType _DoTransData,string UserID)
            {
                try
                    {

                        MySql.Data.MySqlClient.MySqlTransaction Mytrans;
                        MySqlConnection CurCon = new MySqlConnection();
                        CurCon = Mycommon.AccountConnection;
                        string respond = "";
                        decimal FullPaymentDecbit = 0, FullPaymentCredit=0;
                        if (CurCon.State == ConnectionState.Open)
                            {
                            CurCon.Close();
                            CurCon.Open();
                            }
                        else
                            {
                            CurCon.Open();
                            }
                        Mytrans = Mycommon.AccountConnection.BeginTransaction();
                        MySqlCommand oSqlCommand = new MySqlCommand();
                        string Mackadd = MyGeneral.GetMACAddress();
                        respond = JEAccounted(_DoTransData.JounalID, UserID, CurCon);
                        if (respond != "True")
                        {
                            Mytrans.Rollback();
                            CurCon.Close();
                            return respond;
                        }
                        else
                        {
                            foreach (JournalType.JournalDetailsDataType _OneItem in _DoTransData.DetailList)
                            {
                                AccountTransactionType.AccountTransactionDataType _OneTrans = new AccountTransactionType.AccountTransactionDataType();
                                string TransRefDr = "";

                                string AccRef = GetAccReference(_OneItem.AccountID, CurCon);

                                _OneTrans.AccountID = _OneItem.AccountID;
                                _OneTrans.AccountYear = _DoTransData.TimePeriod;
                                _OneTrans.ActualDate = _DoTransData.Jedate;
                                _OneTrans.CompanyID = _DoTransData.CompanyID;
                                _OneTrans.Cr = _OneItem.Cr;
                                _OneTrans.CurRate = _OneItem.CurRate;
                                _OneTrans.Description = _OneItem.Description;
                                _OneTrans.Dr = _OneItem.Dr;
                                _OneTrans.FCr = _OneItem.Cr / _OneItem.CurRate;
                                _OneTrans.FDr = _OneItem.Dr / _OneItem.CurRate;
                                _OneTrans.MainRef = AccRef;
                                _OneTrans.PayMethod = -1;
                                _OneTrans.RelRef = _DoTransData.JounalID;
                                _OneTrans.TransType = 3;
                                _OneTrans.TrMachine = Mackadd;
                                _OneTrans.TrUser = _DoTransData.JeUser;
                                _OneTrans.VoucherID = _DoTransData.JounalID;

                                FullPaymentDecbit = FullPaymentDecbit + _OneItem.Dr;
                                FullPaymentCredit = FullPaymentCredit + _OneItem.Cr;

                                respond = SaveAccountTransaction(_OneTrans, CurCon, out TransRefDr);
                                if (respond != "True")
                                {
                                    Mytrans.Rollback();
                                    CurCon.Close();
                                    return respond;
                                }
                                else
                                {
                                    respond = UpdateTranseRefinReleventTable(3, true, TransRefDr, _OneItem.JeNumber, _OneItem.LineRef.ToString(), CurCon);
                                    if (respond != "True")
                                    {
                                        Mytrans.Rollback();
                                        CurCon.Close();
                                        return respond;
                                    }
                                    else
                                    {
                                        respond = UpdateLastRefonAccount(_OneTrans.AccountID, AccRef, CurCon);
                                        if (respond != "True")
                                        {
                                            Mytrans.Rollback();
                                            CurCon.Close();
                                            return respond;
                                        }
                                    }
                                }

                            }
                            //====
                            if ((FullPaymentDecbit - FullPaymentCredit) != 0)
                            {
                                Mytrans.Rollback();
                                CurCon.Close();
                                return respond;
                            }
                            else
                            {
                                if (respond != "True")
                                {
                                    Mytrans.Rollback();
                                    CurCon.Close();
                                    return respond;
                                }
                                else
                                {
                                    Mytrans.Commit();
                                    CurCon.Close();
                                    return "True";
                                }
                            }
                        }
                    }
                    catch (Exception ex)
                    {

                    return ex.Message;
                    }
            }
예제 #41
0
        /// <summary>
        ///  Function tries to check if a certain journal message appeared within ppassed journal system and returns line ID as output.
        /// </summary>
        /// <param name="StartTime"></param>
        /// <param name="content"></param>
        /// <param name="maxdelayinms"></param>
        /// <param name="type"></param>
        /// <param name="result"></param>
        /// <returns></returns>
        public bool WaitForJournalLine(DateTime StartTime, string content, int maxdelayinms, JournalType type,
                                       out int result)
        {
            var state = WaitForJournalLine(StartTime, content, maxdelayinms, type);

            result = state ? Stealth.Client.GetFoundedParamID() : -1;
            return(state);
        }
예제 #42
0
        /// <summary>
        /// Function tries to check if a certain journal message appeared within ppassed journal system and returns line as output.
        /// </summary>
        /// <param name="StartTime"></param>
        /// <param name="content"></param>
        /// <param name="maxdelayinms"></param>
        /// <param name="type"></param>
        /// <param name="result"></param>
        /// <returns></returns>
        public bool WaitForJournalLine(DateTime StartTime, string content, int maxdelayinms, JournalType type,
                                       out JournalEntry result)
        {
            var state = WaitForJournalLine(StartTime, content, maxdelayinms, type);

            result = new JournalEntry(state);
            if (_dologging)
            {
                _entries.Add(result);
            }
            return(state);
        }
예제 #43
0
        public string Update(JournalType.JournalDataDataType _SaveData)
            {
            MySql.Data.MySqlClient.MySqlTransaction Mytrans;
            MySqlConnection CurCon = new MySqlConnection();
            CurCon = Mycommon.AccountConnection;
            string respond = "";
            decimal FullPayment = 0;
            if (CurCon.State == ConnectionState.Open)
                {
                CurCon.Close();
                CurCon.Open();
                }
            else
                {
                CurCon.Open();
                }
            Mytrans = Mycommon.AccountConnection.BeginTransaction();
            respond = UpdateJournalData(_SaveData, CurCon);
            if (respond != "True")
                {
                Mytrans.Rollback();
                CurCon.Close();
                return respond;
                }
            else
                {
                foreach (JournalType.JournalDetailsDataType item in _SaveData.DetailList)
                    {
                    if (!ExistJournalDetails(item.JeNumber, item.LineRef, CurCon))
                        {
                        respond = UpdateJournalDetails(item, CurCon);
                        if (respond != "True")
                            {
                            Mytrans.Rollback();
                            CurCon.Close();
                            return respond;
                            }
                        }
                    else
                        {
                        respond = UpdateJournalDetails(item, CurCon);
                        if (respond != "True")
                            {
                            Mytrans.Rollback();
                            CurCon.Close();
                            return respond;
                            }
                        }
                    }
                if (respond != "True")
                    {
                    Mytrans.Rollback();
                    CurCon.Close();
                    return respond;
                    }
                else
                    {
                    Mytrans.Commit();
                    CurCon.Close();
                    return "True";
                    }
                }

            }
예제 #44
0
        /// <summary>
        ///  Function tries to check if a certain journal message appeared within ppassed journal system.
        /// </summary>
        /// <param name="StartTime"></param>
        /// <param name="content"></param>
        /// <param name="maxdelayinms"></param>
        /// <param name="type"></param>
        /// <returns></returns>
        public bool WaitForJournalLine(DateTime StartTime, string content, int maxdelayinms, JournalType type)
        {
            switch (type)
            {
            case JournalType.Journal:
                return(Stealth.Client.WaitJournalLine(StartTime, content, maxdelayinms));

            case JournalType.System:
                return(Stealth.Client.WaitJournalLineSystem(StartTime, content, maxdelayinms));
            }
            return(false);
        }
예제 #45
0
        private string SetDataToJournal(out JournalType.JournalDataDataType _SaveData)
        {
            _SaveData = new JournalType.JournalDataDataType();
            try
            {
                _SaveData.Jedate = dtpJEdate.Value;
                _SaveData.JeStatus = 0;
                _SaveData.JounalID = textJENo.Text;
                _SaveData.Reason = txtDescription.Text;
                _SaveData.JeUser = Program.AccountStatic.UserName;
                _SaveData.TimePeriod = Program.AccountStatic.CurrentAccPeriod;
                _SaveData.CompanyID = Program.AccountStatic.CompanyID ;
                List<JournalType.JournalDetailsDataType> _JournalList = new List<JournalType.JournalDetailsDataType>();
                string respond = SetJournalDetailList(out _JournalList);
                _SaveData.DetailList = _JournalList;
                return "True";
            }
            catch (Exception ex)
            {

                return ex.Message;
            }

        }