private void AddSystemsGroupClick(object sender, RoutedEventArgs e)
        {
            systems.SelectedItem =
                SystemsList.AddNewSystemGroup("New System", "New System Description");

            systemGroupNomenclature.Focus();
        }
        private void AddEquipmentGroupClick(object sender, RoutedEventArgs e)
        {
            var oldSelectedSystemsGroup = (SystemGroup)systems.SelectedItem;
            var newEquipmentGroup       =
                SystemsList.AddNewEquipmentGroup((SystemGroup)systems.SelectedItem,
                                                 "New Equipment Group", "New Equipment Group Description");

            systems.SelectedItem         = SystemsList.GetSystemsList().First(s => s.Id == oldSelectedSystemsGroup.Id);
            equipmentGroups.SelectedItem = newEquipmentGroup;

            equipmentGroupTitle.Focus();
        }
        private void AddEquipmentClick(object sender, RoutedEventArgs e)
        {
            var oldSelectedSystemGroup    = (SystemGroup)systems.SelectedItem;
            var oldSelectedEquipmentGroup = (EquipmentGroup)equipmentGroups.SelectedItem;

            var newEquipment =
                SystemsList.AddNewEquipment((EquipmentGroup)equipmentGroups.SelectedItem,
                                            "New Equipment", "New Equipment Description");


            systems.SelectedItem         = SystemsList.GetSystemsList().First(s => s.Id == oldSelectedSystemGroup.Id);
            equipmentGroups.SelectedItem = ((SystemGroup)systems.SelectedItem).EquipmentGroups.First(eg => eg.Id == oldSelectedEquipmentGroup.Id);
            equipment.SelectedItem       = newEquipment;

            equipmentNomenclature.Focus();
        }
Beispiel #4
0
 /// <summary>
 /// Supprime un système de la liste des systèmes
 /// </summary>
 /// <param name="s">Le système qui va etre supprimé dans la liste</param>
 private void RemoveSystem(ISystem s)
 {
     SystemsList.Remove(s);
 }
Beispiel #5
0
 /// <summary>
 /// Ajoute un système a la liste des systèmes
 /// </summary>
 /// <param name="s">Le système qui va etre ajouté dans la liste</param>
 private void AddSystem(ISystem s)
 {
     SystemsList.Add(s);
 }
Beispiel #6
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            if (!IsPostBack)
            {
                if (!Request.IsAuthenticated || LUser == null || LUser.LoginName.ToLower() == "anonymous")
                {
                    string loginUrl = System.Web.Security.FormsAuthentication.LoginUrl;
                    if (string.IsNullOrEmpty(loginUrl))
                    {
                        loginUrl = "~/MyAccount.aspx";
                    }
                    SignIn.Visible        = true; SignIn.NavigateUrl = loginUrl + (loginUrl.Contains("?") ? "&" : "?") + "logo=N";
                    SignoutPanel.Visible  = false;
                    cLoginName.Visible    = false;
                    cAppDomainUrl.Visible = false;
                    return;
                }
                else
                {
                    string extAppDomainUrl =
                        !string.IsNullOrWhiteSpace(System.Configuration.ConfigurationManager.AppSettings["ExtBaseUrl"])
                            ? System.Configuration.ConfigurationManager.AppSettings["ExtBaseUrl"]
                            : Request.Url.AbsoluteUri.Replace(Request.Url.Query, "").Replace(Request.Url.Segments[Request.Url.Segments.Length - 1], "");
                    cAppDomainUrl.Text    = extAppDomainUrl.EndsWith("/") ? extAppDomainUrl.Substring(0, extAppDomainUrl.Length - 1) : extAppDomainUrl;
                    cAppDomainUrl.Visible = true;
                    SignIn.Visible        = false;
                    SignoutPanel.Visible  = true;
                    cLoginName.Text       = LUser.LoginName;
                    cLoginName.Visible    = true;
                }
                if (LUser != null)
                {
                    if (base.LPref != null)
                    {
                        switch (base.LPref.SysListVisible)
                        {
                        case "N":
                            SystemsLabel.Visible = false; SystemsList.Visible = false; SystemsList.Enabled = true; CurrSys.Visible = false; break;

                        case "R":
                            SystemsLabel.Visible = true; SystemsList.Visible = true; SystemsList.Enabled = false; CurrSys.Visible = true; break;

                        default:
                            SystemsLabel.Visible = true; SystemsList.Visible = true; SystemsList.Enabled = true; CurrSys.Visible = true; break;
                        }
                        switch (base.LPref.PrjListVisible)
                        {
                        case "N":
                            ProjectLabel.Visible = false; ProjectList.Visible = false; ProjectList.Enabled = true; CurrPrj.Visible = false; break;

                        case "R":
                            ProjectLabel.Visible = true; ProjectList.Visible = true; ProjectList.Enabled = false; CurrPrj.Visible = true; break;

                        default:
                            ProjectLabel.Visible = true; ProjectList.Visible = true; ProjectList.Enabled = true; CurrPrj.Visible = true; break;
                        }
                        switch (base.LPref.ComListVisible)
                        {
                        case "N":
                            CompanyLabel.Visible = false; CompanyList.Visible = false; CompanyList.Enabled = true; CurrCmp.Visible = false; break;

                        case "R":
                            CompanyLabel.Visible = true; CompanyList.Visible = true; CompanyList.Enabled = false; CurrCmp.Visible = true; break;

                        default:
                            CompanyLabel.Visible = true; CompanyList.Visible = true; CompanyList.Enabled = true; CurrCmp.Visible = true; break;
                        }
                    }

                    CompanyList.Attributes["onchange"] = "javascript:return CanPostBack(true, this);"; CompanyList.Attributes["NeedConfirm"] = "Y";
                    ProjectList.Attributes["onchange"] = "javascript:return CanPostBack(true, this);"; ProjectList.Attributes["NeedConfirm"] = "Y";
                    SystemsList.Attributes["onchange"] = "javascript:return CanPostBack(true, this);"; SystemsList.Attributes["NeedConfirm"] = "Y";

                    UserLabel.Text = LUser != null ? LUser.UsrName : Context.User.Identity.Name;
                    if (LUser.HasPic)
                    {
                        UsrPic.ImageUrl = base.GetUrlWithQSHash("~/DnLoad.aspx?key=" + LUser.UsrId.ToString() + "&tbl=dbo.Usr&knm=UsrId&col=PicMed&sys=3"); UsrPic.Visible = true;
                    }

                    SystemsList.DataSource  = GetSystemsList();
                    CompanyList.DataSource  = GetCompanyList();
                    ProjectList.DataSource  = GetProjectList();
                    TimeZoneList.DataSource = GetTimeZoneList();

                    TranslateItems();

                    this.DataBind();
                    try { SystemsList.SelectedValue = LCurr.SystemId.ToString(); CurrSys.Text = SystemsList.SelectedItem.Text; }
                    catch { }
                    try { CompanyList.SelectedValue = LCurr.CompanyId.ToString(); CurrCmp.Text = CompanyList.SelectedItem.Text; }
                    catch { }
                    try { ProjectList.SelectedValue = LCurr.ProjectId.ToString(); CurrPrj.Text = ProjectList.SelectedItem.Text; }
                    catch { }
                    try { TimeZoneList.SelectedValue = CurrTimeZoneInfo().Id; }
                    catch { }
                    cMyAccountLink.NavigateUrl = System.Web.Security.FormsAuthentication.LoginUrl; // +(Request.QueryString["typ"] != null ? "?typ=" + Request.QueryString["typ"] : "");
                }
            }
            else if (Request.IsAuthenticated && base.LUser != null)     // Get around selectedIndexChange event not triggered because of viewstate-in-session.
            {
                if (SystemsList.Items.Count <= 0 && Request.Params["__EVENTTARGET"] == SystemsList.UniqueID)
                {
                    SystemsList.DataSource    = GetSystemsList(); SystemsList.DataBind();
                    SystemsList.SelectedValue = Request.Params[SystemsList.UniqueID];
                    SystemsList_SelectedIndexChanged(SystemsList, new EventArgs());
                }
                if (CompanyList.Items.Count <= 0 && Request.Params["__EVENTTARGET"] == CompanyList.UniqueID)
                {
                    CompanyList.DataSource    = GetCompanyList(); CompanyList.DataBind();
                    CompanyList.SelectedValue = Request.Params[CompanyList.UniqueID];
                    CompanyList_SelectedIndexChanged(CompanyList, new EventArgs());
                }
                if (ProjectList.Items.Count <= 0 && Request.Params["__EVENTTARGET"] == ProjectList.UniqueID)
                {
                    ProjectList.DataSource    = GetProjectList(); ProjectList.DataBind();
                    ProjectList.SelectedValue = Request.Params[ProjectList.UniqueID];
                    ProjectList_SelectedIndexChanged(ProjectList, new EventArgs());
                }
            }
        }
 private void DeleteSystemClick(object sender, RoutedEventArgs e)
 {
     SystemsList.Delete((SystemGroup)systems.SelectedItem);
 }
 public EquipmentManagementConsole()
 {
     InitializeComponent();
     systems.ItemsSource = SystemsList.GetSystemsList();
 }
Beispiel #9
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            if (!IsPostBack)
            {
                string extAppDomainUrl =
                    !string.IsNullOrWhiteSpace(Config.ExtBaseUrl)
                        ? Config.ExtBaseUrl
                        : string.IsNullOrEmpty(Request.Url.Query) ? Request.Url.AbsoluteUri.Replace(Request.Url.Segments[Request.Url.Segments.Length - 1], "")
                        : Request.Url.AbsoluteUri.Replace(Request.Url.Query, "").Replace(Request.Url.Segments[Request.Url.Segments.Length - 1], "");
                cAppDomainUrl.Text = extAppDomainUrl.EndsWith("/") ? extAppDomainUrl.Substring(0, extAppDomainUrl.Length - 1) : extAppDomainUrl;
                if (!Request.IsAuthenticated || LUser == null || LUser.LoginName.ToLower() == "anonymous")
                {
                    string loginUrl = System.Web.Security.FormsAuthentication.LoginUrl;
                    if (string.IsNullOrEmpty(loginUrl))
                    {
                        loginUrl = "~/MyAccount.aspx";
                    }
                    SignIn.Visible       = true; SignIn.NavigateUrl = loginUrl + (loginUrl.Contains("?") ? "&" : "?") + "logo=N";
                    SignoutPanel.Visible = false;
                    cLoginName.Visible   = false;
                    // for client side login sync between React and asp.net(only when served under the same app tree
                    // this controls react/asp.net login sync for 'showpage' like usage, turn this off would disable auto login(from react token) in show page and other public page
                    cAppDomainUrl.Visible = true;
                    return;
                }
                else
                {
                    cAppDomainUrl.Visible = true;
                    SignIn.Visible        = false;
                    SignoutPanel.Visible  = true;
                    cLoginName.Text       = LUser.LoginName;
                    cLoginName.Visible    = true;
                }
                if (LUser != null)
                {
                    if (base.LPref != null)
                    {
                        switch (base.LPref.SysListVisible)
                        {
                        case "N":
                            SystemsLabel.Visible = false; SystemsList.Visible = false; SystemsList.Enabled = true; CurrSys.Visible = false; break;

                        case "R":
                            SystemsLabel.Visible = true; SystemsList.Visible = true; SystemsList.Enabled = false; CurrSys.Visible = true; break;

                        default:
                            SystemsLabel.Visible = true; SystemsList.Visible = true; SystemsList.Enabled = true; CurrSys.Visible = true; break;
                        }
                        switch (base.LPref.PrjListVisible)
                        {
                        case "N":
                            ProjectLabel.Visible = false; ProjectList.Visible = false; ProjectList.Enabled = true; CurrPrj.Visible = false; break;

                        case "R":
                            ProjectLabel.Visible = true; ProjectList.Visible = true; ProjectList.Enabled = false; CurrPrj.Visible = true; break;

                        default:
                            ProjectLabel.Visible = true; ProjectList.Visible = true; ProjectList.Enabled = true; CurrPrj.Visible = true; break;
                        }
                        switch (base.LPref.ComListVisible)
                        {
                        case "N":
                            CompanyLabel.Visible = false; CompanyList.Visible = false; CompanyList.Enabled = true; CurrCmp.Visible = false; break;

                        case "R":
                            CompanyLabel.Visible = true; CompanyList.Visible = true; CompanyList.Enabled = false; CurrCmp.Visible = true; break;

                        default:
                            CompanyLabel.Visible = true; CompanyList.Visible = true; CompanyList.Enabled = true; CurrCmp.Visible = true; break;
                        }
                    }

                    CompanyList.Attributes["onchange"] = "javascript:return CanPostBack(true, this);"; CompanyList.Attributes["NeedConfirm"] = "Y";
                    ProjectList.Attributes["onchange"] = "javascript:return CanPostBack(true, this);"; ProjectList.Attributes["NeedConfirm"] = "Y";
                    SystemsList.Attributes["onchange"] = "javascript:return CanPostBack(true, this);"; SystemsList.Attributes["NeedConfirm"] = "Y";

                    UserLabel.Text = LUser != null ? LUser.UsrName : Context.User.Identity.Name;
                    if (LUser.HasPic)
                    {
                        UsrPic.ImageUrl = base.GetUrlWithQSHash("~/DnLoad.aspx?key=" + LUser.UsrId.ToString() + "&tbl=dbo.Usr&knm=UsrId&col=PicMed&sys=3"); UsrPic.Visible = true;
                    }


                    SystemsList.DataSource = GetSystemsList();
                    if (LCurr != null && LUser != null)
                    {
                        DataTable dtSystem = GetCompanyProf();
                        if (dtSystem != null && dtSystem.Rows.Count > 0)
                        {
                            string   logo     = dtSystem.Rows[0]["CompanyLogo"].ToString();
                            string   systemLs = dtSystem.Rows[0]["SystemLs"].ToString();
                            DataView dv       = GetSystemsList();
                            if (!string.IsNullOrEmpty(systemLs) && systemLs != "()")
                            {
                                dv.RowFilter           = "Active='Y' AND SystemId IN " + systemLs;
                                SystemsList.DataSource = dv;
                            }
                        }
                    }
                    CompanyList.DataSource  = GetCompanyList();
                    ProjectList.DataSource  = GetProjectList();
                    TimeZoneList.DataSource = GetTimeZoneList();

                    TranslateItems();

                    this.DataBind();
                    try { SystemsList.SelectedValue = LCurr.SystemId.ToString(); CurrSys.Text = SystemsList.SelectedItem.Text; }
                    catch { }
                    try { CompanyList.SelectedValue = LCurr.CompanyId.ToString(); CurrCmp.Text = CompanyList.SelectedItem.Text; }
                    catch { }
                    try { ProjectList.SelectedValue = LCurr.ProjectId.ToString(); CurrPrj.Text = ProjectList.SelectedItem.Text; }
                    catch { }
                    try { TimeZoneList.SelectedValue = CurrTimeZoneInfo().Id; }
                    catch { }
                    cMyAccountLink.NavigateUrl = System.Web.Security.FormsAuthentication.LoginUrl; // +(Request.QueryString["typ"] != null ? "?typ=" + Request.QueryString["typ"] : "");
                }
            }
            else if (Request.IsAuthenticated && base.LUser != null)     // Get around selectedIndexChange event not triggered because of viewstate-in-session.
            {
                if (SystemsList.Items.Count <= 0 && Request.Params["__EVENTTARGET"] == SystemsList.UniqueID)
                {
                    SystemsList.DataSource    = GetSystemsList(); SystemsList.DataBind();
                    SystemsList.SelectedValue = Request.Params[SystemsList.UniqueID];
                    SystemsList_SelectedIndexChanged(SystemsList, new EventArgs());
                }
                if (CompanyList.Items.Count <= 0 && Request.Params["__EVENTTARGET"] == CompanyList.UniqueID)
                {
                    CompanyList.DataSource    = GetCompanyList(); CompanyList.DataBind();
                    CompanyList.SelectedValue = Request.Params[CompanyList.UniqueID];
                    CompanyList_SelectedIndexChanged(CompanyList, new EventArgs());
                }
                if (ProjectList.Items.Count <= 0 && Request.Params["__EVENTTARGET"] == ProjectList.UniqueID)
                {
                    ProjectList.DataSource    = GetProjectList(); ProjectList.DataBind();
                    ProjectList.SelectedValue = Request.Params[ProjectList.UniqueID];
                    ProjectList_SelectedIndexChanged(ProjectList, new EventArgs());
                }
            }
        }