Пример #1
0
 public static void SetValidation_Border(this ASPxEdit ctrlEdit, string validationGroup, bool isRequired, string reqErrorText)
 {
     ctrlEdit.SetValidationBase_Border(validationGroup);
     ctrlEdit.SetRequired(isRequired, reqErrorText);
 }
Пример #2
0
 public static void SetValidation(this ASPxEdit ctrlEdit, string validationGroup, bool isRequired)
 {
     ctrlEdit.SetValidation(validationGroup, isRequired, "กรุณากรอกข้อมูล");
 }
Пример #3
0
 public static void SetValidationNoText(this ASPxEdit ctrlEdit, string validationGroup)
 {
     ctrlEdit.SetValidationBase(validationGroup);
     ctrlEdit.SetRequired(true, " ");
 }
Пример #4
0
        /// <summary>
        /// This method executes when the user clicks the save button for the programs
        /// and it saves the program information to the database
        /// </summary>
        /// <param name="sender">The submitProgram control</param>
        /// <param name="e">The Click event</param>
        protected void submitProgram_Click(object sender, EventArgs e)
        {
            if (ASPxEdit.AreEditorsValid(this, submitProgram.ValidationGroup))
            {
                //Get the program information
                int programPK = Convert.ToInt32(hfAddEditProgramPK.Value);

                using (PyramidContext context = new PyramidContext())
                {
                    Program currentProgram;
                    //Check to see if this is an add or an edit
                    if (programPK == 0)
                    {
                        //Add
                        currentProgram                  = new Program();
                        currentProgram.ProgramName      = txtProgramName.Value.ToString();
                        currentProgram.Location         = txtProgramLocation.Value.ToString();
                        currentProgram.ProgramStartDate = (Convert.ToDateTime(deProgramStartDate.Value));
                        currentProgram.ProgramEndDate   = (deProgramEndDate.Value == null ? (DateTime?)null : Convert.ToDateTime(deProgramEndDate.Value));
                        currentProgram.CohortFK         = Convert.ToInt32(ddProgramCohort.Value);
                        currentProgram.HubFK            = Convert.ToInt32(ddProgramHub.Value);
                        currentProgram.StateFK          = Convert.ToInt32(ddProgramState.Value);
                        currentProgram.CreateDate       = DateTime.Now;
                        currentProgram.Creator          = User.Identity.Name;

                        //Save to the database
                        context.Program.Add(currentProgram);
                        context.SaveChanges();

                        //Clear the program type rows
                        var currentProgramTypes = context.ProgramType.Where(pt => pt.ProgramFK == currentProgram.ProgramPK).ToList();
                        context.ProgramType.RemoveRange(currentProgramTypes);

                        //Save the program type rows
                        foreach (BootstrapListEditItem item in lstBxProgramType.Items)
                        {
                            if (item.Selected)
                            {
                                ProgramType newProgramType = new ProgramType();
                                newProgramType.CreateDate = DateTime.Now;
                                newProgramType.Creator    = User.Identity.Name;
                                newProgramType.ProgramFK  = currentProgram.ProgramPK;
                                newProgramType.TypeCodeFK = Convert.ToInt32(item.Value);
                                context.ProgramType.Add(newProgramType);
                            }
                        }
                        context.SaveChanges();

                        //Show a success message
                        msgSys.ShowMessageToUser("success", "Success", "Successfully added program!", 10000);
                    }
                    else
                    {
                        //Edit
                        currentProgram                  = context.Program.Find(programPK);
                        currentProgram.ProgramName      = txtProgramName.Value.ToString();
                        currentProgram.Location         = txtProgramLocation.Value.ToString();
                        currentProgram.ProgramStartDate = (Convert.ToDateTime(deProgramStartDate.Value));
                        currentProgram.ProgramEndDate   = (deProgramEndDate.Value == null ? (DateTime?)null : Convert.ToDateTime(deProgramEndDate.Value));
                        currentProgram.CohortFK         = Convert.ToInt32(ddProgramCohort.Value);
                        currentProgram.HubFK            = Convert.ToInt32(ddProgramHub.Value);
                        currentProgram.StateFK          = Convert.ToInt32(ddProgramState.Value);
                        currentProgram.EditDate         = DateTime.Now;
                        currentProgram.Editor           = User.Identity.Name;

                        //Clear the program type rows
                        var currentProgramTypes = context.ProgramType.Where(pt => pt.ProgramFK == currentProgram.ProgramPK).ToList();
                        context.ProgramType.RemoveRange(currentProgramTypes);

                        //Save the program type rows
                        foreach (BootstrapListEditItem item in lstBxProgramType.Items)
                        {
                            if (item.Selected)
                            {
                                ProgramType newProgramType = new ProgramType();
                                newProgramType.CreateDate = DateTime.Now;
                                newProgramType.Creator    = User.Identity.Name;
                                newProgramType.ProgramFK  = currentProgram.ProgramPK;
                                newProgramType.TypeCodeFK = Convert.ToInt32(item.Value);
                                context.ProgramType.Add(newProgramType);
                            }
                        }
                        context.SaveChanges();

                        //Show a success message
                        msgSys.ShowMessageToUser("success", "Success", "Successfully edited program!", 10000);
                    }

                    //Reset the values in the hidden field and hide the div
                    hfAddEditProgramPK.Value  = "0";
                    divAddEditProgram.Visible = false;

                    //Re-bind the program controls
                    BindPrograms();
                }
            }
        }
Пример #5
0
        /////2013-09-21 ERP-580 Khoa.Truong INS START
        //protected WarehouseCategoryEntity WarehouseCategoryEntity
        //{
        //    get
        //    {
        //        Guid recordId = Guid.Empty;
        //        try
        //        {
        //            recordId = (Guid)Session["BuyingToolCategoryId"];
        //            if (recordId == Guid.Empty) return null;
        //        }
        //        catch (Exception)
        //        {
        //            return null;
        //        }
        //        WarehouseCategoryEntity buyingToolCategoryEntity;
        //        this.toolBOL.getWarehouseCategoryByKey(recordId, out buyingToolCategoryEntity);
        //        return buyingToolCategoryEntity;
        //    }
        //}
        /////2013-09-20 ERP-580 Khoa.Truong INS END

        protected void popWarehouseCategoryEdit_WindowCallback(object sender, DevExpress.Web.ASPxClasses.CallbackEventArgsBase e)
        {
            string[] args = e.Parameter.Split('|');
            switch (args[0])
            {
            case "new":

                /////2013-09-21 ERP-580 Khoa.Truong INS START
                Session["BuyingToolCategoryId"] = Guid.Empty;
                /////2013-09-21 ERP-580 Khoa.Truong INS END

                frmlInfoGeneral.DataSourceID = null;
                ClearForm();
                //popManufacturerGroupEdit.ShowOnPageLoad = true;
                break;

            case "edit":
                /*frmlActiveElement.DataSourceID = "dsManufacturerCategory";
                 * if (args.Length > 1)
                 * {
                 *  dsManufacturerCategory.CriteriaParameters["ManufacturerCategoryId"].DefaultValue = args[1];
                 * }*/

                /////2013-09-21 ERP-580 Khoa.Truong INS START
                this.ClearForm();
                /////2013-09-21 ERP-580 Khoa.Truong INS END

                //WarehouseCategoryEntity toolEntity;
                Guid guid = new Guid(args[1]);

                /////2013-09-21 ERP-580 Khoa.Truong INS START
                Session["BuyingToolCategoryId"] = guid;
                /////2013-09-21 ERP-580 Khoa.Truong INS END

                //frmlInfoGeneral.DataSource = this.toolBOL.getWarehouseCategoryByKey(guid, out toolEntity);
                //frmlInfoGeneral.DataBind();
                //this.cboManufacturer.SelectedItem.Value = "123";
                //HtmlEditorDescription.Html = toolEntity.Description;

                /////2013-09-21 ERP-580 Khoa.Truong INS START
                //txtCode.Text = toolEntity.Code;
                /////2013-09-21 ERP-580 Khoa.Truong INS END

                break;

            case "save":
                bool   isSuccess   = true;
                string recordIdStr = null;
                try
                {
                    /////2013-09-21 ERP-580 Khoa.Truong INS START
                    //Check validation
                    if (!ASPxEdit.AreEditorsValid(pagWarehouseCategoryEdit, true))
                    {
                        formWarehouseCategoryEdit.JSProperties.Add("cpInvalid", true);
                        pagWarehouseCategoryEdit.ActiveTabIndex = 0;
                        return;
                    }
                    /////2013-09-21 ERP-580 Khoa.Truong INS START

                    //Logic to save data
                    if (args.Length > 1)
                    {
                        //Update mode
                        recordIdStr = args[1];
                        Guid recordId = Guid.Parse(recordIdStr);
                        //WarehouseCategoryEntity entity = new WarehouseCategoryEntity();
                        //entity.WarehouseCategoryId = recordId;
                        //entity.Code = txtCode.Text;
                        //entity.RowStatus = char.Parse(cbRowStatus.SelectedItem.Value.ToString());
                        //entity.Language = Utility.CurrentSession.Instance.Lang;
                        //entity.Name = txtName.Text;
                        //entity.Description = HtmlEditorDescription.Html;
                        //this.toolBOL.updateWarehouseCategory(entity);
                    }
                    else
                    {
                        //Insert mode
                        //WarehouseCategoryEntity entity = new WarehouseCategoryEntity();
                        //entity.Code = txtCode.Text;
                        //entity.Language = Utility.CurrentSession.Instance.Lang;
                        //entity.RowStatus = char.Parse(cbRowStatus.SelectedItem.Value.ToString());
                        //entity.Name = txtName.Text;
                        //entity.Description = HtmlEditorDescription.Html;
                        //toolBOL.insertWarehouseCategory(entity);
                    }

                    //popManufacturerGroupEdit.ShowOnPageLoad = false;
                }
                catch (Exception)
                {
                    isSuccess = false;
                    throw;
                }
                finally
                {
                    OnSaved(new WebModule.Interfaces.FormEditEventArgs()
                    {
                        isSuccess = isSuccess
                    });
                    formWarehouseCategoryEdit.JSProperties.Add("cpCallbackArgs",
                                                               String.Format("{{ \"recordId\": \"{0}\", \"isSuccess\": {1} }}", recordIdStr, isSuccess.ToString().ToLower()));
                }
                break;

            default:
                break;
            }
        }
Пример #6
0
 private static void SetExpression(this ASPxEdit ctrlEdit, string expression, string expErrorText)
 {
     ctrlEdit.ValidationSettings.RegularExpression.ValidationExpression = expression;
     ctrlEdit.ValidationSettings.RegularExpression.ErrorText            = expErrorText;
 }
 private void SetMemberValueOfItem(XPBaseObject item, IModelColumn column, ASPxEdit cellControl){
     if (cellControl is ASPxSpinEdit && ((ASPxSpinEdit) cellControl).NumberType == SpinEditNumberType.Integer)
         item.SetMemberValue(column.PropertyName,
             column.ModelMember.MemberInfo.MemberType == typeof (int)
                 ? Convert.ToInt32(cellControl.Value)
                 : Convert.ToInt64(cellControl.Value));
     else{
         if (typeof (XPBaseObject).IsAssignableFrom(column.ModelMember.MemberInfo.MemberType) &&
             !typeof (IFileData).IsAssignableFrom(column.ModelMember.MemberInfo.MemberType)){
             object o = _objectSpace.GetObjectByKey(column.ModelMember.MemberInfo.MemberType, cellControl.Value);
             item.SetMemberValue(column.PropertyName, o);
         }
         else{
             item.SetMemberValue(column.PropertyName, cellControl.Value);
         }
     }
 }
Пример #8
0
        private void CreateRowForObject(XPBaseObject item, bool focusFirstControl, int rowindex)
        {
            _rowsPerObject[item.GetMemberValue(Model.ModelClass.KeyProperty)] = new List <TableRow>();
            var headerRowsForItem = new List <TableRow>();

            if (!HeadersOnTopOnly)
            {
                headerRowsForItem = CreateHeaderRows(item, rowindex);
                _rowsPerObject[item.GetMemberValue(Model.ModelClass.KeyProperty)].AddRange(headerRowsForItem);
            }

            if (_btnAddFirst != null)
            {
                _btnAddFirst.Visible = false;
            }

            TableRow tr = null;

            var controlsOfRowPerColumn = new Dictionary <string, ASPxEdit>();

            int  i = 0;
            int  headerrowsadded     = 0;
            bool firstControlFocused = false;

            foreach (IModelColumn column in Model.Columns)
            {
                if (column.Index >= 0)
                {
                    if (i % ColumnsPerRow == 0)
                    {
                        if (headerRowsForItem.Count > headerrowsadded)
                        {
                            _table.Rows.Add(headerRowsForItem[headerrowsadded]);
                            headerrowsadded++;
                        }
                        tr = new TableRow {
                            CssClass = rowindex % 2 == 0 ? "evenrow" : "oddrow"
                        };
                        _table.Rows.Add(tr);
                        _rowsPerObject[item.GetMemberValue(Model.ModelClass.KeyProperty)].Add(tr);
                    }
                    i++;

                    var tc = new TableCell();
                    if (tr != null)
                    {
                        tr.Cells.Add(tc);
                    }

                    if (!AllowEdit)
                    {
                        object itemGetMemberValue = item.GetMemberValue(column.PropertyName);
                        if (itemGetMemberValue == null)
                        {
                            tc.Text = "";
                        }
                        else if (itemGetMemberValue is XPBaseObject)
                        {
                            ITypeInfo typeInfo =
                                XafTypesInfo.Instance.FindTypeInfo(
                                    (itemGetMemberValue as XPBaseObject).ClassInfo.ClassType);
                            if (typeInfo.DefaultMember != null)
                            {
                                object defMembVal =
                                    (itemGetMemberValue as XPBaseObject).GetMemberValue(typeInfo.DefaultMember.Name);
                                tc.Text = defMembVal != null?defMembVal.ToString() : "";
                            }
                            else
                            {
                                tc.Text = itemGetMemberValue.ToString();
                            }
                        }
                        else if (itemGetMemberValue is Enum)
                        {
                            {
                                string caption =
                                    new EnumDescriptor(column.ModelMember.MemberInfo.MemberType).GetCaption(
                                        itemGetMemberValue);
                                tc.Text = string.IsNullOrEmpty(column.DisplayFormat)
                                    ? caption
                                    : string.Format(column.DisplayFormat, caption);
                            }
                        }
                        else
                        {
                            if (!string.IsNullOrEmpty(column.DisplayFormat))
                            {
                                tc.Text = string.Format(column.DisplayFormat, itemGetMemberValue);
                            }
                            else if (itemGetMemberValue is decimal)
                            {
                                tc.Text = string.Format("{0:C2}", itemGetMemberValue);
                            }
                            else
                            {
                                tc.Text = itemGetMemberValue.ToString();
                            }
                        }

                        tc.CssClass = "StaticText";
                    }
                    else
                    {
                        ASPxEdit cellControl = GetControlForColumn(column, item);
                        if (!column.AllowEdit)
                        {
                            cellControl.Enabled = false;
                        }

                        //handle control width
                        int tableColumns = Math.Max(Model.Columns.Count(c => c.Index >= 0), ColumnsPerRow);
                        if (cellControl is ASPxCheckBox)
                        {
                            tc.Width = new Unit(1, UnitType.Percentage);
                        }
                        else if (tableColumns > 0)
                        {
                            var value = 100 / tableColumns;
                            tc.Width = new Unit(value, UnitType.Percentage);
                        }

                        cellControl.ID = column.PropertyName + "_control_" +
                                         item.GetMemberValue(Model.ModelClass.KeyProperty)
                                         .ToString()
                                         .Replace("-", "_minus_");
                        cellControl.ValidationSettings.ErrorDisplayMode  = ErrorDisplayMode.ImageWithTooltip;
                        cellControl.ValidationSettings.Display           = Display.Dynamic;
                        cellControl.ValidationSettings.ErrorTextPosition = ErrorTextPosition.Left;
                        cellControl.ValidationSettings.ErrorImage.Url    =
                            ImageLoader.Instance.GetImageInfo("ximage").ImageUrl;

                        controlsOfRowPerColumn.Add(column.PropertyName, cellControl);
                        _baseObjectsHandledByControl[cellControl] = new Tuple <XPBaseObject, string>(item,
                                                                                                     column.PropertyName);

                        tc.Controls.Add(cellControl);

                        if (focusFirstControl && !firstControlFocused)
                        {
                            cellControl.Focus();
                            firstControlFocused = true;
                        }
                    }
                    OnCustomizeAppearance(new CustomizeAppearanceEventArgs(column.PropertyName,
                                                                           new WebControlAppearanceAdapter(tc, tc), item));
                }
            }

            if (tr == null)
            {
                tr = new TableRow {
                    CssClass = rowindex % 2 == 0 ? "evenrow" : "oddrow"
                };
                _table.Rows.Add(tr);
                _rowsPerObject[item.GetMemberValue(Model.ModelClass.KeyProperty)].Add(tr);
            }

            var tcButtons = new TableCell {
                Wrap = false, Width = new Unit(1, UnitType.Percentage)
            };

            if (i % ColumnsPerRow != 0)
            {
                tcButtons.ColumnSpan = ColumnsPerRow - i % ColumnsPerRow;
            }
            else
            {
                tr = new TableRow {
                    CssClass = rowindex % 2 == 0 ? "evenrow" : "oddrow"
                };
                _table.Rows.Add(tr);
                _rowsPerObject[item.GetMemberValue(Model.ModelClass.KeyProperty)].Add(tr);
                //a new row will be created and the whole row will be the buttons
                tcButtons.ColumnSpan = ColumnsPerRow;
            }

            tr.Cells.Add(tcButtons);

            var tblButtons = new Table();

            tcButtons.Controls.Add(tblButtons);
            var btnsrow = new TableRow();

            tblButtons.Rows.Add(btnsrow);

            if (AllowEdit && ShowButtons)
            {
                var btnRemove = new ASPxButton {
                    AutoPostBack = false, EnableClientSideAPI = true
                };

                btnRemove.SetClientSideEventHandler("Click",
                                                    "function(s, e) { " + "CallbackPanel" + Model.Id + ".PerformCallback(\"rem_" +
                                                    item.GetMemberValue(Model.ModelClass.KeyProperty) + "\"); }");
                btnRemove.Text = DeleteButtonCaption;
                btnRemove.ID   = "btnRemove_" + item.GetMemberValue(Model.ModelClass.KeyProperty);

                var t = new TableCell();
                btnsrow.Cells.Add(t);
                t.Controls.Add(btnRemove);
            }

            if (AllowEdit && ShowButtons)
            {
                var btnAdd = new ASPxButton {
                    AutoPostBack = false, EnableClientSideAPI = true
                };

                btnAdd.SetClientSideEventHandler("Click",
                                                 "function(s, e) { " + "CallbackPanel" + Model.Id + ".PerformCallback(\"add\"); }");
                btnAdd.Text = AddButtonCaption;
                btnAdd.ID   = "btnAdd_" + item.GetMemberValue(Model.ModelClass.KeyProperty);

                var t = new TableCell();
                btnsrow.Cells.Add(t);
                t.Controls.Add(btnAdd);
            }
            _controlsPerObjectInList[item.GetMemberValue(Model.ModelClass.KeyProperty)] = controlsOfRowPerColumn;
        }
Пример #9
0
        /////2013-09-25 ERP-607 Khoa.Truong INS END

        /////2013-09-25 ERP-607 Khoa.Truong INS START
        //protected BuyingServiceCategoryEntity BuyingServiceCategoryEntity
        //{
        //    get
        //    {
        //        Guid recordId = Guid.Empty;
        //        try
        //        {
        //            recordId = (Guid)Session["BuyingServiceCategoryId"];
        //            if (recordId == Guid.Empty) return null;
        //        }
        //        catch (Exception)
        //        {
        //            return null;
        //        }
        //        return buyingServiceCategoryBLO.getBuyingServiceCategoryEntity(recordId, Utility.CurrentSession.Instance.Lang);
        //    }
        //}
        /////2013-09-25 ERP-607 Khoa.Truong INS END

        /////2013-09-25 ERP-607 Khoa.Truong INS START
        protected void popBuyingServiceCategory_WindowCallback(object source, DevExpress.Web.ASPxPopupControl.PopupWindowCallbackArgs e)
        {
            string[] args = e.Parameter.Split('|');
            switch (args[0])
            {
            case "new":
                Session["BuyingServiceCategoryId"]    = Guid.Empty;
                frmBuyingServiceCategory.DataSourceID = null;
                ClearForm();
                break;

            case "edit":
                ClearForm();
                frmBuyingServiceCategory.DataSourceID = "dsBuyingServiceCategoryProperty";

                if (args.Length > 1)
                {
                    Guid customerCategoryId = Guid.Parse(args[1]);
                    Session["BuyingServiceCategoryId"] = customerCategoryId;
                    dsBuyingServiceCategoryProperty.CriteriaParameters["BuyingServiceCategoryId"].DefaultValue = customerCategoryId.ToString();
                    dsBuyingServiceCategoryProperty.CriteriaParameters["Language"].DefaultValue = Utility.CurrentSession.Instance.Lang;
                    //HtmlEditorDescription.Html = BuyingServiceCategoryEntity.Description;
                    //txtCode.Text = BuyingServiceCategoryEntity.Code;
                }
                break;

            case "save":
                bool   isSuccess   = true;
                string recordIdStr = null;
                try
                {
                    //Check validation
                    if (!ASPxEdit.AreEditorsValid(pagBuyingServiceCategory, true))
                    {
                        popBuyingServiceCategory.JSProperties.Add("cpInvalid", true);
                        pagBuyingServiceCategory.ActiveTabIndex = 0;
                        return;
                    }
                    //Logic to save data
                    if (args.Length > 1)
                    {
                        //Update mode
                        //recordIdStr = args[1];
                        //Guid recordId = Guid.Parse(recordIdStr);
                        //BuyingServiceCategoryEntity entity = new BuyingServiceCategoryEntity();
                        //entity.BuyingServiceCategoryId = recordId;
                        //entity.Code = txtCode.Text;
                        //entity.RowStatus = char.Parse(cbRowStatus.SelectedItem.Value.ToString());
                        //entity.Language = Utility.CurrentSession.Instance.Lang;
                        //entity.Name = txtName.Text;
                        //entity.Description = HtmlEditorDescription.Html;
                        //buyingServiceCategoryBLO.Update(entity);
                    }
                    else
                    {
                        //Insert mode
                        //BuyingServiceCategoryEntity entity = new BuyingServiceCategoryEntity();
                        //entity.Code = txtCode.Text;
                        //entity.Language = Utility.CurrentSession.Instance.Lang;
                        //entity.RowStatus = char.Parse(cbRowStatus.SelectedItem.Value.ToString());
                        //entity.Name = txtName.Text;
                        //entity.Description = HtmlEditorDescription.Html;
                        //buyingServiceCategoryBLO.Insert(entity);
                    }
                }
                catch (Exception)
                {
                    isSuccess = false;
                    throw;
                }
                finally
                {
                    popBuyingServiceCategory.JSProperties.Add("cpCallbackArgs",
                                                              String.Format("{{ \"recordId\": \"{0}\", \"isSuccess\": {1} }}", recordIdStr, isSuccess.ToString().ToLower()));
                }
                break;

            default:
                break;
            }
        }
Пример #10
0
        protected void KullaniciEditPopup_WindowCallback(object source, DevExpress.Web.PopupWindowCallbackArgs e)
        {
            string kullaniciAdi = e.Parameter.ToString();

            if (kullaniciAdi == null)
            {
                return;
            }
            ASPxEdit editor = GetNestedEditor(EmployeeEditFormLayout, "ParolaAlani");

            if (editor != null)
            {
                if (kullaniciAdi == "")
                {
                    ParolayiDegistir.Visible = false;
                    tbPassword.Visible       = true;
                }
                else
                {
                    ParolayiDegistir.Visible = true;
                    tbPassword.Visible       = false;
                }
            }

            var employee = Membership.GetAllUsers().Cast <MembershipUser>().Where(c => c.UserName == kullaniciAdi).FirstOrDefault(); //DataProvider.Employees.FirstOrDefault(em => em.Id == id);

            if (employee == null)
            {
                KullaniciEditPopup.JSProperties["cpUserKey"]    = null;
                KullaniciEditPopup.JSProperties["cpHeaderText"] = string.Format("Yeni Kullanıcı Oluştur ({0} {1})", "", "");
            }
            else
            {
                ProfileBase curProfile = ProfileBase.Create(kullaniciAdi);

                FirstNameTextBox.Text = curProfile.GetPropertyValue("Ismi").ToString();
                LastNameTextBox.Text  = curProfile.GetPropertyValue("Soyismi").ToString();
                PrefixComboBox.Value  = curProfile.GetPropertyValue("Onek").ToString();
                HireDateEdit.Value    = curProfile.GetPropertyValue("DogumTarihi");

                UserNameTextBox.Text      = employee.UserName;
                tbPassword.Text           = "parola değiştirilemez";
                EmailTextBox.Value        = employee.Email;
                MobileNumberTextBox.Value = curProfile.GetPropertyValue("CepNumarasi");

                BayiKoduComboBox.Value = curProfile.GetPropertyValue("BayiKodu");
                DeptComboBox.Value     = curProfile.GetPropertyValue("DepartmanAdi");
                TitleTextBox.Text      = curProfile.GetPropertyValue("Unvani").ToString();
                ResimAdi = curProfile.GetPropertyValue("ResimAdi").ToString();

                PurchaseAuthorityCheckBox.Checked = employee.IsApproved;

                if (Roles.GetRolesForUser(UserNameTextBox.Text)[0] != null)
                {
                    cmbRole.Value = Roles.GetRolesForUser(kullaniciAdi)[0] != null?Roles.GetRolesForUser(kullaniciAdi)[0].ToString() : "";
                }

                MembershipUser user = Membership.GetUser(employee.UserName);
                chkHesapKiliti.Enabled = user.IsLockedOut;
                chkHesapKiliti.Checked = user.IsLockedOut;

                KullaniciEditPopup.JSProperties["cpUserKey"]    = kullaniciAdi;
                KullaniciEditPopup.JSProperties["cpHeaderText"] = string.Format("Kullanıcı Düzenleme ({0} {1})", curProfile.GetPropertyValue("Ismi").ToString(), curProfile.GetPropertyValue("Soyismi").ToString());
            }
        }
Пример #11
0
 private static void SetValueToControl(object value, ASPxEdit c)
 {
     c.Value = value;
 }
Пример #12
0
 public static void ClearTable(this HtmlTable table)
 {
     ASPxEdit.ClearEditorsInContainer(table);
 }
Пример #13
0
        public bool AllocationEditing_PreTransitionCRUD(string transition)
        {
            switch (transition.ToUpper())
            {
            case "SAVE":
                if (ASPxEdit.ValidateEditorsInContainer(formlayoutAllocationEditingForm))
                {
                    using (UnitOfWork uow = XpoHelper.GetNewUnitOfWork())
                    {
                        Guid             selectedAllocationTypeId;
                        Guid             selectedAccountActorTypeId;
                        AllocationType   selectedAllocationType   = null;
                        AccountActorType selectedAccountActorType = null;
                        Allocation       allocation = null;
                        bool             isParseSuccess;

                        //Get selected allocation type
                        isParseSuccess = Guid.TryParse(cboAllocationType.Value.ToString(), out selectedAllocationTypeId);
                        if (!isParseSuccess)
                        {
                            throw new Exception("The string is invalid for parsing to GUID");
                        }
                        selectedAllocationType = uow.GetObjectByKey <AllocationType>(selectedAllocationTypeId);

                        //Update allocation
                        allocation                  = uow.GetObjectByKey <Allocation>(AllocationId);
                        allocation.Code             = txtCode.Text;
                        allocation.Name             = txtName.Text;
                        allocation.Description      = txtDescription.Text;
                        allocation.AllocationTypeId = selectedAllocationType;

                        //Get selected IsMaster AccountActorType
                        isParseSuccess =
                            Guid.TryParse(cbIsMasterAccountActorType.Value.ToString()
                                          , out selectedAccountActorTypeId);
                        if (!isParseSuccess)
                        {
                            throw new Exception("The string is invalid for parsing to GUID");
                        }
                        selectedAccountActorType = uow.GetObjectByKey <AccountActorType>(selectedAccountActorTypeId);

                        //Update isMaster AllocationAccountActorType
                        AllocationAccountActorType isMasterAllocationAccountActorType =
                            allocation.AllocationAccountActorTypes.FirstOrDefault(r => r.IsMaster);
                        if (isMasterAllocationAccountActorType != null)
                        {
                            isMasterAllocationAccountActorType.AccountActorTypeId = selectedAccountActorType;
                        }
                        else
                        {
                            //Create new IsMaster AllocationAccountActorType
                            AllocationAccountActorType allocationAccountActorType
                                = new AllocationAccountActorType(uow)
                                {
                                AccountActorTypeId = selectedAccountActorType,
                                AllocationId       = allocation,
                                IsMaster           = true
                                };
                        }

                        //Get selected ids in gridlookupAccountActorType
                        var relatedAccountActorTypeIds = gridlookupAccountActorType.GridView
                                                         .GetSelectedFieldValues("AccountActorTypeId")
                                                         .Select(r => Guid.Parse(r.ToString()));
                        List <AllocationAccountActorType> relatedAccountActorTypes =
                            allocation.AllocationAccountActorTypes.Where(r => !r.IsMaster).ToList();
                        uow.Delete(relatedAccountActorTypes);

                        //Create new related AllocationAccountActorTypes
                        foreach (var relatedAccountActorTypeId in relatedAccountActorTypeIds)
                        {
                            AllocationAccountActorType relatedAllocationAccountActorType
                                = new AllocationAccountActorType(uow)
                                {
                                AccountActorTypeId = uow.GetObjectByKey <AccountActorType>(relatedAccountActorTypeId),
                                AllocationId       = allocation,
                                IsMaster           = false
                                };
                            relatedAllocationAccountActorType.Save();
                        }

                        //Set new Id to session variable
                        AllocationId = allocation.AllocationId;
                        uow.CommitChanges();
                    }
                }
                else
                {
                    return(false);
                }
                break;

            default:
                break;
            }
            return(true);
        }
Пример #14
0
        public bool AllocationCreating_PreTransitionCRUD(string transition)
        {
            switch (transition.ToUpper())
            {
            case "SAVE":
                if (ASPxEdit.ValidateEditorsInContainer(formlayoutAllocationEditingForm))
                {
                    using (UnitOfWork uow = XpoHelper.GetNewUnitOfWork())
                    {
                        Guid             selectedAllocationTypeId;
                        Guid             selectedAccountActorTypeId;
                        AllocationType   selectedAllocationType   = null;
                        AccountActorType selectedAccountActorType = null;
                        Allocation       allocation = null;
                        bool             isParseSuccess;

                        //Get selected allocation type
                        isParseSuccess = Guid.TryParse(cboAllocationType.Value.ToString(), out selectedAllocationTypeId);
                        if (!isParseSuccess)
                        {
                            throw new Exception("The string is invalid for parsing to GUID");
                        }
                        selectedAllocationType = uow.GetObjectByKey <AllocationType>(selectedAllocationTypeId);

                        //Create new allocation
                        allocation = new Allocation(uow)
                        {
                            AllocationId     = Guid.NewGuid(),
                            AllocationTypeId = selectedAllocationType,
                            Code             = txtCode.Text,
                            Description      = txtDescription.Text,
                            Name             = txtName.Text,
                            RowStatus        = Utility.Constant.ROWSTATUS_ACTIVE
                                               //OwnerOrgId
                        };

                        //Get selected IsMaster AccountActorType
                        isParseSuccess =
                            Guid.TryParse(cbIsMasterAccountActorType.Value.ToString()
                                          , out selectedAccountActorTypeId);
                        if (!isParseSuccess)
                        {
                            throw new Exception("The string is invalid for parsing to GUID");
                        }
                        selectedAccountActorType = uow.GetObjectByKey <AccountActorType>(selectedAccountActorTypeId);

                        //Create new IsMaster AllocationAccountActorType
                        AllocationAccountActorType allocationAccountActorType
                            = new AllocationAccountActorType(uow)
                            {
                            AccountActorTypeId = selectedAccountActorType,
                            AllocationId       = allocation,
                            IsMaster           = true
                            };

                        //Get selected ids in gridlookupAccountActorType
                        var relatedAccountActorTypeIds = gridlookupAccountActorType.GridView
                                                         .GetSelectedFieldValues("AccountActorTypeId")
                                                         .Select(r => Guid.Parse(r.ToString()));
                        //Create new related AllocationAccountActorTypes
                        foreach (var relatedAccountActorTypeId in relatedAccountActorTypeIds)
                        {
                            AllocationAccountActorType relatedAllocationAccountActorType
                                = new AllocationAccountActorType(uow)
                                {
                                AccountActorTypeId = uow.GetObjectByKey <AccountActorType>(relatedAccountActorTypeId),
                                AllocationId       = allocation,
                                IsMaster           = false
                                };
                            relatedAllocationAccountActorType.Save();
                        }

                        //Set new Id to session variable
                        AllocationId = allocation.AllocationId;
                        uow.CommitChanges();
                    }
                }
                else
                {
                    return(false);
                }
                break;

            default:
                break;
            }
            return(true);
        }
Пример #15
0
 public static void SetValidation_Border(this ASPxEdit ctrlEdit, string validationGroup, bool isRequired)
 {
     ctrlEdit.SetValidation_Border(validationGroup, isRequired, null);
 }
Пример #16
0
        /////2013-09-21 ERP-580 Khoa.Truong INS START
        //protected ToolEntity ToolEntity
        //{
        //    get
        //    {
        //        Guid recordId = Guid.Empty;
        //        try
        //        {
        //            recordId = (Guid)Session["ToolId"];
        //            if (recordId == Guid.Empty) return null;
        //        }
        //        catch (Exception)
        //        {
        //            return null;
        //        }
        //        //ToolEntity toolEntity;
        //        //this.toolBOL.getToolByKey(recordId, out toolEntity);
        //        return toolEntity;
        //    }
        //}
        /////2013-09-20 ERP-580 Khoa.Truong INS END

        protected void popDeviceEdit_WindowCallback(object sender, DevExpress.Web.ASPxClasses.CallbackEventArgsBase e)
        {
            string[] args = e.Parameter.Split('|');
            switch (args[0])
            {
            case "new":

                /////2013-09-21 ERP-580 Khoa.Truong INS START
                Session["ToolId"] = Guid.Empty;
                /////2013-09-21 ERP-580 Khoa.Truong INS END

                Action = "new";
                frmlInfoGeneral.DataSourceID = null;
                this.CancelEdit();
                ClearForm();
                //popManufacturerGroupEdit.ShowOnPageLoad = true;
                break;

            case "edit":
                /////2013-09-21 ERP-580 Khoa.Truong INS START
                this.ClearForm();
                /////2013-09-21 ERP-580 Khoa.Truong INS END
                Action = "edit";
                //ToolEntity toolEntity;
                Guid guid = new Guid(args[1]);

                /////2013-09-21 ERP-580 Khoa.Truong INS START
                Session["ToolId"] = guid;
                /////2013-09-21 ERP-580 Khoa.Truong INS END

                toolKey = guid;
                LoadForm();
                //frmlInfoGeneral.DataSource = this.toolBOL.getToolByKey(guid, out toolEntity);
                frmlInfoGeneral.DataBind();

                //HtmlEditorDescription.Html = toolEntity.Description;
                //formDeviceEdit.HeaderText = "Thông tin công cụ dụng cụ - Mã số: " + toolEntity.Code;
                formDeviceEdit.ShowOnPageLoad = true;

                /////2013-09-21 ERP-580 Khoa.Truong INS START
                //txtCode.Text = toolEntity.Code;
                /////2013-09-21 ERP-580 Khoa.Truong INS END

                break;

            case "save":
                bool   isSuccess   = true;
                string recordIdStr = null;
                try
                {
                    /////2013-09-21 ERP-580 Khoa.Truong INS START
                    //Check validation
                    if (!ASPxEdit.AreEditorsValid(pagDeviceEdit, true))
                    {
                        formDeviceEdit.JSProperties.Add("cpInvalid", true);
                        pagDeviceEdit.ActiveTabIndex = 0;
                        return;
                    }
                    /////2013-09-21 ERP-580 Khoa.Truong INS START

                    //Logic to save data
                    if (args.Length > 1)
                    {
                        //Update mode
                        recordIdStr = args[1];
                        Guid recordId = Guid.Parse(recordIdStr);
                        //ToolEntity entity = new ToolEntity();
                        //entity.ToolId = recordId;
                        //entity.Code = txtCode.Text;
                        //entity.RowStatus = char.Parse(cbRowStatus.SelectedItem.Value.ToString());
                        //entity.Language = Utility.CurrentSession.Instance.Lang;
                        //entity.Name = txtName.Text;
                        //entity.Description = HtmlEditorDescription.Html;
                        //entity.LibraryUrl = "";
                        //entity.DocumentUrl = "";
                        //this.toolBOL.updateTool(entity, CategoryEntityList, SupplierEntityList, ToolUnitConstruction);
                    }
                    else
                    {
                        //Insert mode
                        //ToolEntity entity = new ToolEntity();
                        //entity.Code = txtCode.Text;
                        //entity.RowStatus = char.Parse(cbRowStatus.SelectedItem.Value.ToString());
                        //entity.ManufacturerId = new Guid(cboManufacturer.SelectedItem.GetValue("ManufacturerId").ToString());
                        //entity.Language = Utility.CurrentSession.Instance.Lang;
                        //entity.Name = txtName.Text;
                        //entity.Description = HtmlEditorDescription.Html;
                        //entity.LibraryUrl = "";
                        //entity.DocumentUrl = "";
                        //this.toolBOL.insertTool(entity, CategoryEntityList, SupplierEntityList, ToolUnitConstruction);
                    }

                    //popManufacturerGroupEdit.ShowOnPageLoad = false;
                }
                catch (Exception)
                {
                    isSuccess = false;
                    throw;
                }
                finally
                {
                    this.CancelEdit();
                    OnSaved(new WebModule.Interfaces.FormEditEventArgs()
                    {
                        isSuccess = isSuccess
                    });
                    formDeviceEdit.JSProperties.Add("cpCallbackArgs",
                                                    String.Format("{{ \"recordId\": \"{0}\", \"isSuccess\": {1} }}", recordIdStr, isSuccess.ToString().ToLower()));
                }
                break;

            case "cancel":
                this.CancelEdit();
                break;

            default:
                break;
            }
        }
Пример #17
0
 public static void SetValidation_Border(this ASPxEdit ctrlEdit, string validationGroup)
 {
     ctrlEdit.SetValidation_Border(validationGroup, true);
 }
Пример #18
0
            GridViewSettings CreateTagTemplateGridSettings()
            {
                GridViewSettings settings = new GridViewSettings();

                settings.Name                = "gvTemplate";
                settings.KeyFieldName        = "ID";
                settings.CallbackRouteValues = new { Controller = "TagTemplate", Action = "GridTagTemplatePartial" };
                settings.Width               = Unit.Percentage(100);
                settings.SettingsBehavior.AllowFocusedRow = true;

                settings.SettingsEditing.BatchUpdateRouteValues = new { Controller = "TagTemplate", Action = "UpdateTagTemplateP" };

                settings.SettingsBehavior.ProcessColumnMoveOnClient = true;
                settings.SettingsBehavior.ColumnMoveMode            = GridColumnMoveMode.AmongSiblings;

                settings.SettingsEditing.Mode = GridViewEditingMode.Batch;
                settings.SettingsEditing.BatchEditSettings.EditMode        = GridViewBatchEditMode.Cell;
                settings.SettingsEditing.BatchEditSettings.StartEditAction = GridViewBatchStartEditAction.FocusedCellClick;

                settings.SettingsEditing.BatchEditSettings.EditMode = GridViewBatchEditMode.Row;

                settings.SettingsPager.PageSize = 10;
                settings.SettingsPager.Position = PagerPosition.Bottom;
                settings.SettingsPager.FirstPageButton.Visible      = true;
                settings.SettingsPager.LastPageButton.Visible       = true;
                settings.SettingsPager.PageSizeItemSettings.Visible = true;
                settings.SettingsPager.PageSizeItemSettings.Items   = new string[] { "10", "20", "50" };

                settings.CommandColumn.ButtonRenderMode = GridCommandButtonRenderMode.Image;
                settings.SettingsCommandButton.NewButton.Image.IconID     = DevExpress.Web.ASPxThemes.IconID.ActionsAdd16x16;
                settings.SettingsCommandButton.DeleteButton.Image.IconID  = DevExpress.Web.ASPxThemes.IconID.ActionsTrash16x16;
                settings.SettingsCommandButton.RecoverButton.Image.IconID = DevExpress.Web.ASPxThemes.IconID.ActionsConvert16x16;

                settings.CommandColumn.Visible               = true;
                settings.CommandColumn.ShowDeleteButton      = true;
                settings.CommandColumn.ShowNewButtonInHeader = true;
                settings.CommandColumn.Width = Unit.Point(75);

                //settings.Settings.ShowFilterRow = true;
                //settings.Settings.ShowFilterRowMenu = true;

                //settings.Settings.ShowGroupPanel = true;

                settings.Settings.VerticalScrollBarMode    = ScrollBarMode.Visible;
                settings.Settings.VerticalScrollableHeight = 200;

                //settings.ClientSideEvents.BeginCallback = "onTemplateGridCallback";
                settings.ClientSideEvents.EndCallback       = "onTemplateGridEndCallback";
                settings.ClientSideEvents.FocusedRowChanged = "onTemplateSelected";

                settings.EnableRowsCache = true;

                //Column info
                settings.Columns.Add(c => { c.FieldName = "NAME"; c.Caption = "Template Name"; });
                settings.Columns.Add(c => { c.FieldName = "CREATED_DATE"; c.Caption = ""; c.Caption = "Save Date";  c.Width = Unit.Pixel(150); });

                settings.CellEditorInitialize += (s, e) => {
                    ASPxEdit editor = (ASPxEdit)e.Editor;
                    editor.ValidationSettings.Display = Display.None;
                    if (e.Column.FieldName == "CREATED_DATE")
                    {
                        e.Editor.ReadOnly = true;
                    }
                };

                return(settings);
            }
 private static void SetValueToControl(object value, ASPxEdit c){
     c.Value = value;
 }
Пример #20
0
 public static void SetValidation(this ASPxEdit ctrlEdit, string validationGroup, string expression, string expErrorText)
 {
     ctrlEdit.SetValidationBase(validationGroup);
     ctrlEdit.SetExpression(expression, expErrorText);
 }
 public void OnControlCreated(string column, ASPxEdit control, XPBaseObject obj){
     if (ControlCreated != null)
         ControlCreated(column, control, obj);
 }
Пример #22
0
 public static void SetValidation(this ASPxEdit ctrlEdit, string validationGroup, bool isRequired, string expression, string expErrorText)
 {
     ctrlEdit.SetValidation(validationGroup, isRequired);
     ctrlEdit.SetExpression(expression, expErrorText);
 }
 protected void ASPxCallbackPanelDemo_Callback(object sender, DevExpress.Web.ASPxClasses.CallbackEventArgsBase e)
 {
     ASPxCallbackPanel callbackPanel = (ASPxCallbackPanel)sender;
     bool isValid = ASPxEdit.ValidateEditorsInContainer(callbackPanel);
 }
Пример #24
0
        /// <summary>
        /// This method fires when the user clicks the Login button and it attempts to log
        /// the user in
        /// </summary>
        /// <param name="sender">The btnLogin DevExpress button</param>
        /// <param name="e">The Click event</param>
        protected void btnLogin_Click(object sender, EventArgs e)
        {
            if (ASPxEdit.AreEditorsValid(this, btnLogin.ValidationGroup))
            {
                // Validate the user password
                var manager       = Context.GetOwinContext().GetUserManager <ApplicationUserManager>();
                var signinManager = Context.GetOwinContext().GetUserManager <ApplicationSignInManager>();

                //Try to get the user
                PyramidUser user = manager.FindByName(txtUsername.Text);

                //Make sure that the user is confirmed
                if (user != null && manager.IsEmailConfirmed(user.Id))
                {
                    //Try to sign the user in
                    var result = signinManager.PasswordSignIn(txtUsername.Text, txtPassword.Text, false, user.LockoutEnabled);

                    switch (result)
                    {
                    case SignInStatus.Success:
                        //The user successfully logged in

                        List <UserProgramRole> userProgramRoles;
                        List <spGetUserCustomizationOptions_Result> userCustomizationOptions;
                        using (PyramidContext context = new PyramidContext())
                        {
                            //Get the user's program roles
                            userProgramRoles = context.UserProgramRole.AsNoTracking()
                                               .Include(upr => upr.CodeProgramRole)
                                               .Include(upr => upr.Program)
                                               .Where(upr => upr.Username == txtUsername.Text).ToList();

                            //Get the user's customization options
                            userCustomizationOptions = context.spGetUserCustomizationOptions(txtUsername.Text).ToList();

                            //Keep a record of successful logins
                            LoginHistory history = new LoginHistory();
                            history.Username  = txtUsername.Text;
                            history.LoginTime = DateTime.Now;

                            //If the user only has one program role, record it in the login history
                            if (userProgramRoles.Count == 1)
                            {
                                history.ProgramFK = userProgramRoles.First().ProgramFK;
                                history.Role      = userProgramRoles.First().CodeProgramRole.RoleName;
                            }

                            //Save the login history
                            context.LoginHistory.Add(history);
                            context.SaveChanges();

                            //Save the LoginHistory primary key to the session for later access
                            Session["LoginHistoryPK"] = history.LoginHistoryPK;
                        }

                        //Set the user customization options cookie
                        Utilities.SetCustomizationOptionCookie(userCustomizationOptions);

                        //Redirect the user based on the number of roles they have
                        if (userProgramRoles.Count > 1)
                        {
                            Response.Redirect(String.Format("/Account/SelectRole.aspx?ReturnUrl={0}",
                                                            (Request.QueryString["ReturnUrl"] != null ? Request.QueryString["ReturnUrl"].ToString() : "/Default.aspx")));
                        }
                        else
                        {
                            //To hold the role information
                            ProgramAndRoleFromSession roleInfo = new ProgramAndRoleFromSession();

                            //Get the UserProgramRole
                            UserProgramRole userRole = userProgramRoles.FirstOrDefault();

                            //Set the session variables for the program roles
                            roleInfo.RoleFK           = userRole.CodeProgramRole.CodeProgramRolePK;
                            roleInfo.RoleName         = userRole.CodeProgramRole.RoleName;
                            roleInfo.AllowedToEdit    = userRole.CodeProgramRole.AllowedToEdit;
                            roleInfo.CurrentProgramFK = userRole.ProgramFK;
                            roleInfo.ProgramName      = userRole.Program.ProgramName;

                            //Get the hub and state information
                            using (PyramidContext context = new PyramidContext())
                            {
                                Program currentProgram = context.Program.AsNoTracking()
                                                         .Include(p => p.Hub)
                                                         .Include(p => p.State)
                                                         .Include(p => p.ProgramType)
                                                         .Where(p => p.ProgramPK == userRole.ProgramFK).FirstOrDefault();

                                roleInfo.HubFK             = currentProgram.HubFK;
                                roleInfo.HubName           = currentProgram.Hub.Name;
                                roleInfo.StateFK           = currentProgram.StateFK;
                                roleInfo.StateName         = currentProgram.State.Name;
                                roleInfo.StateLogoFileName = currentProgram.State.LogoFilename;
                                roleInfo.StateCatchphrase  = currentProgram.State.Catchphrase;
                                roleInfo.StateDisclaimer   = currentProgram.State.Disclaimer;

                                //Set the allowed program fks
                                if (roleInfo.RoleFK == (int)Utilities.ProgramRoleFKs.HUB_DATA_VIEWER)
                                {
                                    //Hub viewer, allow them to see the programs in that hub
                                    var hubPrograms = context.Program.AsNoTracking()
                                                      .Where(p => p.HubFK == roleInfo.HubFK.Value)
                                                      .ToList();
                                    roleInfo.ProgramFKs = hubPrograms
                                                          .Select(hp => hp.ProgramPK)
                                                          .ToList();

                                    //Allow them to see all cohorts in their hub
                                    roleInfo.CohortFKs = hubPrograms
                                                         .Select(hp => hp.CohortFK)
                                                         .Distinct()
                                                         .ToList();

                                    //Don't restrict their view of the BOQs
                                    roleInfo.ShowBOQ    = true;
                                    roleInfo.ShowBOQFCC = true;
                                }
                                else if (roleInfo.RoleFK == (int)Utilities.ProgramRoleFKs.APPLICATION_ADMIN)
                                {
                                    //App admin, allow them to see all programs in a state
                                    roleInfo.ProgramFKs = context.Program.AsNoTracking()
                                                          .Where(p => p.StateFK == roleInfo.StateFK.Value)
                                                          .Select(p => p.ProgramPK).ToList();

                                    //Allow them to see all cohorts in a state
                                    roleInfo.CohortFKs = context.Cohort.AsNoTracking()
                                                         .Where(c => c.StateFK == roleInfo.StateFK.Value)
                                                         .Select(c => c.CohortPK).ToList();

                                    //Don't restrict their view of the BOQs
                                    roleInfo.ShowBOQ    = true;
                                    roleInfo.ShowBOQFCC = true;
                                }
                                else if (roleInfo.RoleFK == (int)Utilities.ProgramRoleFKs.SUPER_ADMIN)
                                {
                                    //Super admin, all programs in all states
                                    roleInfo.ProgramFKs = context.Program.AsNoTracking()
                                                          .Select(p => p.ProgramPK).ToList();

                                    //All cohorts
                                    roleInfo.CohortFKs = context.Cohort.AsNoTracking()
                                                         .Select(c => c.CohortPK).ToList();

                                    //Don't restrict their view of the BOQs
                                    roleInfo.ShowBOQ    = true;
                                    roleInfo.ShowBOQFCC = true;
                                }
                                else
                                {
                                    //Something else, limit to the current program fk
                                    List <int> programFKs = new List <int>();
                                    programFKs.Add(roleInfo.CurrentProgramFK.Value);
                                    roleInfo.ProgramFKs = programFKs;

                                    //Limit to current cohort fk
                                    List <int> cohortFKs = new List <int>();
                                    cohortFKs.Add(currentProgram.CohortFK);
                                    roleInfo.CohortFKs = cohortFKs;

                                    //Determine if this program is a FCC program
                                    var fccProgramTypes = currentProgram.ProgramType
                                                          .Where(pt => pt.TypeCodeFK == (int)Utilities.ProgramTypeFKs.FAMILY_CHILD_CARE ||
                                                                 pt.TypeCodeFK == (int)Utilities.ProgramTypeFKs.GROUP_FAMILY_CHILD_CARE)
                                                          .ToList();

                                    //Limit their view to the right BOQ type
                                    if (fccProgramTypes.Count > 0)
                                    {
                                        roleInfo.ShowBOQ    = false;
                                        roleInfo.ShowBOQFCC = true;
                                    }
                                    else
                                    {
                                        roleInfo.ShowBOQ    = true;
                                        roleInfo.ShowBOQFCC = false;
                                    }
                                }
                            }

                            //Add the role information to the session
                            Utilities.SetProgramRoleInSession(Session, roleInfo);

                            //Redirect the user
                            Response.Redirect(Request.QueryString["ReturnUrl"] != null ? Request.QueryString["ReturnUrl"].ToString() : "/Default.aspx");
                        }
                        break;

                    case SignInStatus.LockedOut:
                        Response.Redirect("/Account/Lockout");
                        break;

                    case SignInStatus.RequiresVerification:
                        Response.Redirect(String.Format("/Account/TwoFactorAuthenticationSignIn?ReturnUrl={0}",
                                                        Request.QueryString["ReturnUrl"]), true);
                        break;

                    case SignInStatus.Failure:
                    default:
                        //Show the user an error message
                        msgSys.ShowMessageToUser("danger", "Error", "Invalid login attempt", 120000);

                        //Focus the password text box
                        txtPassword.Focus();
                        break;
                    }
                }
                else
                {
                    msgSys.ShowMessageToUser("danger", "Error", "Invalid login attempt", 120000);
                }
            }
        }