Exemplo n.º 1
0
        protected void Unnamed_CheckedChanged(object sender, EventArgs e)
        {
            var cb = sender as CheckBox;

            if (cb.Checked)
            {
                foreach (var ass in Session["CheckIn"] as List <Asset> )
                {
                    if (ass.AssetNumber == cb.ID)
                    {
                        ass.IsDamaged = true;
                        AssetController.UpdateAsset(ass);
                    }
                }
                this.UpdateAll();
            }
            else
            {
                foreach (var ass in Session["CheckIn"] as List <Asset> )
                {
                    if (ass.AssetNumber == cb.ID)
                    {
                        ass.IsDamaged = false;
                        AssetController.UpdateAsset(ass);
                    }
                }
                this.UpdateAll();
            }
        }
Exemplo n.º 2
0
 protected void FinalizeCheckIn(List <Asset> assets)
 {
     try
     {
         foreach (var asset in assets)
         {
             asset.IsOut = false;
             var history = asset.Clone() as Asset;
             history.IsHistoryItem = true;
             asset.History.History.Add(history);
             asset.ShipTo          = "";
             asset.PersonShipping  = "";
             asset.ServiceEngineer = "";
             asset.DateRecieved    = DateTime.Now;
             //save
             Asset rem = null;
             foreach (var a in Global.Library.Assets)
             {
                 if (a.AssetNumber == asset.AssetNumber)
                 {
                     rem = a;
                 }
             }
             if (rem != null)
             {
                 Global.Library.Assets.Remove(rem);
                 Global.Library.Assets.Add(asset);
             }
             AssetController.UpdateAsset(asset);
         }
         Session["CheckIn"] = new List <Asset>();
     }
     catch {}
 }
Exemplo n.º 3
0
        protected void UpdateView(string view, object datasource = null)
        {
            if (datasource == null)
            {
                datasource = AssetController.GetAllAssets();
            }
            switch (view)
            {
            case "list":
                AssetViewRepeater.HeaderTemplate = Page.LoadTemplate("/Account/Templates/av_default_header_template.ascx");
                AssetViewRepeater.ItemTemplate   = Page.LoadTemplate("/Account/Templates/av_default_template.ascx");
                AssetViewRepeater.FooterTemplate = Page.LoadTemplate("/Account/Templates/av_default_footer_template.ascx");
                AssetViewRepeater.DataSource     = datasource;
                AssetViewRepeater.DataBind();
                Session["CurrentAvView"] = avSelectedView.Text;
                break;

            case "detail":

                break;

            case "smtile":
                AssetViewRepeater.ItemTemplate = Page.LoadTemplate("/Account/Templates/av_list_template.ascx");
                AssetViewRepeater.DataSource   = datasource;
                AssetViewRepeater.DataBind();
                Session["CurrentAvView"] = avSelectedView.Text;
                break;

            case "mdtile":
                AssetViewRepeater.HeaderTemplate = Page.LoadTemplate("/Account/Templates/av_header_template.ascx");
                AssetViewRepeater.ItemTemplate   = Page.LoadTemplate("/Account/Templates/av_sm_tile_template.ascx");
                AssetViewRepeater.FooterTemplate = Page.LoadTemplate("/Account/Templates/av_footer_template.ascx");
                AssetViewRepeater.DataSource     = datasource;
                AssetViewRepeater.DataBind();
                Session["CurrentAvView"] = avSelectedView.Text;
                break;

            case "lgtile":
                AssetViewRepeater.HeaderTemplate = Page.LoadTemplate("/Account/Templates/av_header_template.ascx");
                AssetViewRepeater.ItemTemplate   = Page.LoadTemplate("/Account/Templates/av_sm_tile_template.ascx");
                AssetViewRepeater.FooterTemplate = Page.LoadTemplate("/Account/Templates/av_footer_template.ascx");
                AssetViewRepeater.DataSource     = datasource;
                AssetViewRepeater.DataBind();
                Session["CurrentAvView"] = avSelectedView.Text;
                break;

            default:
                AssetViewRepeater.HeaderTemplate = Page.LoadTemplate("/Account/Templates/av_default_header_template.ascx");
                AssetViewRepeater.ItemTemplate   = Page.LoadTemplate("/Account/Templates/av_default_template.ascx");
                AssetViewRepeater.FooterTemplate = Page.LoadTemplate("/Account/Templates/av_default_footer_template.ascx");
                AssetViewRepeater.DataSource     = datasource;
                AssetViewRepeater.DataBind();
                Session["CurrentAvView"] = avSelectedView.Text;
                break;
            }
        }
Exemplo n.º 4
0
        private void FinalizeAssets(List <Asset> assets)
        {
            List <Asset> emaillist = new List <Asset>();

            foreach (var A in assets)
            {
                A.ShipTo          = Session["Customer"] as string;
                A.ServiceEngineer = Session["Engineer"] as string;
                try
                {
                    var t = Session["Ordernumber"] as string;
                    if (t != null)
                    {
                        A.OrderNumber = t;
                    }
                }
                catch {
                    ShowError("Could Not Add Order Number To Asset: " + A.AssetNumber);
                }
                A.DateShipped    = DateTime.Now;
                A.PackingSlip    = Session["LastPackingSlip"] as string;
                A.PersonShipping = Session["Shipper"] as string;
                A.UpsLabel       = Session["ShippingLabelPdf"] as string;
                A.IsOut          = true;
                Asset rem = null;
                foreach (var a in Global.Library.Assets)
                {
                    if (a.AssetNumber == A.AssetNumber)
                    {
                        rem = a;
                    }
                }
                if (rem != null)
                {
                    Global.Library.Assets.Remove(rem);
                    Global.Library.Assets.Add(A);
                }
                emaillist.Add(A);

                //UPDATE ASSET IN SQL
                AssetController.UpdateAsset(A.Clone() as Asset);
            }
            if (!Global.Library.Settings.TESTMODE)
            {
                Session["Customer"]    = null;
                Session["Shipper"]     = null;
                Session["Engineer"]    = null;
                Session["Ordernumber"] = null;
            }
            NotifyCheckoutEmail(emaillist);
        }
Exemplo n.º 5
0
 protected void ViewAll_Click(object sender, EventArgs e)
 {
     UpdateView((Session["CurrentAvView"] as string), AssetController.GetAllAssets());
 }
Exemplo n.º 6
0
        protected void FilterCalibrated_Click(object sender, EventArgs e)
        {
            var ret = from a in AssetController.GetAllAssets() where a.IsCalibrated == true select a;

            UpdateView((Session["CurrentAvView"] as string), ret.ToList());
        }
Exemplo n.º 7
0
        private List <Asset> AssetSearch(string SearchTerm, string SearchFilter = "asset")
        {
            try
            {
                List <Asset> Results = new List <Asset>();
                if (SearchFilter.ToLower() == "asset")
                {
                    foreach (var asset in AssetController.GetAllAssets())
                    {
                        try
                        {
                            if (asset.AssetNumber != null)
                            {
                                if (asset.AssetNumber.ToUpper().Contains(SearchTerm.ToUpper()))
                                {
                                    if (!Results.Contains(asset))
                                    {
                                        Results.Add((Asset)asset.Clone());
                                    }
                                }
                            }
                        }
                        catch
                        {
                        }
                        try
                        {
                            if (asset.AssetName != null)
                            {
                                if (asset.AssetName.ToUpper().Contains(SearchTerm.ToUpper()))
                                {
                                    if (!Results.Contains(asset))
                                    {
                                        Results.Add((Asset)asset.Clone());
                                    }
                                }
                            }
                        }
                        catch
                        {
                        }
                        try
                        {
                            if (asset.Description != null)
                            {
                                if (asset.Description.ToUpper().Contains(SearchTerm.ToUpper()))
                                {
                                    if (!Results.Contains(asset))
                                    {
                                        Results.Add((Asset)asset.Clone());
                                    }
                                }
                            }
                        }
                        catch
                        {
                        }
                        try
                        {
                            if (asset.ShipTo != null)
                            {
                                if (asset.ShipTo.ToUpper().Contains(SearchTerm.ToUpper()))
                                {
                                    if (!Results.Contains(asset))
                                    {
                                        Results.Add((Asset)asset.Clone());
                                    }
                                }
                            }
                        }
                        catch
                        {
                        }
                        try
                        {
                            if (asset.ServiceEngineer != null)
                            {
                                if (asset.ServiceEngineer.ToUpper().Contains(SearchTerm.ToUpper()))
                                {
                                    if (!Results.Contains(asset))
                                    {
                                        Results.Add((Asset)asset.Clone());
                                    }
                                }
                            }
                        }
                        catch
                        {
                        }
                        try
                        {
                            if (asset.PersonShipping != null)
                            {
                                if (asset.PersonShipping.ToUpper().Contains(SearchTerm.ToUpper()))
                                {
                                    if (!Results.Contains(asset))
                                    {
                                        Results.Add((Asset)asset.Clone());
                                    }
                                }
                            }
                        }
                        catch
                        {
                        }
                        try
                        {
                            if (asset.OrderNumber != "-1")
                            {
                                if (asset.OrderNumber.ToString().ToUpper().Contains(SearchTerm.ToUpper()))
                                {
                                    if (!Results.Contains(asset))
                                    {
                                        Results.Add((Asset)asset.Clone());
                                    }
                                }
                            }
                        }
                        catch
                        {
                        }
                    }
                    return(Results);
                }
                if (SearchFilter.ToLower() == "history")
                {
                    foreach (var aaa in AssetController.GetAllAssets())
                    {
                        try
                        {
                            foreach (var asset in aaa.History.History)
                            {
                                try
                                {
                                    if (asset.AssetNumber != null)
                                    {
                                        if (asset.AssetNumber.ToUpper().Contains(SearchTerm.ToUpper()))
                                        {
                                            if (!Results.Contains(asset))
                                            {
                                                Results.Add((Asset)asset.Clone());
                                            }
                                        }
                                    }
                                }
                                catch
                                {
                                }
                                try
                                {
                                    if (asset.AssetName != null)
                                    {
                                        if (asset.AssetName.ToUpper().Contains(SearchTerm.ToUpper()))
                                        {
                                            if (!Results.Contains(asset))
                                            {
                                                Results.Add((Asset)asset.Clone());
                                            }
                                        }
                                    }
                                }
                                catch
                                {
                                }
                                try
                                {
                                    if (asset.Description != null)
                                    {
                                        if (asset.Description.ToUpper().Contains(SearchTerm.ToUpper()))
                                        {
                                            if (!Results.Contains(asset))
                                            {
                                                Results.Add((Asset)asset.Clone());
                                            }
                                        }
                                    }
                                }
                                catch
                                {
                                }
                                try
                                {
                                    if (asset.ShipTo != null)
                                    {
                                        if (asset.ShipTo.ToUpper().Contains(SearchTerm.ToUpper()))
                                        {
                                            if (!Results.Contains(asset))
                                            {
                                                Results.Add((Asset)asset.Clone());
                                            }
                                        }
                                    }
                                }
                                catch
                                {
                                }
                                try
                                {
                                    if (asset.ServiceEngineer != null)
                                    {
                                        if (asset.ServiceEngineer.ToUpper().Contains(SearchTerm.ToUpper()))
                                        {
                                            if (!Results.Contains(asset))
                                            {
                                                Results.Add((Asset)asset.Clone());
                                            }
                                        }
                                    }
                                }
                                catch
                                {
                                }
                                try
                                {
                                    if (asset.PersonShipping != null)
                                    {
                                        if (asset.PersonShipping.ToUpper().Contains(SearchTerm.ToUpper()))
                                        {
                                            if (!Results.Contains(asset))
                                            {
                                                Results.Add((Asset)asset.Clone());
                                            }
                                        }
                                    }
                                }
                                catch
                                {
                                }
                                try
                                {
                                    if (asset.OrderNumber != "-1")
                                    {
                                        if (asset.OrderNumber.ToString().ToUpper().Contains(SearchTerm.ToUpper()))
                                        {
                                            if (!Results.Contains(asset))
                                            {
                                                Results.Add((Asset)asset.Clone());
                                            }
                                        }
                                    }
                                }
                                catch
                                {
                                }
                            }
                        }
                        catch { }
                    }
                    foreach (var item in Results)
                    {
                        item.IsHistoryItem = true;
                    }
                    return(Results);
                }

                if (SearchFilter == "Date")
                {
                    return(Results);
                }
            }
            catch { }
            return(new List <Asset>());
        }