private void LoadFeedbackTable(OpenItem item)
        {
            if (item.ParentLoadID == 0)
            {
                rpFeedback.Visible = false;
            }
            else
            {
                //load Feedback details:
                var feedbackRecords = Item.GetFeedbackRecords(OItemID);
                if (feedbackRecords.Any())
                {
                    rpFeedback.Visible = false;
                    return;
                }
                rpFeedback.DataSource = feedbackRecords;
                rpFeedback.DataBind();
                var iRoundCount = rpFeedback.Items.Count;

                //foreach (RepeaterItem repeatItem in rpFeedback.Items)
                //{    // if condition to add HeaderTemplate Dynamically only Once
                //    if (repeatItem.ItemIndex == 1)
                //    {
                //       //lblFeedback
                //    }
                //}
            }
        }
        private void BindGridData(OpenItem item)
        {
            if (ItemLinesDataView == null)
            {
                if (item == null)
                {
                    item = new OpenItem(OItemID, LoadID, OrgCode, CurrentItemReviewerID);
                }

                // ***SM
                //ItemLinesDataView = item.GetItemLines(false);
                ItemLinesDataView = item.GetItemLinesByReviewerID(CurrentItemReviewerID);
            }

            ItemLinesDataView.Sort = ItemLinesSortExp;

            gvLineNums.DataSource = ItemLinesDataView;
            gvLineNums.DataBind();

            //bool blnForUpdate = Item.AvailableForUpdate(item.IsArchived, (item.ParentLoadID > 0), item.Organization, item.ReviewerUserID, User, CurrentUserOrganization, CurrentUserID);
            //if (!blnForUpdate)
            if (!BlnForUpdate)
            {
                gvLineNums.Columns[1].Visible = false;
            }
        }
Exemple #3
0
        public void UpdateDetails(int iOItemID, int iLoadID, int iLineN, string sULOOrgCode, int iValid, string sComments, int iJustification,
                                  string sJustificationAddOn, string sJustificationOther, string sCode, string sCodeComment, string sRWA, int iUpdateUser)
        {
            /*****************************************************************/
            //1. - update Line properties
            /*****************************************************************/
            var objLine              = new LineNum(iOItemID, iLineN);
            var reviewer             = objLine.ReviewerUserID;
            var line_prev_validation = objLine.Valid;

            objLine.Valid              = iValid;
            objLine.Comments           = sComments;
            objLine.JustificationCode  = iJustification;
            objLine.JustificationAddOn = sJustificationAddOn;
            objLine.JustificationOther = sJustificationOther;
            objLine.Code         = sCode;
            objLine.CodeComments = sCodeComment;
            objLine.RWA          = sRWA;
            objLine.Save(iUpdateUser);

            iJustification = objLine.JustificationCode;

            //get Open Item details
            var objItem           = new OpenItem(iOItemID, iLoadID, sULOOrgCode, reviewer);
            var document_valid    = objItem.ValidCode;
            var item_status       = objItem.StatusCode;
            var item_new_status   = objItem.StatusCode;
            var item_orig_orgcode = objItem.OriginalOrgCode;
            var doc_number        = objItem.DocNumber;

            //2. - insert History on update Line Properties
            // OR
            //3. - insert History on update Line Validation if it has been changed
            // (insert only one record to the History due to not duplicate records)
            if (line_prev_validation != iValid)
            {
                History.InsertHistoryOnLineUpdate((int)HistoryActions.haLineValidationUpdate, iLoadID, iOItemID, item_orig_orgcode, sULOOrgCode,
                                                  doc_number, iLineN, item_status, iValid, sCode, sCodeComment, iJustification, sJustificationAddOn, sComments, reviewer, iUpdateUser);
            }
            else
            {
                History.InsertHistoryOnLineUpdate((int)HistoryActions.haLinePropertiesUpdate, iLoadID, iOItemID, item_orig_orgcode, sULOOrgCode,
                                                  doc_number, iLineN, item_status, line_prev_validation, sCode, sCodeComment, iJustification, sJustificationAddOn, sComments, reviewer, iUpdateUser);
            }

            /*****************************************************************/
            //4. - update Item Status if necessary
            /*****************************************************************/
            item_new_status = Item.CalculateItemStatus(iOItemID, sULOOrgCode, reviewer);

            if (item_status != item_new_status)
            {
                Item.UpdateItemStatus(iOItemID, iLoadID, sULOOrgCode, reviewer, item_new_status);

                //5. - insert History on update Item Status
                History.InsertHistoryOnItemUpdate((int)HistoryActions.haItemPropertiesUpdate, iLoadID, iOItemID, item_orig_orgcode, sULOOrgCode,
                                                  doc_number, item_new_status, document_valid, null, reviewer, iUpdateUser);
            }
        }
Exemple #4
0
        private void InitControls(string DocNumber)
        {
            if (DocNumber == null || DocNumber == "")
            {
                var item = new OpenItem(OItemID, LoadID, OrgCode, CurrentItemReviewerID);

                //lblDocNumber.Text = item.DocNumber;
                //lblReviewer.Text = item.Reviewer;
                DocNumber = item.DocNumber;
            }

            lblDocNumber.Text = DocNumber;

            var dsHistory = History.GetDocumentHistory(DocNumber);

            dlLoads.DataSource = dsHistory.Tables[0];
            dlLoads.DataBind();
        }
Exemple #5
0
        public bool UpdateItemProperties(int iOItemID, int iLoadID, string sULOOrgCode, string sUDOShouldBe, string sDOShouldBe,
                                         DateTime dtExpCompDate, string sComments, int iReviewerUserID, int iUpdateUser)
        {
            var update_grid_view_flag = false;

            var objItem = new OpenItem(iOItemID, iLoadID, sULOOrgCode, iReviewerUserID);
            //int load_id = objItem.LoadID;
            var status       = objItem.StatusCode;
            var valid        = objItem.ValidCode;
            var orig_orgcode = objItem.OriginalOrgCode;
            var doc_number   = objItem.DocNumber;

            //first, check if changes have been made :
            //------------------------------------------
            if ((sDOShouldBe.Trim().Length > 0 && sUDOShouldBe.Trim() != "$" && sUDOShouldBe != objItem.UDOShouldBe) ||
                (sDOShouldBe.Trim().Length > 0 && sDOShouldBe.Trim() != "$" && sDOShouldBe != objItem.DOShouldBe) ||
                (dtExpCompDate != DateTime.MinValue && dtExpCompDate != objItem.ExpectedCompletionDate) ||
                objItem.Comments.Trim() != sComments.Trim())
            {
                Dal.UpdateItemProperties(iOItemID, sULOOrgCode, sUDOShouldBe, sDOShouldBe, dtExpCompDate, sComments);

                var new_status = CalculateItemStatus(iOItemID, sULOOrgCode, iReviewerUserID);

                if (new_status == (int)OpenItemStatus.stNewItem || new_status == (int)OpenItemStatus.stAssigned)
                {
                    new_status = (int)OpenItemStatus.stInProcess;
                }
                //if item status should be changed, update items grid view:
                if (new_status != status)
                {
                    UpdateItemStatus(iOItemID, iLoadID, sULOOrgCode, iReviewerUserID, status);
                    update_grid_view_flag = true;
                }

                //insert History for Item properties update:
                History.InsertHistoryOnItemUpdate((int)HistoryActions.haItemPropertiesUpdate, iLoadID, iOItemID, orig_orgcode,
                                                  sULOOrgCode, doc_number, status, valid, sComments, iReviewerUserID, iUpdateUser);
            }

            return(update_grid_view_flag);
        }
        void HandleOpenItem(OpenItem packet)
        {
            Player player = GetPlayer();

            // ignore for remote control state
            if (player.m_unitMovedByMe != player)
            {
                return;
            }

            Item item = player.GetItemByPos(packet.Slot, packet.PackSlot);

            if (!item)
            {
                player.SendEquipError(InventoryResult.ItemNotFound);
                return;
            }

            ItemTemplate proto = item.GetTemplate();

            if (proto == null)
            {
                player.SendEquipError(InventoryResult.ItemNotFound, item);
                return;
            }

            // Verify that the bag is an actual bag or wrapped item that can be used "normally"
            if (!proto.GetFlags().HasAnyFlag(ItemFlags.HasLoot) && !item.HasFlag(ItemFields.Flags, ItemFieldFlags.Wrapped))
            {
                player.SendEquipError(InventoryResult.ClientLockedOut, item);
                Log.outError(LogFilter.Network, "Possible hacking attempt: Player {0} [guid: {1}] tried to open item [guid: {2}, entry: {3}] which is not openable!",
                             player.GetName(), player.GetGUID().ToString(), item.GetGUID().ToString(), proto.GetId());
                return;
            }

            // locked item
            uint lockId = proto.GetLockID();

            if (lockId != 0)
            {
                LockRecord lockInfo = CliDB.LockStorage.LookupByKey(lockId);
                if (lockInfo == null)
                {
                    player.SendEquipError(InventoryResult.ItemLocked, item);
                    Log.outError(LogFilter.Network, "WORLD:OpenItem: item [guid = {0}] has an unknown lockId: {1}!", item.GetGUID().ToString(), lockId);
                    return;
                }

                // was not unlocked yet
                if (item.IsLocked())
                {
                    player.SendEquipError(InventoryResult.ItemLocked, item);
                    return;
                }
            }

            if (item.HasFlag(ItemFields.Flags, ItemFieldFlags.Wrapped))// wrapped?
            {
                PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_CHARACTER_GIFT_BY_ITEM);
                stmt.AddValue(0, item.GetGUID().GetCounter());
                SQLResult result = DB.Characters.Query(stmt);

                if (!result.IsEmpty())
                {
                    uint entry = result.Read <uint>(0);
                    uint flags = result.Read <uint>(1);

                    item.SetUInt64Value(ItemFields.GiftCreator, 0);
                    item.SetEntry(entry);
                    item.SetUInt32Value(ItemFields.Flags, flags);
                    item.SetState(ItemUpdateState.Changed, player);
                }
                else
                {
                    Log.outError(LogFilter.Network, "Wrapped item {0} don't have record in character_gifts table and will deleted", item.GetGUID().ToString());
                    player.DestroyItem(item.GetBagSlot(), item.GetSlot(), true);
                    return;
                }

                stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_GIFT);
                stmt.AddValue(0, item.GetGUID().GetCounter());
                DB.Characters.Execute(stmt);
            }
            else
            {
                player.SendLoot(item.GetGUID(), LootType.Corpse);
            }
        }
Exemple #7
0
        private void LoadOpenItemDetails(OpenItem open_item, bool EnableForUpdate)
        {
            txtItemID.Value   = open_item.OItemID.ToString();
            lblDocNumber.Text = open_item.DocNumber;

            //moved to the Line properties:
            //lblReviewer.Text = open_item.Reviewer;

            //lblOrganization.Text = open_item.Organization;
            //lblOrgCode.Text = open_item.ULOOrgCode;

            //if (open_item.IsArchived)
            //    lblStatus.Text = open_item.Status + " (Archived)";
            //else
            //    lblStatus.Text = open_item.Status;

            lblDueDate.Text = Utility.DisplayDateFormat(open_item.DueDate, "MMM dd, yyyy");
            if (open_item.DueDate <= DateTime.Now && !open_item.IsArchived)
            {
                lblDueDate.CssClass = "regBldRedText";
            }

            if (open_item.JustificationRequired)
            {
                lblJustfReq.Text = "Yes";
            }
            else
            {
                lblJustfReq.Text = "No";
            }
            lblAwardNum.Text       = open_item.AwardNumber;
            lblTotalLineItem.Text  = Utility.DisplayMoneyFormat(open_item.TotalLine);
            lblTitleField.Text     = open_item.TitleField;
            lblEarliest.Text       = Utility.DisplayDateFormat(open_item.Earliest, "MM/yyyy");
            lblLatest.Text         = Utility.DisplayDateFormat(open_item.Latest, "MM/yyyy");
            lblAcctPeriod.Text     = open_item.AcctPeriod;
            lblLastPaid.Text       = Utility.DisplayDateFormat(open_item.LastPaid, "MMM dd, yyyy");
            lblExpDate.Text        = Utility.DisplayDateFormat(open_item.ExpirationDate, "MMM dd, yyyy");
            lblCompletionDate.Text = Utility.DisplayDateFormat(open_item.ExpectedCompletionDate, "MMM dd, yyyy");
            if (open_item.ExpectedCompletionDate > DateTime.MinValue && open_item.ExpectedCompletionDate < DateTime.Now)
            {
                lblCompletionDate.CssClass = "regBldRedText";
            }
            lblUDO.Text         = Utility.DisplayMoneyFormat(open_item.UDO);
            lblUDOShouldBe.Text = open_item.UDOShouldBe;
            lblDO.Text          = Utility.DisplayMoneyFormat(open_item.DO);
            lblDOShouldBe.Text  = open_item.DOShouldBe;
            lblACCR.Text        = Utility.DisplayMoneyFormat(open_item.ACCR);
            lblPENDPYMT.Text    = Utility.DisplayMoneyFormat(open_item.PEND_PYMT);
            lblPYMTS_CONF.Text  = Utility.DisplayMoneyFormat(open_item.PYMT_CONF);
            lblHOLDBACKS.Text   = Utility.DisplayMoneyFormat(open_item.HOLDBACKS);

            ctrlContacts.ContrOfficerByCO = open_item.ContrOfficerByCO;
            if (EnableForUpdate)
            {
                ctrlContacts.Enabled = true;
                ctrlAttachments.ShowAddAttBtn(false);
            }
            else
            {
                ctrlContacts.Enabled = false;
                ctrlAttachments.ShowAddAttBtn(true);
            }
        }
Exemple #8
0
        void HandleOpenItem(OpenItem packet)
        {
            Player player = GetPlayer();

            // ignore for remote control state
            if (player.GetUnitBeingMoved() != player)
            {
                return;
            }

            // additional check, client outputs message on its own
            if (!player.IsAlive())
            {
                player.SendEquipError(InventoryResult.PlayerDead);
                return;
            }

            Item item = player.GetItemByPos(packet.Slot, packet.PackSlot);

            if (!item)
            {
                player.SendEquipError(InventoryResult.ItemNotFound);
                return;
            }

            ItemTemplate proto = item.GetTemplate();

            if (proto == null)
            {
                player.SendEquipError(InventoryResult.ItemNotFound, item);
                return;
            }

            // Verify that the bag is an actual bag or wrapped item that can be used "normally"
            if (!proto.HasFlag(ItemFlags.HasLoot) && !item.IsWrapped())
            {
                player.SendEquipError(InventoryResult.ClientLockedOut, item);
                Log.outError(LogFilter.Network, "Possible hacking attempt: Player {0} [guid: {1}] tried to open item [guid: {2}, entry: {3}] which is not openable!",
                             player.GetName(), player.GetGUID().ToString(), item.GetGUID().ToString(), proto.GetId());
                return;
            }

            // locked item
            uint lockId = proto.GetLockID();

            if (lockId != 0)
            {
                LockRecord lockInfo = CliDB.LockStorage.LookupByKey(lockId);
                if (lockInfo == null)
                {
                    player.SendEquipError(InventoryResult.ItemLocked, item);
                    Log.outError(LogFilter.Network, "WORLD:OpenItem: item [guid = {0}] has an unknown lockId: {1}!", item.GetGUID().ToString(), lockId);
                    return;
                }

                // was not unlocked yet
                if (item.IsLocked())
                {
                    player.SendEquipError(InventoryResult.ItemLocked, item);
                    return;
                }
            }

            if (item.IsWrapped())// wrapped?
            {
                PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_CHARACTER_GIFT_BY_ITEM);
                stmt.AddValue(0, item.GetGUID().GetCounter());
                _queryProcessor.AddCallback(DB.Characters.AsyncQuery(stmt)
                                            .WithCallback(result => HandleOpenWrappedItemCallback(item.GetPos(), item.GetGUID(), result)));
            }
            else
            {
                player.SendLoot(item.GetGUID(), LootType.Corpse);
            }
        }
        public static Vector2 find_open_tile(Vector2 target_loc, int id, Vector2 loc)
        {
            reset_move_costs();
            // Prepare outside variables for pathfinding
            Game_Unit unit = Global.game_map.units[id];

            if (map_data_needs_updated(unit))
            {
                update_map_data(unit);
                last_id = id;
            }
            if (Global.game_map.width == 0)
            {
                return(Config.OFF_MAP);
            }
            //Prepare pathfinding variables
            OpenList <Vector2>        open_list   = new OpenList <Vector2>();
            ClosedListRoute <Vector2> closed_list = new ClosedListRoute <Vector2>();

            int temp_parent = -1;

            Vector2 temp_loc        = Vector2.Zero;
            int     temp_f          = 0;
            int     temp_g          = 0;
            int     temp_h          = 0;
            bool    temp_accessible = true;

            Vector2[] check_loc = new Vector2[] {
                new Vector2(0, -1), new Vector2(0, 1), new Vector2(-1, 0), new Vector2(1, 0)
            };
            Vector2 test_loc;
            bool    route_found = false;

            // Start pathfinding
            temp_g = 0;
            temp_h = manhatten_dist(loc, target_loc);
            temp_f = temp_g + temp_h;
            open_list.add_item(loc, temp_parent, temp_f, temp_g, temp_accessible);
            for (; ;)
            {
                if (open_list.size <= 0)
                {
                    break;
                }
                OpenItem <Vector2> lowest_f_item = open_list.get_lowest_f_item();
                temp_loc        = lowest_f_item.Loc;
                temp_parent     = lowest_f_item.Parent;
                temp_f          = lowest_f_item.Fcost;
                temp_g          = lowest_f_item.Gcost;
                temp_accessible = lowest_f_item.Accessible;

                temp_parent = closed_list.add_item(temp_loc, temp_parent, temp_f, temp_g, temp_accessible);
                open_list.remove_open_item();
                if (Global.game_map.get_unit(temp_loc) == null)
                {
                    route_found = true;
                    break;
                }
                else
                {
                    bool reverse = (rand.Next(2) == 0);
                    reverse = false;
                    for (int i = 0; i < check_loc.Length; i++)
                    {
                        test_loc = temp_loc + check_loc[reverse ? 3 - i : i];
                        if (Global.game_map.is_off_map(test_loc))
                        {
                            continue;
                        }
                        if (closed_list.already_added(test_loc))
                        {
                            continue;
                        }
                        check_tile(unit, test_loc, temp_parent, -1, target_loc, open_list, closed_list, true);
                    }
                }
            }
            unit_distance = 0;
            if (route_found)
            {
                return(temp_loc);
            }
            return(Config.OFF_MAP);
        }
Exemple #10
0
        public static List <Vector2> get_route(Vector2 target_loc, int mov, int id, Vector2 loc, bool through_doors = false, bool ignore_doors = false)
        {
            reset_move_costs();
            // Prepare outside variables for pathfinding
            Game_Unit unit = Global.game_map.units[id];

            if (map_data_needs_updated(unit))
            {
                update_map_data(unit, through_doors, ignore_doors);
                last_id = id;
            }
            //Restrict_To_Map = !Global.game_map.is_off_map(loc, false) && !Global.game_map.is_off_map(target_loc, false); //Debug
            Restrict_To_Map = !Global.game_map.is_off_map(loc) && !Global.game_map.is_off_map(target_loc);
            //Prepare pathfinding variables
            OpenList <Vector2>        open_list   = new OpenList <Vector2>();
            ClosedListRoute <Vector2> closed_list = new ClosedListRoute <Vector2>();

            int temp_parent = -1;

            Vector2 temp_loc        = Vector2.Zero;
            int     temp_f          = 0;
            int     temp_g          = 0;
            int     temp_h          = 0;
            bool    temp_accessible = true;

            Vector2[] check_loc = new Vector2[] {
                new Vector2(0, -1), new Vector2(0, 1), new Vector2(-1, 0), new Vector2(1, 0)
            };
            Vector2 test_loc;
            bool    route_found = false;

            bool use_euclidean_distance = mov == -1;

            // Start pathfinding
            temp_g = 0;
            temp_h = distance(loc, target_loc, use_euclidean_distance);
            temp_f = temp_g + temp_h;
            open_list.add_item(loc, temp_parent, temp_f, temp_g, temp_accessible);
            for (; ;)
            {
                if (open_list.size <= 0)
                {
                    break;
                }
                OpenItem <Vector2> lowest_f_item = open_list.get_lowest_f_item();
                temp_loc        = lowest_f_item.Loc;
                temp_parent     = lowest_f_item.Parent;
                temp_f          = lowest_f_item.Fcost;
                temp_g          = lowest_f_item.Gcost;
                temp_accessible = lowest_f_item.Accessible;

                temp_parent = closed_list.add_item(temp_loc, temp_parent, temp_f, temp_g, temp_accessible);
                open_list.remove_open_item();
                if (temp_loc == target_loc)
                {
                    route_found = true;
                    break;
                }
                else
                {
                    for (int i = 0; i < check_loc.Length; i++)
                    {
                        test_loc = temp_loc + check_loc[i];
#if DEBUG
                        if (Global.game_map.is_off_map(test_loc, Restrict_To_Map))
                        {
                            int test = 0;
                        }
#endif
                        // If the checked location isn't the target but is off the map, and off the map is not allowed
                        if (test_loc != target_loc && Global.game_map.is_off_map(test_loc, Restrict_To_Map))
                        {
                            continue;
                        }
                        // If the location is already on the closed list
                        if (closed_list.already_added(test_loc))
                        {
                            continue;
                        }
                        check_tile(unit, test_loc, temp_parent, mov, target_loc, open_list, closed_list, use_euclidean_distance: use_euclidean_distance);
                    }
                }
            }
            unit_distance = 0;
            if (route_found)
            {
                unit_distance = closed_list.get_g(temp_parent) / 10;
                var route = closed_list
                            .get_route(temp_parent)
                            .ToArray();
                return(Enumerable.Range(0, route.Length - 1)
                       .Select(x => route[x] - route[x + 1])
                       .ToList());
            }
            return(null);
        }
Exemple #11
0
        private void InitControlsByItem(int OItemID, string Lines, string ULOOrgCode, string PrevReviewer)
        {
            txtItemID.Value = OItemID.ToString();

            if (Lines == "" || Lines == "0")
            {
                //init by item properties:
                lblLines.Text = "all";

                int reviewer_id;
                if (PrevReviewer == "" || PrevReviewer == "0")
                {
                    reviewer_id = 0;
                }
                else
                {
                    reviewer_id = Int32.Parse(PrevReviewer);
                }
                var item = new OpenItem(OItemID, (new PageBase()).LoadID, ULOOrgCode, reviewer_id);

                txtCurrentReviewer.Value = item.ReviewerUserID.ToString();
                lblPrevReviewer.Text     = item.Reviewer;
                lblDocNumber.Text        = item.DocNumber;
                lblOrgCode.Text          = item.ULOOrgCode;

                InitAssignUsersList(OItemID, ULOOrgCode, 0);
            }
            else
            {
                //init by lines properties:
                lblLines.Text = Lines;

                var line_num = 0;
                Int32.TryParse(Lines, out line_num);
                if (line_num == 0)
                {
                    //we have multiline selection:
                    lblDocNumber.Text = Request.QueryString["doc"];

                    var str_org   = "";
                    var str_names = "";
                    var ds        = Item.GetULOOrganizationsByItemLines(OItemID, Lines);

                    foreach (DataRow dr in ds.Tables[0].Rows)
                    {
                        if (str_org.IndexOf((string)dr["ULOOrgCode"]) == -1)
                        {
                            str_org = str_org + (string)dr["ULOOrgCode"] + ", ";
                        }

                        if (str_names.IndexOf((string)dr["ReviewerName"]) == -1)
                        {
                            str_names = str_names + (string)dr["ReviewerName"] + "<br/>";
                        }
                    }

                    lblOrgCode.Text      = str_org.Substring(0, str_org.Length - 2);
                    lblPrevReviewer.Text = str_names;

                    InitAssignUsersList(OItemID, ULOOrgCode, 0);
                }
                else
                {
                    //one line selected
                    var line = new LineNum(OItemID, line_num);

                    txtCurrentReviewer.Value = line.ReviewerUserID.ToString();
                    lblPrevReviewer.Text     = line.Reviewer;
                    lblDocNumber.Text        = line.DocNumber;
                    lblOrgCode.Text          = line.ULOOrgCode;

                    InitAssignUsersList(OItemID, line.ULOOrgCode, 0);
                }
            }

            //init with default settings:
            InitUsersOrganizationsList("", 0);
        }
        private void LoadItemDetails(OpenItem item)
        {
            //bool blnForUpdate = Item.AvailableForUpdate(item.IsArchived, (item.ParentLoadID > 0), item.Organization, item.ReviewerUserID, User, CurrentUserOrganization, CurrentUserID);

            lblReviewer.Text        = item.Reviewer;
            txtReviewerUserID.Value = item.ReviewerUserID.ToString();
            txtReviewerEmail.Value  = Admin.GetEmailByUserID(Convert.ToInt32(txtReviewerUserID.Value));

            lblDocNumber.Text = item.DocNumber;
            DocNumber         = item.DocNumber;

            txtItemStatusCode.Value = item.StatusCode.ToString();


            lblEstAccrual.Text    = item.EstimatedAccrual;
            lblTypeOfBalance.Text = item.TypeOfBalance;
            lblCategory.Text      = item.Category;
            lblACCR.Text          = Utility.DisplayMoneyFormat(item.ACCR);
            lblAcctPeriod.Text    = item.AcctPeriod;
            lblAwardNum.Text      = item.AwardNumber;
            lblDO.Text            = Utility.DisplayMoneyFormat(item.DO);
            lblEarliest.Text      = Utility.DisplayDateFormat(item.Earliest, "MM/yyyy");
            lblFirstReview.Text   = item.ReviewRoundDesc;
            lblHOLDBACKS.Text     = Utility.DisplayMoneyFormat(item.HOLDBACKS);
            lblJustification.Text = item.Justification;
            lblLatest.Text        = Utility.DisplayDateFormat(item.Latest, "MM/yyyy");
            lblOrganization.Text  = item.Organization;
            lblOrgCode.Text       = item.ULOOrgCode;
            lblPENDPYMT.Text      = Utility.DisplayMoneyFormat(item.PEND_PYMT);
            lblPYMTS_CONF.Text    = Utility.DisplayMoneyFormat(item.PYMT_CONF);
            lblTitleField.Text    = item.TitleField;
            lblTotalLine.Text     = Utility.DisplayMoneyFormat(item.TotalLine);
            lblUDO.Text           = Utility.DisplayMoneyFormat(item.UDO);

            lblLastPaid.Text = Utility.DisplayDateFormat(item.LastPaid, "MMM dd, yyyy");
            lblExpDate.Text  = Utility.DisplayDateFormat(item.ExpirationDate, "MMM dd, yyyy");

            lblDueDate.Text = Utility.DisplayDateFormat(item.DueDate, "MMM dd, yyyy");
            if (item.DueDate <= DateTime.Now && !item.IsArchived)
            {
                lblDueDate.CssClass = "regBldRedText";
            }

            if (item.IsArchived)
            {
                lblStatus.Text = item.Status + " (Archived)";
            }
            else
            {
                lblStatus.Text = item.Status;
            }

            if (item.ParentLoadID > 0)
            {
                lblValid.Text     = item.ValidDescription + " (1st review)";
                lblValid.CssClass = "regBldGreyText";
            }
            else
            {
                lblValid.Text = item.ValidDescription;
            }

            if (item.JustificationRequired)
            {
                lblJustfReq.Text = "Yes";
            }
            else
            {
                lblJustfReq.Text = "No";
            }

            txtComment.Text = item.Comments;
            txtDO.Text      = item.DOShouldBe;
            txtUDO.Text     = item.UDOShouldBe;

            dtCompletionDate.MinDate   = DateTime.Parse("01/01/1990");
            dtCompletionDate.MaxDate   = DateTime.Now.AddYears(10);
            dtCompletionDate.VoidEmpty = false;
            if (item.ExpectedCompletionDate > DateTime.MinValue)
            {
                dtCompletionDate.Date = item.ExpectedCompletionDate;
                if (item.ExpectedCompletionDate < DateTime.Now)
                {
                    dtCompletionDate.DateCSSClass = "regBldRedText";
                }
            }

            ctrlContacts.ContrOfficerByCO = item.ContrOfficerByCO;


            if (item.ItemInfo.Length > 0)
            {
                txtItemInfo.Text    = item.ItemInfo;
                txtItemInfo.Enabled = false;

                tblItemInfo.Visible = true;
            }
            else
            {
                tblItemInfo.Visible = false;
            }


            /*
             * //save current item properties on client:
             * StringBuilder sb = new StringBuilder();
             * sb.Append("<script type='text/javascript' >");
             * sb.Append("var init_udo = '" + txtUDO.Text + "';");
             * sb.Append("var init_do = '" + txtDO.Text + "';");
             * sb.Append("</script>");
             * ClientScript.RegisterClientScriptBlock(this.GetType(), "item_details", sb.ToString());
             */

            if (!BlnForUpdate)// not updates here
            {
                txtComment.Enabled          = false;
                txtDO.Enabled               = false;
                txtUDO.Enabled              = false;
                dtCompletionDate.FreezeMode = true;
                dtCompletionDate.VoidEdit   = true;

                btnSave.Enabled = false;
                btnSave.Visible = false;

                btnReviewer.Disabled     = true;
                btnReviewer.Visible      = false;
                btnReviewer0.Disabled    = true;
                btnReviewer0.Visible     = false;
                lblReassignLines.Visible = false;

                ctrlContacts.Enabled = false;
                ctrlAttachments.ShowAddAttBtn(false);
                ctrlAttachments.ShowEmailIcon(false, txtReviewerEmail.Value, lblDocNumber.Text);
            }
            else // here we can update the data
            {
                ctrlContacts.Enabled = true;
                ctrlAttachments.ShowAddAttBtn(true);

                if (lblValid.Text.ToLower().Trim() == "valid" || lblValid.Text.ToLower().Trim() == "invalid")
                {
                    ctrlAttachments.ShowEmailIcon(true, txtReviewerEmail.Value, lblDocNumber.Text);
                }
                else
                {
                    ctrlAttachments.ShowEmailIcon(false, txtReviewerEmail.Value, lblDocNumber.Text);
                }

                if (item.StatusCode == (int)OpenItemStatus.stReassignRequest)
                {
                    btnReviewer.Disabled     = true;
                    btnReviewer.Visible      = false;
                    lblReassignLines.Visible = false;
                }

                if (User.IsInRole(((int)UserRoles.urBudgetDivisionAdmin).ToString()))
                {
                    txtReassignTargetPage.Value = "Reroute";
                }
                else if (User.IsInRole(((int)UserRoles.urOrganizationAdmin).ToString()))
                {
                    txtReassignTargetPage.Value = "Reassign";
                }
                else
                {
                    txtReassignTargetPage.Value = "ReassignRequest";
                }
            }
        }
Exemple #13
0
        private void InitControlsByItem(int OItemID, string Lines, string ULOOrgCode, string PrevReviewer)
        {
            txtItemID.Value = OItemID.ToString();

            if (Lines == "" || Lines == "0")
            {
                //init by item properties:
                lblLines.Text = "all";

                int reviewer_id;
                if (PrevReviewer == "" || PrevReviewer == "0")
                {
                    reviewer_id = 0;
                }
                else
                {
                    reviewer_id = Int32.Parse(PrevReviewer);
                }
                var item = new OpenItem(OItemID, (new PageBase()).LoadID, ULOOrgCode, reviewer_id);

                txtPrevOrganization.Value = item.Organization + " : " + item.ULOOrgCode;
                txtPrevReviewer.Value     = item.ReviewerUserID.ToString();
                lblDocNumber.Text         = item.DocNumber;

                lblPrevOrganization.Text = item.Organization;
                lblPrevOrgCode.Text      = item.ULOOrgCode;
                lblPrevReviewerName.Text = item.Reviewer;
            }
            else
            {
                //init by lines properties:
                lblLines.Text = Lines;

                var line_num = 0;
                Int32.TryParse(Lines, out line_num);
                if (line_num == 0)
                {
                    //we have multiline selection:
                    lblDocNumber.Text = Request.QueryString["doc"];

                    var str_org   = "";
                    var str_names = "";
                    var ds        = Item.GetULOOrganizationsByItemLines(OItemID, Lines);

                    foreach (DataRow dr in ds.Tables[0].Rows)
                    {
                        if (str_org.IndexOf((string)dr["Organization"]) == -1)
                        {
                            str_org = str_org + (string)dr["Organization"] + ", ";
                        }

                        if (str_names.IndexOf((string)dr["ReviewerName"]) == -1)
                        {
                            str_names = str_names + (string)dr["ReviewerName"] + "<br/>";
                        }
                    }

                    lblPrevOrganization.Text = str_org.Substring(0, str_org.Length - 2);
                    lblPrevOrgCode.Style.Add("display", "none");
                    lblPrevReviewerName.Text = str_names;
                }
                else
                {
                    //one line selected
                    var line = new LineNum(OItemID, line_num);

                    txtPrevOrganization.Value = line.Organization + " : " + line.ULOOrgCode;
                    txtPrevReviewer.Value     = line.ReviewerUserID.ToString();
                    lblDocNumber.Text         = line.DocNumber;

                    lblPrevOrganization.Text = line.Organization;
                    lblPrevOrgCode.Text      = line.ULOOrgCode;
                    lblPrevReviewerName.Text = line.Reviewer;
                }
            }

            ctrlOrgUsers.OrganizationLabel = "Select Organization:";
            ctrlOrgUsers.UsersLabel        = "Select Reviewer:";
            ctrlOrgUsers.InitLists();
        }
        public override Item NextItem()
        {
            Item item = default;

            while (item.Type == ItemType.None)
            {
                this.token = this.NextToken();

                switch (this.state)
                {
                case State.Value:
                    switch (this.token.Type)
                    {
                    case TokenType.OpenBracket:
                        this.openItems.Push(this.openItem);
                        this.openItem = OpenItem.Array;
                        item          = new Item(ItemType.ArrayStart);
                        break;

                    case TokenType.CloseBracket:
                        item          = new Item(ItemType.ArrayEnd);
                        this.openItem = this.openItems.Pop();
                        this.state    = (this.openItem == OpenItem.None) ? State.None : State.Separator;
                        break;

                    case TokenType.OpenCurly:
                        this.openItems.Push(this.openItem);
                        this.openItem = OpenItem.Object;
                        this.state    = State.Key;
                        item          = new Item(ItemType.ObjectStart);
                        break;

                    default:
                        if (this.token.HasType(TokenType.AnyValue))
                        {
                            item       = new Item(ItemType.Value);
                            this.state = (this.openItem == OpenItem.None) ? State.None : State.Separator;
                        }
                        else
                        {
                            throw this.ParseException(this.token, Resources.Parser_ExpectedValue);
                        }
                        break;
                    }
                    break;

                case State.Key:
                    switch (this.token.Type)
                    {
                    case TokenType.String:
                    case TokenType.EncodedString:
                        item       = new Item(ItemType.Key);
                        this.state = State.KeyColon;
                        break;

                    case TokenType.CloseCurly:
                        item          = new Item(ItemType.ObjectEnd);
                        this.openItem = this.openItems.Pop();
                        this.state    = (this.openItem == OpenItem.None) ? State.None : State.Separator;
                        break;

                    default:
                        throw this.ParseException(this.token, Resources.Parser_ExpectedKeyName);
                    }
                    break;

                case State.KeyColon:
                    switch (this.token.Type)
                    {
                    case TokenType.Colon:
                        this.state = State.Value;
                        break;

                    default:
                        throw this.ParseException(this.token, Resources.Parser_ExpectedKeyName);
                    }
                    break;

                case State.Separator:
                    switch (this.openItem)
                    {
                    case OpenItem.Array:
                        switch (this.token.Type)
                        {
                        case TokenType.Comma:
                            this.state = State.Value;
                            break;

                        case TokenType.CloseBracket:
                            item          = new Item(ItemType.ArrayEnd);
                            this.openItem = this.openItems.Pop();
                            this.state    = (this.openItem == OpenItem.None) ? State.None : State.Separator;
                            break;

                        default:
                            throw this.ParseException(this.token, Resources.Parser_ExpectedCommaOrBracket);
                        }
                        break;

                    default:         // must be OpenItem.Object
                        switch (this.token.Type)
                        {
                        case TokenType.Comma:
                            this.state = State.Key;
                            break;

                        case TokenType.CloseCurly:
                            item          = new Item(ItemType.ObjectEnd);
                            this.openItem = this.openItems.Pop();
                            this.state    = (this.openItem == OpenItem.None) ? State.None : State.Separator;
                            break;

                        default:
                            throw this.ParseException(this.token, Resources.Parser_ExpectedCommaOrCurly);
                        }
                        break;
                    }
                    break;

                case State.None:
                    switch (this.token.Type)
                    {
                    case TokenType.None:
                        item = new Item(ItemType.End);
                        break;

                    default:
                        throw this.ParseException(this.token, Resources.Parser_UnexpectedValue);
                    }
                    break;
                }
            }

            return(item);
        }
        public void MobileSearchByPartName()
        {
            //Actions actions = new Actions(driver);
            IWebElement OpenItem;
            String      bodyTextProduct;

            helperTest.LoginToSiteMobile(driver, authUrl, homeUrl, login, password, mainURL);

            helperTest.waitElementId(driver, 60, "open-category-panel-button");

            Assert.AreEqual(homeUrl, driver.Url);

            helperTest.waitElementId(driver, 60, "search");
            IWebElement SearchBox = driver.FindElement(By.Id("search"));

            SearchBox.Clear();
            SearchBox.SendKeys("ALC-9460-E");

            helperTest.waitElementXpath(driver, 60, "/html/body/app-root/app-header/nav/div[2]/app-search-panel/div/div/div/app-search-panel-dropdown/div[1]/div/div/div[2]/div/p[2]/span[1]");
            OpenItem = driver.FindElement((By.XPath("/html/body/app-root/app-header/nav/div[2]/app-search-panel/div/div/div/app-search-panel-dropdown/div[1]/div/div/div[2]/div/p[2]/span[1]")));
            OpenItem.Click();

            helperTest.waitElementXpath(driver, 60, "/html/body/app-root/div[13]/app-product/div[1]/div/p[1]");

            Thread.Sleep(2000);

            bodyTextProduct = driver.FindElement(By.XPath("/html/body/app-root/div[13]/app-product/div[1]/div/p[1]")).Text;
            Assert.IsTrue(bodyTextProduct.Contains("Alpha Classic® Liner"));

            helperTest.UseDropDownByName(driver, "/html/body/app-root/div/app-product/div[1]/div/div[2]/app-attributes/form/div/div[1]/select", "Cushion");
            helperTest.UseDropDownByName(driver, "/html/body/app-root/div/app-product/div[1]/div/div[2]/app-attributes/form/div/div[2]/select", "Medium");
            helperTest.UseDropDownByName(driver, "/html/body/app-root/div/app-product/div[1]/div/div[2]/app-attributes/form/div/div[3]/select", "Contoured");
            helperTest.UseDropDownByName(driver, "/html/body/app-root/div/app-product/div[1]/div/div[2]/app-attributes/form/div/div[4]/select", "6 mm");
            helperTest.UseDropDownByName(driver, "/html/body/app-root/div/app-product/div[1]/div/div[2]/app-attributes/form/div/div[5]/select", "Buff");
            helperTest.UseDropDownByName(driver, "/html/body/app-root/div/app-product/div[1]/div/div[2]/app-attributes/form/div/div[6]/select", "Spirit");
            helperTest.UseDropDownByName(driver, "/html/body/app-root/div/app-product/div[1]/div/div[2]/app-attributes/form/div/div[7]/select", "Without Umbrella");

            helperTest.waitElementId(driver, 60, "mobile-add-to-cart");
            OpenItem = driver.FindElement((By.Id("mobile-add-to-cart")));
            OpenItem.Click();

            helperTest.waitElementXpath(driver, 60, "/html/body/app-root/div[13]/app-cart-root/div/div/app-shopping-cart/app-shopping-cart-common/section/section/article/div[2]/app-cart-product-order/section/article[1]/app-product-card-cart/article/div[2]/p[2]");
            bodyTextProduct = driver.FindElement(By.XPath("/html/body/app-root/div[13]/app-cart-root/div/div/app-shopping-cart/app-shopping-cart-common/section/section/article/div[2]/app-cart-product-order/section/article[1]/app-product-card-cart/article/div[2]/p[2]")).Text;

            Assert.IsTrue(bodyTextProduct.Contains("ALC-9460-E"));

            Thread.Sleep(3000);

            helperTest.waitElementId(driver, 60, "search");
            SearchBox = driver.FindElement(By.Id("search"));

            SearchBox.Clear();
            SearchBox.SendKeys("ALC-5067-E");

            Thread.Sleep(3000);

            helperTest.waitElementXpath(driver, 60, "/html/body/app-root/app-header/nav/div[2]/app-search-panel/div/div/div/app-search-panel-dropdown/div[1]/div/div/div[2]/div/p[2]/span[1]");
            OpenItem = driver.FindElement((By.XPath("/html/body/app-root/app-header/nav/div[2]/app-search-panel/div/div/div/app-search-panel-dropdown/div[1]/div/div/div[2]/div/p[2]/span[1]")));
            OpenItem.Click();

            Thread.Sleep(3000);

            helperTest.waitElementXpath(driver, 60, "/html/body/app-root/div/app-product/div[1]/div/p[1]");
            bodyTextProduct = driver.FindElement(By.XPath("/html/body/app-root/div/app-product/div[1]/div/p[1]")).Text;
            Assert.IsTrue(bodyTextProduct.Contains("Alpha Classic® Liner"));

            helperTest.UseDropDownByName(driver, "/html/body/app-root/div/app-product/div[1]/div/div[2]/app-attributes/form/div/div[1]/select", "Cushion");
            helperTest.UseDropDownByName(driver, "/html/body/app-root/div/app-product/div[1]/div/div[2]/app-attributes/form/div/div[2]/select", "Extra Large");
            helperTest.UseDropDownByName(driver, "/html/body/app-root/div/app-product/div[1]/div/div[2]/app-attributes/form/div/div[3]/select", "Uniform");
            helperTest.UseDropDownByName(driver, "/html/body/app-root/div/app-product/div[1]/div/div[2]/app-attributes/form/div/div[4]/select", "6 mm");
            helperTest.UseDropDownByName(driver, "/html/body/app-root/div/app-product/div[1]/div/div[2]/app-attributes/form/div/div[5]/select", "Green/Grey");
            helperTest.UseDropDownByName(driver, "/html/body/app-root/div/app-product/div[1]/div/div[2]/app-attributes/form/div/div[6]/select", "Original");
            helperTest.UseDropDownByName(driver, "/html/body/app-root/div/app-product/div[1]/div/div[2]/app-attributes/form/div/div[7]/select", "Without Umbrella");

            Thread.Sleep(3000);

            helperTest.waitElementId(driver, 60, "mobile-add-to-cart");
            OpenItem = driver.FindElement(By.Id("mobile-add-to-cart"));
            OpenItem.Click();

            helperTest.waitElementXpath(driver, 60, "/html/body/app-root/div[13]/app-cart-root/div/div/app-shopping-cart/app-shopping-cart-common/section/section/article/div[2]/app-cart-product-order/section/article[1]/app-product-card-cart/article/div[2]/p[2]");
            bodyTextProduct = driver.FindElement(By.XPath("/html/body/app-root/div[13]/app-cart-root/div/div/app-shopping-cart/app-shopping-cart-common/section/section/article/div[2]/app-cart-product-order/section/article[1]/app-product-card-cart/article/div[2]/p[2]")).Text;

            Assert.IsTrue(bodyTextProduct.Contains("ALC-5067-E"));

            Thread.Sleep(3000);

            for (int j = 0; j < 2; j++)
            {
                helperTest.JsClickElement(driver, "/html/body/app-root/div/app-cart-root/div/div/app-shopping-cart/app-shopping-cart-common/section/section/article/div[2]/app-cart-product-order[1]/section/article[4]/div[3]/div/app-tag-button[1]/span/span");

                Thread.Sleep(1000);
            }
        }