Beispiel #1
0
        static void Main(string[] args)
        {
            //SyncServerSocket sock = new SyncServerSocket();

            //if (sock.Listen())
            //{
            //    sock.Receive();
            //}
            //else
            //{
            //    Console.WriteLine("Fail to listen.");
            //}

            //AsyncListenServer<CS_PacketTable> instance = (AsyncListenServer<CS_PacketTable>)Activator.CreateInstance(typeof(AsyncListenServer<CS_PacketTable>));
            //instance.StartListening();

            UserLoginData ld = new UserLoginData();
            ld.name = "냥";
            ld.pwd = "0080";
            ChatServer.Instance().m_UserLoginDataList.Add(ld);
            ld.name = "뷰";
            ld.pwd = "1111";
            ChatServer.Instance().m_UserLoginDataList.Add(ld);
            ld.name = "cho";
            ld.pwd = "1111";
            ChatServer.Instance().m_UserLoginDataList.Add(ld);

            ChatServer.Instance().Run();

            Console.WriteLine("Press any key.");
            Console.Read();

            return;
        }
        public int AddLogin(User user, UserLogin user_login)
        {
            IUserLoginRepository repo = _data_repository_factory.GetIdentityDataRepository <IUserLoginRepository>();
            UserLoginData        ul   = new UserLoginData()
            {
                LoginProvider       = user_login.LoginProvider,
                ProviderKey         = user_login.ProviderKey,
                UserID              = user.UserId,
                ProviderDisplayName = user_login.ProviderDisplayName
            };

            return(repo.Save(ul));
        }
 public ActionResult UploadAvatar(HttpPostedFileBase UploadAvatar)
 {
     try
     {
         int userID = UserLoginData.GetSessionID(Session["UserLoggedIn"]);
         userBLL.ChangeAvatar(UploadAvatar, userID);
         return(RedirectToAction("ProfileManagement"));
     }
     catch (Exception ex)
     {
         return(this.ManageException(ex, "ProfileManagement"));
     }
 }
Beispiel #4
0
        public IHttpActionResult Login(UserLoginData user)
        {
            User temp = db.Users.Find(user.UserName);

            if (temp != null && user.Password == temp.Password)
            {
                return(Ok("{}"));
            }
            else
            {
                return(BadRequest("{}"));
            }
        }
Beispiel #5
0
 public ActionResult List()
 {
     try
     {
         int userID = UserLoginData.GetSessionID(Session["UserLoggedIn"]);
         return(View(new ClassifiedQueryableNotes(noteBLL.GetDataForNoteList(userID))));
     }
     catch (Exception ex)
     {
         TempData["error"] = ex.Message;
         return(Redirect(Request.UrlReferrer.AbsolutePath));
     }
 }
Beispiel #6
0
    public string deleteNews(string news_id)
    {
        string        response  = "";
        ConnectDB     db        = new ConnectDB();
        SqlDataSource oracleObj = db.ConnectionOracle();

        string        sql        = "";
        UserLoginData login_data = (UserLoginData)HttpContext.Current.Session["login_data"];

        sql = "Delete News Where NEWS_ID='" + news_id + "'";
        oracleObj.DeleteCommand = sql;

        // ======== Log ========
        LogData log_data = new LogData();

        log_data.ModuleCode = new LogData().Module_News;
        log_data.Username   = login_data.User_ID;
        log_data.Message    = "Delete News with:" + news_id;
        // =====================

        try
        {
            if (oracleObj.Delete() >= 0)
            {
                response = "OK";
                // === Log ===
                log_data.StatusCode = log_data.LogStatus_SUCCESS;
                // ===========
            }
            else
            {
                // === Log ===
                log_data.StatusCode = log_data.LogStatus_FAILED;
                // ===========
            }
        }
        catch (Exception e)
        {
            // === Log ===
            log_data.StatusCode = log_data.LogStatus_ERROR;
            log_data.Message   += " [" + e.ToString() + "]";
            // ===========
            response = e.Message.ToString();
            HttpContext.Current.Session["response"] = "Unit Test:News:deleteNews" + " ไม่สามารถดำเนินการได้";
            HttpContext.Current.Response.Redirect("err_response.aspx");
        }

        new Log().WriteLog(log_data);

        return(response);
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["login_data"] == null)
        {
            Response.Redirect("../index.aspx");
        }
        else
        {
            //ตรวจสอบสิทธิ์
            login_data = (UserLoginData)Session["login_data"];
            if (autro_obj.CheckGroupUser(login_data, group_var.officer_faculty) || autro_obj.CheckGroupUser(login_data, group_var.officer_department))
            {
                // ======== Process ===========
                token = Request.QueryString["token"];
                code  = Request.QueryString["code"];

                country = new Country().getCountry();
                foreach (CountryData row in country)
                {
                    ddlCountry.Items.Insert(ddlCountry.Items.Count, new ListItem(row.Country_ThaiName, row.Country_Code));
                }

                province = new Province().getProvince();
                foreach (ProvinceData row in province)
                {
                    ddlProvince.Items.Insert(ddlProvince.Items.Count, new ListItem(row.Province_ThaiName, row.Province_Code));
                }

                if (!Page.IsPostBack)
                {
                    string sql = "Select * From QUALIFICATIONDETAIL Where UUIDNUMBER ='" + code + "'";
                    List <QualificationDetail> data = new QualificationDetail().getQualificationDetailManual(sql);

                    txtQualificationName.Text = data[0].QualificationDegree;
                    txtDivision.Text          = data[0].Division;
                    txtAcademy.Text           = data[0].Academy;
                    txtYear.Text = data[0].Year;
                    try { ddlCountry.Items.FindByValue(data[0].Country_Code).Selected = true; } catch { }
                    try { ddlProvince.Items.FindByValue(data[0].Province_Code).Selected = true; } catch { }
                    txtProvinceOther.Text = data[0].Province_Other;
                    txtGPA.Text           = data[0].gpa;
                }
                //=============================
            }
            else
            {
                HttpContext.Current.Session["response"] = "ตรวจสอบไม่พบสิทธิ์การเข้าใช้งาน";
                HttpContext.Current.Response.Redirect("../err_response.aspx");
            }
        }
    }
Beispiel #8
0
        public async Task <ApiResponse> Login([FromBody] UserLoginData data)
        {
            var isEmail    = data.EmailOrUsername.IsEmail();
            var isUsername = data.EmailOrUsername.IsUsername();

            if (!(isEmail || isUsername))
            {
                ModelState.AddModelError("emailOrUsername", "Enter valid Email/Username");
            }

            if (!ModelState.IsValid)
            {
                throw new ApiException(ModelState.AllErrors());
            }

            var userQuery = _userService.GetAll();

            User user;

            switch (isUsername)
            {
            case true:
                user = await userQuery.FirstOrDefaultAsync(c => c.UserName == data.EmailOrUsername)
                       .ConfigureAwait(false);

                break;

            case false:
                user = await userQuery.FirstOrDefaultAsync(c => c.Email == data.EmailOrUsername)
                       .ConfigureAwait(false);

                break;
            }

            if (user != null)
            {
                var result = await _signInManager.PasswordSignInAsync(user, data.Password, false, false).ConfigureAwait(false);

                if (result.Succeeded)
                {
                    var mapResult = _mapper.Map <User, UserGetData>(user);

                    return(new ApiResponse(new UserLoginResponse
                    {
                        User = mapResult,
                    }));
                }
            }
            throw new ApiException(MessageBuilder.LoginFault);
        }
        /*private bool makeUserTempZero()
         * {
         *  try
         *  {
         *      this.userTempTable = new UserTempData();
         *      try
         *      {
         *          this.userTempTable.username = this.txtboxUserName.Text;
         *          this.userTempTable.requestType = null;
         *          this.userTempTable.requestStatus = null;
         *          this.userTempTable.quantity = 0;
         *          this.userTempTable.Date = null;
         *          this.db.UserTempDatas.InsertOnSubmit(this.userTempTable);
         *          this.db.SubmitChanges();
         *          return true;
         *      }
         *      catch (SqlException sqlEx)
         *      {
         *          MessageBox.Show("UserLoginTable is not created");
         *          return false;
         *      }
         *      return true;
         *  }catch(NullReferenceException exp)
         *  {
         *      MessageBox.Show("Null Ref Exp");
         *      return false;
         *  }
         *
         * }*/
        private bool checkUserNameAvailable()
        {
            string        name           = this.txtboxUserName.Text;
            UserLoginData userLoginTable = db.UserLoginDatas.SingleOrDefault(x => x.username == name);

            if (userLoginTable != null)
            {
                return(false);
            }
            else
            {
                return(true);
            }
        }
        private void btnSubmit_Click(object sender, EventArgs e)
        {
            UserLoginData emailData = db.UserLoginDatas.SingleOrDefault(x => x.email == this.emailBox.Text);

            if (emailData != null)
            {
                this.generatePassword();
                this.sendEmail(emailData);
            }
            else
            {
                MessageBox.Show("INVALID EMAIL");
            }
        }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["login_data"] == null)
        {
            Response.Redirect("../index.aspx");
        }
        else
        {
            //ตรวจสอบสิทธิ์
            login_data = (UserLoginData)Session["login_data"];
            if (autro_obj.CheckGroupUser(login_data, group_var.admin_university) || autro_obj.CheckGroupUser(login_data, group_var.admin_faculty))
            {
                /*=============================*/
                code = Request.QueryString["token"];

                if (!Page.IsPostBack)
                {
                    string sql = "Select * From SPECIAL_FIELD Where SPEC_FIELD_CODE='" + code + "'";
                    SpecialFieldData = SpecialFieldObj.getSpecialFieldManual(sql);

                    txtSPEC_FIELD_CODE.Text      = SpecialFieldData[0].SpecialField_Code;
                    txtSPEC_FIELD_ENGNAME.Text   = SpecialFieldData[0].SpecialField_Eng;
                    txtSPEC_FIELD_SHORTNAME.Text = SpecialFieldData[0].SpecialField_ShortName;
                    //ddlSPEC_FIELD_STATUS.Items.FindByValue(data.SpecialField_Status).Selected = true;
                    txtSPEC_FIELD_THAINAME.Text = SpecialFieldData[0].SpecialField_Thai;

                    facultyData = facultyObj.getFaculty();
                    foreach (FacultyData d in facultyData)
                    {
                        ddlFACULTY.Items.Insert(ddlFACULTY.Items.Count, new ListItem(d.Faculty_Thai, d.Faculty_Code));
                    }
                    ddlFACULTY.Items.FindByValue(SpecialFieldData[0].SpecialField_FacultyCode).Selected = true;

                    statusData = statusObj.getSystemStatus();
                    foreach (StatusData data in statusData)
                    {
                        ddlSPEC_FIELD_STATUS.Items.Insert(ddlSPEC_FIELD_STATUS.Items.Count, new ListItem(data.Status_Thai, data.Status_Code));
                    }
                    ddlSPEC_FIELD_STATUS.Items.FindByValue(SpecialFieldData[0].SpecialField_Status).Selected = true;
                }
                /*=============================*/
            }
            else
            {
                HttpContext.Current.Session["response"] = "ตรวจสอบไม่พบสิทธิ์การเข้าใช้งาน";
                HttpContext.Current.Response.Redirect("err_response.aspx");
            }
        }
    }
    public string insertEditScholarshipHistory(ScholarshipStudentHistory dataInsert)
    {
        string response = "";

        UserLoginData loginData = new UserLoginData();

        loginData = (UserLoginData)HttpContext.Current.Session["login_data"];
        LogData log_data = new LogData();

        log_data.ModuleCode = new LogData().Module_Scholarship;
        log_data.Username   = loginData.User_ID;
        log_data.Message    = "Insert ScholarshipStudentHistory with: " + dataInsert.SCHOLARSHIP_HISTORY_STUDENT_ID + ", " + dataInsert.SCHOLARSHIP_HISTORY_SCHOLARSHIP_CODE;

        // 41 = เพิ่มใหม่
        // 42 = แก้ไข
        string historyStatus = "42";

        ConnectDB     db        = new ConnectDB();
        SqlDataSource oracleObj = db.ConnectionOracle();

        string sql = "";

        sql = "Insert Into SCHOLARSHIP_HISTORY(RECORD_DATE, ACADEMIC_YEAR, SEMESTER, SCHOLARSHIP_CODE, STUDENT_ID, NATION_ID, PASSPORT_ID, SCHOLARSHIP_STARTDATE, SCHOLARSHIP_ENDDATE, SCHOLARSHIP_PERIOD, SCHOLARSHIP_AMOUNT, SCHOLARSHIP_IN_OUT, SCHOLARSHIP_TYPE, SCHOLARSHIP_SOURCE, NEW_REGIS_FEE, PROPERTIES_FEE, STUDY_FACILITY_FEE, IT_FEE, LIBRARY_FEE, HEALTH_FEE, ACTIVITY_FEE, CREDIT_3000, ACCIDENT_FEE, BACHELOR_ACADEMIC_FEE, MASTER_ACADEMIC_FEE, SPECIAL_PROJECT_FEE, SCHOLAR_FEE_COMMENT, MULTIPLE_SCHOLARSHIP, SCHOLARSHIP_STATUS, FINE_FEE, HISTORY_STATUS, RECORD_TIME) Values('" + dataInsert.SCHOLARSHIP_HISTORY_RECORD_DATE + "','" + dataInsert.SCHOLARSHIP_HISTORY_ACADEMIC_YEAR + "','" + dataInsert.SCHOLARSHIP_HISTORY_SEMESTER + "','" + dataInsert.SCHOLARSHIP_HISTORY_SCHOLARSHIP_CODE + "','" + dataInsert.SCHOLARSHIP_HISTORY_STUDENT_ID + "','" + dataInsert.SCHOLARSHIP_HISTORY_NATION_ID + "','" + dataInsert.SCHOLARSHIP_HISTORY_PASSPORT_ID + "','" + dataInsert.SCHOLARSHIP_HISTORY_SCHOLARSHIP_STARTDATE + "','" + dataInsert.SCHOLARSHIP_HISTORY_SCHOLARSHIP_ENDDATE + "','" + dataInsert.SCHOLARSHIP_HISTORY_SCHOLARSHIP_PERIOD + "','" + dataInsert.SCHOLARSHIP_HISTORY_SCHOLARSHIP_AMOUNT + "','" + dataInsert.SCHOLARSHIP_HISTORY_SCHOLARSHIP_IN_OUT + "','" + dataInsert.SCHOLARSHIP_HISTORY_SCHOLARSHIP_TYPE + "','" + dataInsert.SCHOLARSHIP_HISTORY_SCHOLARSHIP_SOURCE + "','" + dataInsert.SCHOLARSHIP_HISTORY_NEW_REGIS_FEE + "','" + dataInsert.SCHOLARSHIP_HISTORY_PROPERTIES_FEE + "','" + dataInsert.SCHOLARSHIP_HISTORY_STUDY_FACILITY_FEE + "','" + dataInsert.SCHOLARSHIP_HISTORY_IT_FEE + "','" + dataInsert.SCHOLARSHIP_HISTORY_LIBRARY_FEE + "','" + dataInsert.SCHOLARSHIP_HISTORY_HEALTH_FEE + "','" + dataInsert.SCHOLARSHIP_HISTORY_ACTIVITY_FEE + "','" + dataInsert.SCHOLARSHIP_HISTORY_CREDIT_3000 + "','" + dataInsert.SCHOLARSHIP_HISTORY_ACCIDENT_FEE + "','" + dataInsert.SCHOLARSHIP_HISTORY_BACHELOR_ACADEMIC_FEE + "','" + dataInsert.SCHOLARSHIP_HISTORY_MASTER_ACADEMIC_FEE + "','" + dataInsert.SCHOLARSHIP_HISTORY_SPECIAL_PROJECT_FEE + "','" + dataInsert.SCHOLARSHIP_HISTORY_SCHOLAR_FEE_COMMENT + "','" + dataInsert.SCHOLARSHIP_HISTORY_MULTIPLE_SCHOLARSHIP + "','" + dataInsert.SCHOLARSHIP_HISTORY_SCHOLARSHIP_STATUS + "','" +
              dataInsert.SCHOLARSHIP_HISTORY_FINE_FEE + "','" + historyStatus + "','" + dataInsert.SCHOLARSHIP_HISTORY_RECORD_TIME + "')";

        oracleObj.InsertCommand = sql;

        try
        {
            if (oracleObj.Insert() == 1)
            {
                response            = "OK";
                log_data.StatusCode = log_data.LogStatus_SUCCESS;
            }
            else
            {
                log_data.StatusCode = log_data.LogStatus_FAILED;
            }
        }
        catch (Exception e)
        {
            response            = e.Message.ToString() + " ";
            log_data.StatusCode = log_data.LogStatus_ERROR;
            log_data.Message   += " [" + e.ToString() + "]";
        }

        new Log().WriteLog(log_data);
        return(response);
    }
        public string WizardComplete(WizardModel model)
        {
            if (model.personalMessage.phrase.Length > 140)
            {
                Response.StatusCode = (int)System.Net.HttpStatusCode.Conflict;
                return("El mensaje personal superó los 140 caracteres.");
            }

            int userID = UserLoginData.GetSessionID(Session["UserLoggedIn"]);

            userBLL.UpdateAvatar(model.avatarImg, userID);
            userBLL.ChangePersonalPhrase(userID, model.personalMessage.phrase, model.personalMessage.color);

            return("Cambios guardados.");
        }
 public ActionResult NotesList(int folderID)
 {
     try
     {
         int userID = UserLoginData.GetSessionID(Session["UserLoggedIn"]);
         ContentInFolderModelView model = new ContentInFolderModelView(folderBLL.GetFolderDataBLL(folderID),
                                                                       folderBLL.GetNotesInFolderBLL(userID, folderID));
         return(View(model));
     }
     catch (Exception ex)
     {
         TempData["error"] = ex.Message;
         return(RedirectToAction("List"));
     }
 }
Beispiel #15
0
        public override void OnHandlerMessage(OperationRequest request, OperationResponse response, ClientPeer peer, SendParameters sendParameters)
        {
            Dictionary <byte, object> m_dic = request.Parameters;
            object value;
            string strUserName;
            string strUserPassword;

            if (m_dic.TryGetValue((byte)ParameterCode.UserRegiste, out value))
            {
                string strValue = value.ToString();
                strValue.Trim();
                log.Debug("UserRegisteHandler Get Data:" + strValue);
                string[] pStr = strValue.Split(',');
                if (pStr.Length == 2)
                {
                    strUserName     = pStr[0];
                    strUserPassword = pStr[1];
                    log.Debug("RegisterName:" + strUserName + "--RegisterPassword:"******"用户名重复!";
                        return;
                    }
                    else
                    {
                        UserLoginData newUser = new UserLoginData();
                        newUser.Name = strUserName;
                        string strMD5 = MD5Tool.StringToMD5(strUserPassword);
                        newUser.Password = strMD5;
                        int nID = m_mgr.AddUser(newUser);
                        peer.m_curUser = newUser;
                        Dictionary <byte, object> dic = new Dictionary <byte, object>();
                        dic.Add((byte)ParameterCode.UserRegiste, nID.ToString());
                        Helper.Log("注册新用户:" + nID.ToString());
                        response.Parameters = dic;
                        response.ReturnCode = (short)ReturnCode.Success;
                        log.Debug("UserRegiste Success: Add New User:"******"--P:" + strUserPassword + "--MD5:" + strMD5);
                        return;
                    }
                }
            }

            response.ReturnCode = (short)ReturnCode.Error;
            log.Debug("Login Error");
        }
Beispiel #16
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["login_data"] == null)
        {
            Response.Redirect("../index.aspx");
        }
        else
        {
            //ตรวจสอบสิทธิ์
            login_data = (UserLoginData)Session["login_data"];
            if (autro_obj.CheckGroupUser(login_data, group_var.officer_faculty) || autro_obj.CheckGroupUser(login_data, group_var.officer_department))
            {
                // ======== Process ===========
                if (!Page.IsPostBack)
                {
                    Session.Remove("CurrCode");
                    Session.Remove("YearVersion");
                    Session.Remove("NumTQF1");

                    List <TQF.Curriculum> curriculum = new TQF.Curriculum().getYearVersion();
                    ddlCOPY_YEAR_VERSION.Items.Clear();
                    ddlCOPY_YEAR_VERSION.Items.Insert(ddlCOPY_YEAR_VERSION.Items.Count, new ListItem("-- เลือกปี --", "0000"));
                    foreach (TQF.Curriculum row in curriculum)
                    {
                        ddlCOPY_YEAR_VERSION.Items.Insert(ddlCOPY_YEAR_VERSION.Items.Count, new ListItem(row.YearVersion, row.YearVersion));
                    }

                    ddlCOPY_CURR_CODE.Items.Clear();
                    ddlCOPY_CURR_CODE.Items.Insert(ddlCOPY_CURR_CODE.Items.Count, new ListItem("-- เลือกรหัสสูตรที่ต้องการปรับปรุง --", "000000000"));

                    if (autro_obj.CheckGroupUser(login_data, group_var.officer_faculty) || autro_obj.CheckGroupUser(login_data, group_var.officer_department))
                    {
                        rBtnNEW_SCURR.Enabled = true;
                    }
                    else
                    {
                        rBtnNEW_SCURR.Enabled = false;
                    }
                }
                //=============================
            }
            else
            {
                HttpContext.Current.Session["response"] = "ตรวจสอบไม่พบสิทธิ์การเข้าใช้งาน";
                HttpContext.Current.Response.Redirect("err_response.aspx");
            }
        }
    }
Beispiel #17
0
    public List <string> getOtherOffice_Authorized(UserLoginData login_data, string user_group_id)
    {
        List <string> OtherOffice_code = new List <string>();

        foreach (AuthorizedSystemData search in login_data.authorize_systemdData)
        {
            if (search.UserGroup_ID == user_group_id)
            {
                string code = "";
                code = search.OtherOffice_Authorized_Code;
                OtherOffice_code.Add(code);
            }
        }

        return(OtherOffice_code);
    }
Beispiel #18
0
        private bool updateLogindata()
        {
            UserLoginData loginData = db.UserLoginDatas.SingleOrDefault(x => x.username == this.uName);

            if (loginData != null)
            {
                loginData.email    = this.txtEmail.Text;
                loginData.username = this.txtUserName.Text;
                db.SubmitChanges();
                return(true);
            }
            else
            {
                return(false);
            }
        }
Beispiel #19
0
        public override void Execute(INotification notification)
        {
            Facade.instance.RegisterCommand(Const.CMD_LOGIN, () => new LoginCommand());
            LoginViewMediator mediator = new LoginViewMediator {
                ViewComponent = new LoginView()
            };

            Facade.instance.RegisterMediator(mediator);
            Facade.instance.RegisterProxy(new LoginViewProxy());

            UserLoginData loginData = new UserLoginData();

            loginData.setAccount("acc123");
            loginData.setPassword("pwd123");
            Facade.instance.SendNotification(Const.CMD_LOGIN, loginData);
        }
Beispiel #20
0
    public List <string> getDepartment_Authorized(UserLoginData login_data, string user_group_id)
    {
        List <string> department_code = new List <string>();

        foreach (AuthorizedSystemData search in login_data.authorize_systemdData)
        {
            if (search.UserGroup_ID == user_group_id)
            {
                string code = "";
                code = search.Department_Authorized_Code;
                department_code.Add(code);
            }
        }

        return(department_code);
    }
Beispiel #21
0
 public ActionResult Create(string toFolder)
 {
     try
     {
         int userID = UserLoginData.GetSessionID(Session["UserLoggedIn"]);
         CreateNoteModelView model = new CreateNoteModelView();
         this.PrepareModelToCreateNote(userID, ref model, Server.UrlDecode(toFolder));
         return(View(model));
     }
     catch (Exception ex)
     {
         return(RedirectToAction("InternalServerError", "Error", new {
             error = ex.InnerException is SqlException ? ex.InnerException.Message : ex.Message
         }));
     }
 }
 public ActionResult ChangeFolderPartial(int folderID, string folderName, int noteID)
 {
     try
     {
         ChangeFolderModelView model = new ChangeFolderModelView();
         model.FolderID        = folderID;
         model.NoteID          = noteID;
         model.CurrentFolder   = folderName;
         model.FoldersComboBox = folderBLL.GetFoldersOfUserBLL(UserLoginData.GetSessionID(Session["UserLoggedIn"]));
         return(PartialView("_ChangeFolder", model));
     }
     catch (Exception ex)
     {
         return(RedirectToAction("InternalServerError", "Error", new { error = ex.Message }));
     }
 }
Beispiel #23
0
    public void deleteFile(List <string> deleteFiles)
    {
        string FolderPath = ConfigurationManager.AppSettings["NewsUploadFiles"];

        UserLoginData login_data = (UserLoginData)HttpContext.Current.Session["login_data"];

        // ======== Log ========
        LogData log_data = new LogData();

        log_data.ModuleCode = new LogData().Module_News;
        log_data.Username   = login_data.User_ID;
        // =====================

        foreach (string FileName in deleteFiles)
        {
            log_data.Message = "Delete Files with:" + FileName;

            string FilePath = HttpContext.Current.Server.MapPath(FolderPath + (FileName));

            if (System.IO.File.Exists(FilePath))
            {
                try
                {
                    System.IO.File.Delete(FilePath);
                    // === Log ===
                    log_data.StatusCode = log_data.LogStatus_SUCCESS;
                    // ===========
                }
                catch (Exception e)
                {
                    // === Log ===
                    log_data.StatusCode = log_data.LogStatus_ERROR;
                    log_data.Message   += " [" + e.ToString() + "]";
                    // ===========
                }
            }
            else
            {
                // === Log ===
                log_data.Message   += " [File Not Found]";
                log_data.StatusCode = log_data.LogStatus_FAILED;
                // ===========
            }

            new Log().WriteLog(log_data);
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["login_data"] == null)
        {
            Response.Redirect("../index.aspx");
        }
        else
        {
            //ตรวจสอบสิทธิ์
            login_data = (UserLoginData)Session["login_data"];
            if (autro_obj.CheckGroupUser(login_data, group_var.admin_faculty))
            {
                /*=============================*/
                try
                {
                    if (!Page.IsPostBack)
                    {
                        fail.Visible       = false;
                        divSuccess.Visible = false;


                        string degree_char = Request.QueryString["degree"];
                        string course_type = Request.QueryString["course_type"];

                        hourRefer_data = new HourRefer().getHourRefer(degree_char, course_type);
                        ddlLevel.Items.FindByValue(hourRefer_data.Degree_Char).Selected     = true;
                        ddlCourseType.Items.FindByValue(hourRefer_data.CourseType).Selected = true;
                        txtReference_Hour.Text = hourRefer_data.HourRefer.ToString();

                        ddlLevel.Enabled      = false;
                        ddlCourseType.Enabled = false;
                    }
                }
                catch (Exception err)
                {
                    Session["response"] = err.ToString();
                    Response.Redirect("err_response.aspx");
                }
                /*=============================*/
            }
            else
            {
                HttpContext.Current.Session["response"] = "ตรวจสอบไม่พบสิทธิ์การเข้าใช้งาน";
                HttpContext.Current.Response.Redirect("err_response.aspx");
            }
        }
    }
Beispiel #25
0
    public string setPrereq(ApproveAdvisorData setData)
    {
        string response = "";

        UserLoginData loginData = new UserLoginData();

        loginData = (UserLoginData)HttpContext.Current.Session["login_data"];
        LogData log_data = new LogData();

        log_data.ModuleCode = new LogData().Module_Registration;
        log_data.Username   = loginData.User_ID;

        ConnectDB     db        = new ConnectDB();
        SqlDataSource oracleObj = db.ConnectionOracle();
        string        sql       = "Update ADVISOR_ALL_APPROVE";

        if (setData.Pre_Req != "")
        {
            sql += " Set PRE_REQ='" + setData.Pre_Req + "' ";
            log_data.Message = "Set pre_req with:" + setData.Pre_Req;
        }


        oracleObj.UpdateCommand = sql;

        try
        {
            if (oracleObj.Update() == 1)
            {
                response            = "OK";
                log_data.StatusCode = log_data.LogStatus_SUCCESS;
            }
            else
            {
                log_data.StatusCode = log_data.LogStatus_FAILED;
            }
        }
        catch (Exception e)
        {
            response            = e.Message.ToString();
            log_data.StatusCode = log_data.LogStatus_ERROR;
            log_data.Message   += " [" + e.ToString() + "]";
        }

        new Log().WriteLog(log_data);
        return(response);
    }
Beispiel #26
0
    public string insertAddProject(ProjectData dataInsert)
    {
        string      response = "";
        int         i        = 0;
        ProjectData field    = dataInsert;

        UserLoginData loginData = new UserLoginData();

        loginData = (UserLoginData)HttpContext.Current.Session["login_data"];
        LogData log_data = new LogData();

        log_data.ModuleCode = new LogData().Module_NewStdPayment;
        log_data.Username   = loginData.User_ID;
        log_data.Message    = "Insert Project_Addition With:" + field.Project_Code + "'," + field.Project_NewRegister_Fee + "," + field.Project_Card_Fee + "," + field.Project_IT_Fee + "," + field.Project_Health_Fee + "," + field.Project_Library_Fee + "," + field.Project_Properties_Fee + "," + field.Project_Accident_Fee + "," + field.Project_Academic_Fee + "," + field.Project_StudentStatus_Fee + "," + field.Project_Maintaining_Fee + "," + field.Project_Moral_Fee + "," + field.Project_Activity_Fee + "," + field.Project_Charge + "," + field.Project_QE_Fee + "," + field.Project_StudyFacility_Fee + "," + field.Project_StudentReturn_Fee;

        ConnectDB     db        = new ConnectDB();
        SqlDataSource oracleObj = db.ConnectionOracle();


        string sql = "Insert Into PROJECT_ADDITIONAL(PROJECT_CODE,THEORY_FEE,PRACTICE_FEE,THESIS_PROJ_FEE,PACKET_FEE,NEW_REGIS_FEE,CARD_FEE,IT_FEE,HEALTH_FEE,LIBRARY_FEE,PROPERTIES_FEE,ACCIDENT_FEE,ACADEMIC_FEE,STUDENT_STATUS_FEE,MAINTAINING_FEE,MORAL_FEE,ACTIVITY_FEE,CHARGE,QE_FEE,STUDY_FACILITY_FEE,STUDENT_RETURN_FEE) VALUES('" + field.Project_Code + "'," + field.Project_Theory_Fee + "," + field.Project_Practice_Fee + "," + field.Project_ThesisProject_Fee + "," + field.Project_Packet_Fee + "," + field.Project_NewRegister_Fee + "," + field.Project_Card_Fee + "," + field.Project_IT_Fee + "," + field.Project_Health_Fee + "," + field.Project_Library_Fee + "," + field.Project_Properties_Fee + "," + field.Project_Accident_Fee + "," + field.Project_Academic_Fee + "," + field.Project_StudentStatus_Fee + "," + field.Project_Maintaining_Fee + "," + field.Project_Moral_Fee + "," + field.Project_Activity_Fee + "," + field.Project_Charge + "," + field.Project_QE_Fee + "," + field.Project_StudyFacility_Fee + "," + field.Project_StudentReturn_Fee + ")";

        oracleObj.InsertCommand = sql;

        try
        {
            if (oracleObj.Insert() == 1)
            {
                response            = "OK";
                log_data.StatusCode = log_data.LogStatus_SUCCESS;
            }
            else
            {
                log_data.StatusCode = log_data.LogStatus_FAILED;
            }
        }
        catch (Exception e)
        {
            response            = e.Message.ToString();
            log_data.StatusCode = log_data.LogStatus_ERROR;
            log_data.Message   += " [" + e.ToString() + "]";
        }

        i++;

        new Log().WriteLog(log_data);
        return(response);
    }
Beispiel #27
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["login_data"] == null)
        {
            Response.Redirect("../index.aspx");
        }
        else
        {
            //ตรวจสอบสิทธิ์
            login_data = (UserLoginData)Session["login_data"];
            if (autro_obj.CheckGroupUser(login_data, group_var.admin_university) || autro_obj.CheckGroupUser(login_data, group_var.admin_faculty))
            {
                /*=============================*/
                FacultyCode = Request.QueryString["FacId"];

                if (!Page.IsPostBack)
                {
                    string sql = "Select * From FACULTY Where FACULTY_CODE='" + FacultyCode + "'";
                    facultyData = facultyObj.getFacultyManual(sql);

                    List <CampusData> campusData = new Campus().getCampus();
                    foreach (CampusData data in campusData)
                    {
                        ddlCampus.Items.Insert(ddlCampus.Items.Count, new ListItem(data.Campus_Thai, data.Campus_Code));
                    }
                    ddlCampus.Items.FindByValue(facultyData[0].Faculty_CampusCode).Selected = true;
                    txtFacultyCode.Text      = facultyData[0].Faculty_Code;
                    txtFacultyNameThai.Text  = facultyData[0].Faculty_Thai;
                    txtFacultyNameEng.Text   = facultyData[0].Faculty_Eng;
                    txtFacultyShortName.Text = facultyData[0].Faculty_ShortName;

                    statusData = statusObj.getSystemStatus();
                    foreach (StatusData data in statusData)
                    {
                        ddlFacultyStatus.Items.Insert(ddlFacultyStatus.Items.Count, new ListItem(data.Status_Thai, data.Status_Code));
                    }
                    ddlFacultyStatus.Items.FindByValue(facultyData[0].Faculty_Status).Selected = true;
                }
                /*=============================*/
            }
            else
            {
                HttpContext.Current.Session["response"] = "ตรวจสอบไม่พบสิทธิ์การเข้าใช้งาน";
                HttpContext.Current.Response.Redirect("err_response.aspx");
            }
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["login_data"] == null)
        {
            Response.Redirect("../index.aspx");
        }
        else
        {
            //ตรวจสอบสิทธิ์
            login_data = (UserLoginData)Session["login_data"];
            if (autro_obj.CheckGroupUser(login_data, group_var.admin_faculty))
            {
                /*=============================*/
                if (!Page.IsPostBack)
                {
                    fail.Visible       = false;
                    divSuccess.Visible = false;

                    // ประเภทอาจารย์
                    ddlLecturerType.Items.Clear();
                    List <LecturerType> lec_type = new List <LecturerType>();
                    lec_type = new LecturerType().getLecturerType2();
                    foreach (LecturerType row in lec_type)
                    {
                        ddlLecturerType.Items.Insert(ddlLecturerType.Items.Count, new ListItem(row.LecturerTypeName, row.LecturerTypeCode));
                    }
                    //===========

                    // ตำแหน่ง
                    ddlPosition.Items.Clear();
                    List <BoardPosData> position_data = new List <BoardPosData>();
                    position_data = new BoardPos().getBoardPos();
                    foreach (BoardPosData pos in position_data)
                    {
                        ddlPosition.Items.Insert(ddlPosition.Items.Count, new ListItem(pos.Position_Thai, pos.Position_Code));
                    }
                }
                /*=============================*/
            }
            else
            {
                HttpContext.Current.Session["response"] = "ตรวจสอบไม่พบสิทธิ์การเข้าใช้งาน";
                HttpContext.Current.Response.Redirect("err_response.aspx");
            }
        }
    }
Beispiel #29
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["login_data"] == null)
        {
            Response.Redirect("../index.aspx");
        }
        else
        {
            //ตรวจสอบสิทธิ์
            login_data = (UserLoginData)Session["login_data"];
            if (autro_obj.CheckGroupUser(login_data, group_var.officer_department) || autro_obj.CheckGroupUser(login_data, group_var.officer_faculty))
            {
                /*=============================*/
                if (!Page.IsPostBack)
                {
                    divSuccess.Visible = false;

                    try
                    {
                        lecturer      = Request.QueryString["lecturer"];
                        academic_year = Request.QueryString["year"];
                        semester      = Request.QueryString["semester"];

                        if (new AddWorkLoad().getAddWorkLoad(academic_year, semester, lecturer).Lecturer != null)
                        {
                            MsgValidate("ตรวจสอบพบข้อมูลในระบบ โปรดเลือกแก้ไข ข้อมูล");
                        }
                        else
                        {
                            fail.Visible = false;
                        }
                    }
                    catch (Exception err)
                    {
                        MsgValidate(err.ToString());
                    }
                }
                /*=============================*/
            }
            else
            {
                HttpContext.Current.Session["response"] = "ตรวจสอบไม่พบสิทธิ์การเข้าใช้งาน";
                HttpContext.Current.Response.Redirect("err_response.aspx");
            }
        }
    }
Beispiel #30
0
    // V1.0.0
    public string updateConfigStudentReg(ConfigStudentRegData dataUpdate)
    {
        string response = "";

        UserLoginData loginData = new UserLoginData();

        loginData = (UserLoginData)HttpContext.Current.Session["login_data"];
        LogData log_data = new LogData();

        log_data.ModuleCode = new LogData().Module_Registration;
        log_data.Username   = loginData.User_ID;
        log_data.Message    = "Update ConfigStudentRegistration with: " + dataUpdate.start_date + "," + dataUpdate.end_date + "," + dataUpdate.due_date + "," + dataUpdate.academic_year + "," + dataUpdate.semester + "," + dataUpdate.degree_char + "," + dataUpdate.faculty_code + "," + dataUpdate.student_academic_year;

        ConnectDB     db        = new ConnectDB();
        SqlDataSource oracleObj = db.ConnectionOracle();

        string sql = "";

        sql = "Update CONFIG_STD_REG SET START_DATE='" + dataUpdate.start_date + "',STOP_DATE = '" + dataUpdate.end_date + "',DUE_DATE = '" + dataUpdate.due_date + "' Where ACADEMIC='" + dataUpdate.academic_year + "' And SEMESTER='" + dataUpdate.semester + "' And DEGREE_CHAR='" + dataUpdate.degree_char + "' And FACULTY_CODE='" + dataUpdate.faculty_code + "' And STUDENT_ACADEMIC_YEAR='" + dataUpdate.student_academic_year + "' ";

        try
        {
            oracleObj.UpdateCommand = sql;


            if (oracleObj.Update() == 1)
            {
                log_data.StatusCode = log_data.LogStatus_SUCCESS;
                response            = "OK";
            }
            else
            {
                log_data.StatusCode = log_data.LogStatus_FAILED;
            }
        }
        catch (Exception e)
        {
            log_data.StatusCode = log_data.LogStatus_ERROR;
            log_data.Message   += " [" + e.ToString() + "]";
            HttpContext.Current.Session["response"] = "Unit Test:ConfigStudentReg:updateConfigStudentReg" + " ไม่สามารถดำเนินการได้ ";
            HttpContext.Current.Response.Redirect("err_response.aspx");
        }

        new Log().WriteLog(log_data);
        return(response);
    }
Beispiel #31
0
    /// <summary>
    /// แก้ไขข้อมูลจากตาราง SYSUSER
    /// </summary>
    /// <param name="updateData">SysUser Object</param>
    /// <returns>Success</returns>
    public string updateSysUser(SysUser updateData)
    {
        string response = "";


        UserLoginData loginData = new UserLoginData();

        loginData = (UserLoginData)HttpContext.Current.Session["login_data"];
        LogData log_data = new LogData();

        log_data.ModuleCode = new LogData().Module_Advisor;
        log_data.Username   = loginData.User_ID;
        log_data.Message    = "Update Lecturer with: " + updateData.IdCode;

        ConnectDB     db        = new ConnectDB();
        SqlDataSource oracleObj = db.ConnectionOracle_tqf2();

        string sql = "Update SYSUSER Set FACULTYCODE = '" + updateData.FacultyCode + "',TITLENAMECODE = '" + updateData.TitleNameCode + "',DEPARTMENTCODE = '" + updateData.DepartmentCode + "',USERTYPECODE = '" + updateData.UserTypeCode + "',THNAME = '" + updateData.ThName + "',ENNAME = '" + updateData.EnName + "',THSURNAME = '" + updateData.ThSurName + "',ENSURNAME = '" + updateData.EnSurName + "',USERNAME = '******',PASSWORD = '******',POSITION = '" + updateData.Position + "',ADDRESS = '" + updateData.Address + "',TEL = '" + updateData.Tel + "',EMAIL = '" + updateData.Email + "',OPENSTATUS = '" + updateData.OpenStatus + "',PASSSPORTCODE = '" + updateData.PassportCode + "',SEX = '" + updateData.Sex + "',ACADEMICPOSITIONCODE = '" + updateData.AcademicPositionCode + "',DIVISIONCODE = '" + updateData.DivisionCode + "',BIRTHDAY = '" + updateData.BirthDay + "',BIRTHPROVINCE = '" + updateData.BirthProvince + "',BIRTHPLACE = '" + updateData.BirthPlace + "',COUNTRY = '" + updateData.Country + "',NATIONALITY = '" + updateData.Nationality + "',ETHNICITY = '" + updateData.Ethnicity + "',HEIGHT = '" + updateData.Height + "',WEIGHT = '" + updateData.Weight + "',MARITAL = '" + updateData.Marital + "',OCCUPATION = '" + updateData.Occupation + "',MOBILENUMBER = '" + updateData.MobileNumber + "',TALENT = '" + updateData.Talent + "',HOMENUMBER = '" + updateData.HomeNumber + "',HOMEBUILDING = '" + updateData.HomeBuilding + "',HOMEVILLAGE = '" + updateData.HomeVillage + "',HOMEMOO = '" + updateData.HomeMoo + "',HOMESOI = '" + updateData.HomeSoi + "',HOMEROAD = '" + updateData.HomeRoad + "',HOMETUMBOL = '" + updateData.HomeTumbol + "',HOMEAMPHUR = '" + updateData.HomeAmphur + "',HOMEPROVINCE = '" + updateData.HomeProvince + "',HOMEPOSTCODE = '" + updateData.HomePostCode + "',OFFICENAME = '" + updateData.OfficeName + "',OFFICENUMBER = '" + updateData.OfficeNumber + "',OFFICEBUILDING = '" + updateData.OfficeBuilding + "',OFFICEVILLAGE = '" + updateData.OfficeVillage + "',OFFICEMOO = '" + updateData.OfficeMoo + "',OFFICESOI = '" + updateData.OfficeSoi + "',OFFICEROAD = '" + updateData.OfficeRoad + "',OFFICETUMBOL = '" + updateData.OfficeTumbol + "',OFFICEAMPHUR = '" + updateData.OfficeAmphur + "',OFFICEPROVINCE = '" + updateData.OfficeProvince + "',OFFICEPOSTCODE = '" + updateData.OfficePostCode + "',AFFILIATION = '" + updateData.Affiliation + "',GRAD_LECTURER = '" + updateData.GradLecturer + "',SHORT_NAME = '" + updateData.ShortName + "' Where IDCODE = '" + updateData.IdCode + "'";

        oracleObj.UpdateCommand = sql;

        try
        {
            if (oracleObj.Update() == 1)
            {
                response            = "Success";
                log_data.StatusCode = log_data.LogStatus_SUCCESS;
            }
            else
            {
                log_data.StatusCode = log_data.LogStatus_FAILED;
            }
        }
        catch (Exception e)
        {
            log_data.StatusCode = log_data.LogStatus_ERROR;
            log_data.Message   += " [" + e.ToString() + "]";

            string exception = e.Message;
            HttpContext.Current.Session["response"] = "updateLecturer: " + exception;
            HttpContext.Current.Response.Redirect("../err_response.aspx");
        }

        new Log().WriteLog(log_data);
        return(response);
    }
Beispiel #32
0
    void Start()
    {
        gameObject.AddComponent<AudioSource>();

        if(File.Exists(Application.persistentDataPath + "/username.gd")) {
            BinaryFormatter bf = new BinaryFormatter();
            FileStream file = File.Open(Application.persistentDataPath + "/username.gd", FileMode.Open);
            try{
                userLoginData = (UserLoginData)bf.Deserialize(file);
            }catch(System.Exception ex){
                Debug.LogError(ex.Message);
                userLoginData = new UserLoginData("SmartEnglish","test","englishteacher","test",LanguageCode.EN);
            }
            file.Close();
        }else{

            userLoginData = new UserLoginData("SmartEnglish","test","englishteacher","test",LanguageCode.EN);
            //userLoginData = new UserLoginData("SmartGreek","SmartGreek","GreekTeacher2","password");

        }

        LocalisationMang.langCode = userLoginData.language;

        poRef = PersistentObjMang.getInstance();

        connectionTest=new ConnectionError("",RoutineStatus.IDLE);
        //testConnection();

        prepUIElements();

        downloader(true);
    }