public void AdministratorLogin()
        {
            DataTable Dt = new ClsBase().pDa.GetQuery("RecruitmentTestUser", "*", "1 = 0");
            this.mDrUser = Dt.NewRow();
            this.mDrUser["RecruitmentTestUserID"] = 0;
            this.mDrUser["Name"] = "Administrator";

            this.mIsLoggedIn = true;
            this.mIsSystemAdmin = true;
        }
Пример #2
0
        public ClsBaseRowDetail(ClsBase pObj_Base, string pHeaderName, string pTableName, string pViewName = "", string pOtherLoadCondition = "")
        {
            if (pViewName == "") pViewName = pTableName;

            this.mHeaderName = pHeaderName;
            this.mTableName = pTableName;
            this.mViewName = pViewName;
            this.mOtherLoadCondition = pOtherLoadCondition;
            this.mObj_Base = pObj_Base;

            DataTable Dt_Def = Methods_Query.GetTableDef(this.mTableName);
            DataRow[] ArrDr = Dt_Def.Select("IsPk = 1");
            foreach (DataRow Dr in ArrDr)
            {
                this.mList_Key.Add((string)Dr["ColumnName"]);
            }
        }
 public void AdministratorLogin()
 {
     Interface_DataAccess Da = new ClsBase().pDa;
     try
     {
         Da.Connect();
         DataTable Dt = Da.GetQuery("uvw_User", "*", "1 = 0");
         this.mDrUser = Dt.NewRow();
         this.mDrUser["UserID"] = 0;
         this.mDrUser["EmployeeID"] = 0;
         this.mDrUser["UserName"] = "******";
         this.mDrUser["EmployeeName"] = "Administrator";
         this.mIsAdmin = true;
     }
     catch (Exception ex)
     { throw ex; }
     finally
     { Da.Close(); }
 }
        protected virtual void Setup(
            Layer01_Constants.eSystem_Modules pSystem_ModulesID
            , ClsBase pObj_Base
            , string pModuleName = "")
        {
            Keys Keys = null;
            try
            {
                Keys = (Keys)this.Session[Layer01_Constants_Web.CnsSession_Keys];
                this.Session[Layer01_Constants_Web.CnsSession_Keys] = null;
            }
            catch { }

            this.mMaster.Setup(Keys, pSystem_ModulesID, pObj_Base, pModuleName);
            this.mSystem_ModulesID = (Int64)pSystem_ModulesID;
            this.Session[this.mMaster.pObjID + CnsSessionPageObj] = new Collection();
        }
Пример #5
0
 public Str_Obj(string pName, ClsBase pObj)
 {
     this.Name = pName;
     this.Obj = pObj;
 }
Пример #6
0
 public void Add(string Name, ClsBase Obj)
 {
     this.mList_Obj.Add(new Str_Obj(Name, Obj));
 }
        public void Setup(
            Layer01_Common.Common.Layer01_Constants.eSystem_Modules pSystem_ModulesID
            , ClsBase pObjBase
            , string pSystem_BindDefinition_Name
            , string pOverride_PageUrl_Details_New = ""
            , string pSource = ""
            , string pSourceKey = ""
            , bool pIsNoSelect = false
            , string pModuleName = "")
        {
            this.mSystem_ModulesID = (Int64)pSystem_ModulesID;
            this.mObj_Base = pObjBase;
            this.mSystem_BinDefinition_Name = pSystem_BindDefinition_Name;

            this.ViewState[CnsSystem_ModulesID] = pSystem_ModulesID;
            this.ViewState[CnsOverride_PageUrl_Details_New] = pOverride_PageUrl_Details_New;
            this.ViewState[CnsSystem_BindDefinition_Name] = pSystem_BindDefinition_Name;
            this.ViewState[CnsSource] = pSource;
            this.ViewState[CnsSourceKey] = pSourceKey;
            this.ViewState[CnsIsNoSelect] = pIsNoSelect;
            this.ViewState[CnsModuleName] = pModuleName;
        }
 public virtual void Setup(ClsBase Base)
 {
     this.mBase = Base;
 }
        public eLoginResult Login(string UserName, string Password)
        {
            //Administrator Login

            if (UserName.ToUpper() == "Administrator".ToUpper())
            {
                string Password_Check = this.mCum.GetAdministratorPassword();
                if (Password_Check == Password)
                {
                    this.AdministratorLogin();
                    return eLoginResult.Administrator;
                }
                else
                { return eLoginResult.WrongPassword; }
            }

            //User Login

            ClsBase Base = new ClsBase();
            Interface_DataAccess Da = Base.pDa;

            ClsQueryCondition Qc = Da.CreateQueryCondition();
            Qc.Add("Name", "=", (object)UserName, typeof(string).ToString(), "");
            Qc.Add("IsDeleted", "=", false, typeof(bool).ToString(), "0");

            DataTable Dt = Da.GetQuery("RecruitmentTestUser", "", Qc);
            if (Dt.Rows.Count > 0)
            {
                string Password_Check = (string)Layer01_Methods.IsNull(Dt.Rows[0]["Password"], "");

                if (Password_Check == Password)
                {
                    this.mDrUser = Dt.Rows[0];
                    this.mUserID = Convert.ToInt64(Dt.Rows[0]["RecruitmentTestUserID"]);
                    this.mIsLoggedIn = true;
                    return eLoginResult.LoggedIn;
                }
                else
                { return eLoginResult.WrongPassword; }
            }

            return eLoginResult.WrongUser;
        }
Пример #10
0
        public void Post()
        {
            ClsBase Obj_Base = new ClsBase();

            try
            {
                this.mObj_Applicant.Save();

                Obj_Base.pDa.Connect();
                Obj_Base.pDa.BeginTransaction();

                DataTable Dt_Exam = Obj_Base.pDa.List_Empty(Obj_Base.pDa.Connection, "RecruitmentTestExams");
                DataRow Dr_Exam = Dt_Exam.NewRow();
                this.mDr_Exam = Dr_Exam;
                Dr_Exam["RecruitmentTestApplicantID"] = this.mObj_Applicant.pDr["RecruitmentTestApplicantID"];
                Dr_Exam["LookupCategoryID"] = this.mCategoryID;
                Dr_Exam["DateTaken"] = DateTime.Now;
                Dr_Exam["DateStart"] = this.mDateStart;
                Dr_Exam["DateEnd"] = DateTime.Now;
                Dr_Exam["Score"] = this.mEm.ComputeScore(this.mDs);
                Dr_Exam["TotalItems"] = this.mDt_Question.Rows.Count;
                Obj_Base.pDa.SaveDataRow(Dr_Exam, "RecruitmentTestExams");

                DataTable Dt_Exams_Questions = Obj_Base.pDa.List_Empty(Obj_Base.pDa.Connection, "RecruitmentTestExams_Questions");
                foreach (DataRow Inner_Dr in this.mDt_Question.Rows)
                {
                    DataRow Dr_Exam_Question = Dt_Exams_Questions.NewRow();
                    Dr_Exam_Question["RecruitmentTestExamsID"] = Dr_Exam["RecruitmentTestExamsID"];
                    Dr_Exam_Question["Lkp_RecruitmentTestQuestionsID"] = Inner_Dr["RecruitmentTestQuestionsID"];
                    Obj_Base.pDa.SaveDataRow(Dr_Exam_Question, "RecruitmentTestExams_Questions");
                }

                DataTable Dt_Exams_Answers = Obj_Base.pDa.List_Empty(Obj_Base.pDa.Connection, "RecruitmentTestExams_Answers");
                DataRow[] Arr_Dr_Answer = this.mDt_Question_Answer.Select("ISNULL(IsAnswered,0) = 1");
                foreach (DataRow Inner_Dr in Arr_Dr_Answer)
                {
                    DataRow Dr_Exam_Answer = Dt_Exams_Answers.NewRow();
                    Dr_Exam_Answer["RecruitmentTestExamsID"] = Dr_Exam["RecruitmentTestExamsID"];
                    Dr_Exam_Answer["Lkp_RecruitmentTestQuestionsID"] = Inner_Dr["Lkp_RecruitmentTestQuestionsID"];
                    Dr_Exam_Answer["Lkp_RecruitmentTestAnswersID"] = Inner_Dr["Lkp_RecruitmentTestAnswersID"];
                    Dr_Exam_Answer["IsAnswer"] = Inner_Dr["IsAnswered"];
                    Obj_Base.pDa.SaveDataRow(Dr_Exam_Answer, "RecruitmentTestExams_Answers");
                }

                Obj_Base.pDa.CommitTransaction();
            }
            catch
            { Obj_Base.pDa.RollbackTransaction(); }
            finally
            { Obj_Base.pDa.Close(); }
        }
Пример #11
0
        public void LoadExam(Int64 ExamID, Int64 ItemsLimit)
        {
            ClsBase Base = new ClsBase();
            Interface_DataAccess Da = Base.pDa;

            DataTable Dt_Exam = Da.GetQuery("RecruitmentTestExams", "", "RecruitmentTestExamsID = " + ExamID);
            Int64 ApplicantID = 0;
            if (Dt_Exam.Rows.Count > 0)
            {
                this.mDr_Exam = Dt_Exam.Rows[0];
                ApplicantID = Convert.ToInt64(Layer01_Methods.IsNull(this.mDr_Exam["RecruitmentTestApplicantID"], 0));
            }
            else
            { throw new Exception("Exam Data not found."); }

            ClsKeys Key = new ClsKeys();
            Key.Add("RecruitmentTestApplicantID", ApplicantID);

            this.mObj_Applicant = new ClsApplicant();
            this.mObj_Applicant.Load(Key);

            DataSet Ds = this.mEm.LoadExam(ExamID);
            this.mDs = Ds;
            this.mDt_Question = Ds.Tables[0];
            this.mDt_Question_Answer = Ds.Tables[1];

            this.mDt_Question.Columns.Add("Ct", typeof(Int64));
            Int64 Ct = 0;
            foreach (DataRow Dr in this.mDt_Question.Rows)
            {
                Ct++;
                Dr["Ct"] = Ct;
            }

            this.mDt_Question_Answer.Columns.Add("Ct", typeof(Int64));
            Ct = 0;
            foreach (DataRow Dr in this.mDt_Question_Answer.Rows)
            {
                Ct++;
                Dr["Ct"] = Ct;
            }

            this.mItemsLimit = ItemsLimit;
            this.mItems = this.mDt_Question.Rows.Count;

            this.mPages = this.mItems / this.mItemsLimit;
            if (this.mItems % this.mItemsLimit > 0)
            { this.mPages++; }
        }
 public virtual void Setup(ClsBase Base)
 {
     this.mBase = Base;
 }
        protected override void Page_Load(object sender, EventArgs e)
        {
            base.Page_Load(sender, e);

            try
            {
                this.RadAjaxPanel_AnswerWindow.AjaxRequest += new Telerik.Web.UI.RadAjaxControl.AjaxRequestDelegate(RadAjaxPanel_AnswerWindow_AjaxRequest);
                this.RadAjaxPanel1.AjaxRequest += new Telerik.Web.UI.RadAjaxControl.AjaxRequestDelegate(RadAjaxPanel1_AjaxRequest);
                this.RadWindow1_RadComboBox1.ItemsRequested += new Telerik.Web.UI.RadComboBoxItemsRequestedEventHandler(RadComboBox1_ItemsRequested);

                this.Btn_Save.Click += new EventHandler(Btn_Save_Click);
                this.Btn_Approve.Click += new EventHandler(Btn_Approve_Click);

                if (!this.IsPostBack)
                {
                    this.SetupPage();
                    this.SetupPage_Redirected();
                }
                else
                {
                    this.mObjID = (string)this.ViewState[CnsObjID];
                    this.mObj_Base = (ClsBase)this.Session[this.mObjID];
                }
            }
            catch
            { }
        }
        void SetupPage()
        {
            ClsSysCurrentUser CurrentUser = this.Master.pCurrentUser;
            Int64 ID = Methods.Convert_Int64(this.Request.QueryString["ID"]);
            ClsKeys Key = null;

            if (ID != 0)
            {
                Key = new Layer02_Objects._System.ClsKeys();
                Key.Add("RecruitmentTestQuestionsID", ID);
            }
            else
            { this.mIsNew = true; }

            this.mObj_Base = new ClsQuestion(this.Master.pCurrentUser);
            this.mObj_Base.Load(Key);

            this.mObjID = CurrentUser.GetNewPageObjectID();
            this.ViewState[CnsObjID] = this.mObjID;
            this.Session[this.mObjID] = this.mObj_Base;

            //[-]

            Int64 UserID = Methods.Convert_Int64(CurrentUser.pDrUser["RecruitmentTestUserID"], 0);
            Int64 UserID_CreatedBy = Methods.Convert_Int64(this.mObj_Base.pDr["RecruitmentTestUserID_CreatedBy"], 0);
            bool IsApproved = Convert.ToBoolean(Methods.IsNull(this.mObj_Base.pDr["IsApproved"], false));

            if (!
                    (
                        (CurrentUser.pIsAdmin || ((UserID == UserID_CreatedBy) && (!IsApproved)))
                        || (this.mIsNew)
                    )
                )
            { this.mIsReadOnly = true; }

            //[-]

            if ((bool)Methods.IsNull(CurrentUser.pDrUser["IsAdministrator"], false))
            {
                this.Btn_Approve.Enabled = true;
                //this.Btn_Approve2.Enabled = true;
            }

            //[-]

            ClsQuestion Obj_Question = (ClsQuestion)this.mObj_Base;

            this.Txt_Question.Text = (string)Methods.IsNull(Obj_Question.pDr["Question"], "");
            this.Chk_IsMultipleAnswer.Checked = Convert.ToBoolean(Methods.IsNull(Obj_Question.pDr["IsMultipleAnswer"], false));

            //[-]

            this.SetupPage_ControlAttributes();
            this.BindGrid();
        }
        public eLoginResult Login(string UserName, string Password)
        {
            Interface_DataAccess Da = new ClsBase().pDa;
            try
            {
                Da.Connect();

                //Administrator Login
                if (UserName.ToUpper() == "Administrator".ToUpper())
                {
                    string System_Password = Da.GetSystemParameter("Administrator_Password", "Administrator");
                    if (System_Password != "")
                    {
                        string Decrypted_Password = System_Password;
                        if (Decrypted_Password == Password)
                        {
                            this.AdministratorLogin();
                            return eLoginResult.Administrator;
                        }
                        else { return eLoginResult.WrongPassword; }
                    }
                    else
                    { throw new CustomException("Administrator Password is not set. Contact your System Administrator."); }
                }

                //User Login
                QueryCondition Qc = new QueryCondition();
                Qc.Add("UserName", UserName, typeof(string).ToString());
                DataTable Dt = Da.GetQuery("uvw_User", "", Qc, "UserID");
                if (Dt.Rows.Count > 0)
                {
                    string Decrypted_Password = (string)Do_Methods.IsNull(Dt.Rows[0]["Password"], "");

                    if (Decrypted_Password == Password)
                    {
                        this.mDrUser = Dt.Rows[0];
                        return eLoginResult.LoggedIn;
                    }
                    else return eLoginResult.WrongPassword;
                }

                return eLoginResult.WrongUser;
            }
            catch (Exception ex)
            { throw ex; }
            finally
            { Da.Close(); }
        }