コード例 #1
0
ファイル: LoginPage.aspx.cs プロジェクト: radtek/canon
        /// <summary>
        /// Localizes the page and set user's login from cookies.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Page_Load(object sender, EventArgs e)
        {
            Logger.Log("Session started", LogLevel.Info);
            Localize();

            if (IsPostBack || IsCallback)
            {
                return;
            }

            ASPxTextBox  UserName           = (ASPxTextBox)LoginControl.FindControl("UserName");
            ASPxTextBox  Password           = (ASPxTextBox)LoginControl.FindControl("Password");
            ASPxCheckBox RememberMeCheckBox = (ASPxCheckBox)LoginControl.FindControl("RememberMeCheckBox");

            if (Request.Cookies["username"] != null)
            {
                UserName.Text = Request.Cookies["username"].Value;
                RememberMeCheckBox.Checked = true;
                Password.Focus();
            }
            else
            {
                RememberMeCheckBox.Checked = false;
                UserName.Focus();
            }
        }
コード例 #2
0
        protected void grdData_CustomButtonCallback(object sender, DevExpress.Web.ASPxGridView.ASPxGridViewCustomButtonCallbackEventArgs e)
        {
            ASPxGridView grid           = sender as ASPxGridView;
            ASPxTextBox  txt_realamount = grid.FindRowTemplateControl(e.VisibleIndex, "txt_realamount") as ASPxTextBox;

            txt_realamount.Focus();
        }
コード例 #3
0
        protected void grdApproval_InitNewRow(object sender, DevExpress.Web.Data.ASPxDataInitNewRowEventArgs e)
        {
            bindApprovalList = false;

            ASPxLabel    ctrlNum      = grdApproval.FindEditRowCellTemplateControl((GridViewDataColumn)grdApproval.Columns["Ctrl"], "ASPxCtrlTextBox") as ASPxLabel;
            ASPxDateEdit effectDate   = grdApproval.FindEditRowCellTemplateControl((GridViewDataColumn)grdApproval.Columns["EffectDate"], "EffectDate") as ASPxDateEdit;
            ASPxLabel    lastModified = grdApproval.FindEditRowCellTemplateControl((GridViewDataColumn)grdApproval.Columns["LastModified"], "ASPxLastModifiedTextBox") as ASPxLabel;
            ASPxTextBox  Remarks      = grdApproval.FindEditRowCellTemplateControl((GridViewDataColumn)grdApproval.Columns["Remarks"], "ASPxRemarksTextBox") as ASPxTextBox;

            ctrlNum.Text      = GlobalClass.GetControl_DocNum("Approval", Convert.ToDateTime(DateTime.Now.ToString()));
            effectDate.Value  = DateTime.Now.ToString("MM/dd/yyyy");
            lastModified.Text = DateTime.Now.ToString();
            Remarks.Text      = "";
            Remarks.Focus();
        }
コード例 #4
0
        protected void grdData_CustomCallback(object sender, ASPxGridViewCustomCallbackEventArgs e)
        {
            ASPxGridView grid = sender as ASPxGridView;
            int          idx  = Int16.Parse(e.Parameters.ToString());

            //grdData.DataSource =
            //  new[] {
            //         new { key="123", code = "MAT001", name = "Mặt hàng 1", lot="123", date="25-5-2014", reciept = "HD001",
            //                 recieptamount="100", realamount="90", difamount="10", unit="Thùng", description = "Mặt hàng 1"
            //        },
            //        new { key="1234", code = "MAT002", name = "Mặt hàng 2", lot="1234", date="25-7-2015",reciept = "HD001",
            //                 recieptamount="150", realamount="130", difamount="20", unit="Hộp", description = "Mặt hàng 2"
            //        },
            //    };
            //grdData.KeyFieldName = "key";
            //grdData.DataBind();

            ASPxTextBox txt_realamount = grid.FindRowCellTemplateControl(idx, grid.Columns["realamount"] as GridViewDataColumn, "txt_realamount") as ASPxTextBox;

            txt_realamount.Focus();
        }
コード例 #5
0
ファイル: AdminUsers.ascx.cs プロジェクト: radtek/canon
        protected void gridUsers_HtmlEditFormCreated(object sender, ASPxGridViewEditFormEventArgs e)
        {
            // this.LocalizeEditForm(e.EditForm);

            ASPxTextBox username = (ASPxTextBox)gridUsers.FindEditFormTemplateControl("txtEfUsername");

            if (username != null)
            {
                username.Focus();
            }

            if ((!SessionManager.IsEditFormCreated) || (EditFormHasErrors))
            {
                CanonDataContext db = Cdb.Instance;

                //init user rights checkbox list
                CheckBoxList cbl = (CheckBoxList)gridUsers.FindEditFormTemplateControl("chblUserRights");
                if (cbl != null)
                {
                    int counter = 0;
                    cbl.Items.Clear();
                    SessionManager.CheckBoxListHelper = new Dictionary <int, int>(5);
                    Dictionary <UserRightsEnum, string> list = BuUser.GetAllRightsList();
                    foreach (KeyValuePair <UserRightsEnum, string> pair in list)
                    {
                        int pairKey = (int)pair.Key;
                        cbl.Items.Add(new ListItem(pair.Value, pairKey.ToString()));
                        SessionManager.CheckBoxListHelper.Add(counter, pairKey);
                        counter++;
                    }
                }

                //initialize listbox and checkboxlist if anything exists
                if ((!gridUsers.IsNewRowEditing) && (!EditFormHasErrors))
                {
                    //combo/list initialization if needed
                    object value    = gridUsers.GetRowValues(gridUsers.EditingRowVisibleIndex, new String[] { "UserId" });
                    int    idToEdit = int.Parse(value.ToString());

                    //checkbox list init
                    if (cbl != null)
                    {
                        Dictionary <UserRightsEnum, string> list = BuUser.GetRightsList(idToEdit);
                        foreach (ListItem li in cbl.Items)
                        {
                            foreach (KeyValuePair <UserRightsEnum, string> pair in list)
                            {
                                if (li.Value == ((int)pair.Key).ToString())
                                {
                                    li.Selected = true;
                                }
                            }
                        }
                    }
                }
                if (EditFormHasErrors)
                {
                    //rights
                    if (cbl != null)
                    {
                        string[] values = SelectedRights.Split(';');
                        foreach (string val in values)
                        {
                            string[] item = val.Split('=');
                            if (item.Length != 2)
                            {
                                continue;
                            }
                            foreach (ListItem li in cbl.Items)
                            {
                                if ((li.Value == item[0]) && (item[1] == "1"))
                                {
                                    li.Selected = true;
                                }
                            }
                        }
                    }
                }

                Control popupCtrl = gridUsers.FindEditFormTemplateControl("popupChangePassword");
                if (popupCtrl != null)
                {
                    Control changeCtrl = popupCtrl.FindControl("changePasswordCtrl");
                    if (changeCtrl != null && changeCtrl is AdminChangePassword)
                    {
                        object row = gridUsers.GetRow(gridUsers.EditingRowVisibleIndex);
                        if (row != null && row is User)
                        {
                            int userID = (row as User).UserId;

                            (changeCtrl as AdminChangePassword).SetUserId(userID);
                        }
                    }
                }

                SessionManager.IsEditFormCreated = true;
            }
        }