Exemplo n.º 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                if (Request.QueryString["dat"] != null)
                {
                    String   getdata = Utils.CryptoBase64.Decryption(Request.QueryString["dat"].ToString());
                    String[] datas   = getdata.Split('|');
                    if (datas.Length == 3)
                    {
                        txtUserName.Text = datas[0];
                        txtOldPassword.Attributes.Add("value", datas[2]);

                        PersonBiz personBiz = new PersonBiz();
                        var       res       = personBiz.UserAuthen(txtUserName.Text, datas[2], false, "");
                        if (res.IsError || res.DataResponse == null)
                        {
                            Response.Redirect(PageList.Home);
                        }

                        txtOldPassword.Enabled = false;
                        txtUserName.Enabled    = false;
                        DTO.UserProfile userProfile = res.DataResponse;
                        Session[PageList.UserProfile] = userProfile;
                        txtUserName.Text = userProfile.LoginName;
                    }
                }
                else
                {
                    PushAuthen();
                }
            }
        }
Exemplo n.º 2
0
        protected void LinkButtonDelete_Click(Object sender, EventArgs e)
        {
            var gv = (GridViewRow)((LinkButton)sender).NamingContainer;
            //gv.Cells[0].Visible = true;
            string strNo = ((Label)gv.Cells[0].Controls[0]).Text;

            BLL.DataCenterBiz biz      = new BLL.DataCenterBiz();
            DTO.UserProfile   profiles = (DTO.UserProfile)HttpContext.Current.Session[PageList.UserProfile];
            string            Alert    = "confirm('" + Resources.infoSettingAttach_001 + "')";

            ToolkitScriptManager.RegisterClientScriptBlock(this, this.GetType(), "confirm", Alert, true);
            var res = biz.DeleteConfigDocument(Convert.ToInt16(strNo), profiles);

            if (res.IsError)
            {
                UCModalError.ShowMessageError = res.ErrorMsg;
                UCModalError.ShowModalError();
            }
            else
            {
                UCModalSuccess.ShowMessageSuccess = SysMessage.DeleteConfigLicense;
                UCModalSuccess.ShowModalSuccess();
                UpdatePanelGrid.Update();
            }
        }
Exemplo n.º 3
0
        private void ShowMenu()
        {
            string toPage = string.Empty;

            if (Session[PageList.UserProfile] != null)
            {
                DTO.UserProfile userProfile = (DTO.UserProfile)Session[PageList.UserProfile];
                Session["LoginUser"] = userProfile.LoginName;

                if (userProfile.IS_APPROVE != "N")
                {
                    if (userProfile != null)
                    {
                        if (userProfile.MemberType == DTO.RegistrationType.General.GetEnumValue())
                        {
                            mnuPerson.Visible = true;
                        }
                        else if (userProfile.MemberType == DTO.RegistrationType.Insurance.GetEnumValue())
                        {
                            mnuCompany.Visible = true;
                        }
                        else if (userProfile.MemberType == DTO.RegistrationType.Association.GetEnumValue())
                        {
                            mnuAssociation.Visible = true;
                        }
                        else if (userProfile.MemberType == DTO.RegistrationType.OIC.GetEnumValue())
                        {
                            mnuOIC.Visible = true;
                        }
                        else if (userProfile.MemberType == DTO.RegistrationType.TestCenter.GetEnumValue())
                        {
                            mnuExamPlaceGroup.Visible = true;
                        }
                        else if (userProfile.MemberType == DTO.RegistrationType.OICFinace.GetEnumValue())
                        {
                            mnuOICFinace.Visible = true;
                        }
                        else if (userProfile.MemberType == DTO.RegistrationType.OICAgent.GetEnumValue())
                        {
                            mnuOICAgent.Visible = true;
                        }
                    }
                }
                else
                {
                    if (userProfile.MemberType == DTO.RegistrationType.General.GetEnumValue())
                    {
                        mnuNewGeneral.Visible = true;
                    }
                    else if (userProfile.MemberType == DTO.RegistrationType.Insurance.GetEnumValue())
                    {
                        mnuNewCompany.Visible = true;
                    }
                    else if (userProfile.MemberType == DTO.RegistrationType.Association.GetEnumValue())
                    {
                        mnuNewAssociate.Visible = true;
                    }
                }
            }
        }
Exemplo n.º 4
0
 public void DTO2DB(DTO.UserProfile dtoItem, ref Employee dbItem, string TmpFile, int userId)
 {
     // employee
     AutoMapper.Mapper.Map <DTO.UserProfile, Employee>(dtoItem, dbItem);
     if (!string.IsNullOrEmpty(dtoItem.DateOfBirth))
     {
         if (DateTime.TryParse(dtoItem.DateOfBirth, nl, System.Globalization.DateTimeStyles.None, out tmpDate))
         {
             dbItem.DateOfBirth = tmpDate;
         }
     }
     if (!string.IsNullOrEmpty(dtoItem.DateStart))
     {
         if (DateTime.TryParse(dtoItem.DateStart, nl, System.Globalization.DateTimeStyles.None, out tmpDate))
         {
             dbItem.DateStart = tmpDate;
         }
     }
     if (dtoItem.HasChanged)
     {
         dbItem.PersonalPhoto = fwFactory.CreateFilePointer(TmpFile, dtoItem.NewFile, dbItem.PersonalPhoto);
     }
     if (dtoItem.CVHasChanged)
     {
         dbItem.ResumeFile = fwFactory.CreateNoneImageFilePointer(TmpFile, dtoItem.CVNewFile, dbItem.ResumeFile, dtoItem.CVFileName);
     }
     foreach (DTO.EmployeeFactory dtoFactory in dtoItem.EmployeeFactories)
     {
         EmployeeFactory dbFactory = dbItem.EmployeeFactory.FirstOrDefault(o => o.EmployeeFactoryID == dtoFactory.EmployeeFactoryID);
         AutoMapper.Mapper.Map <DTO.EmployeeFactory, EmployeeFactory>(dtoFactory, dbFactory);
     }
 }
Exemplo n.º 5
0
        /// <summary>
        /// Check สถานะการอนุมัติ
        /// ยังไม่ทำการอนุมัติ(สมัคร) > IS_APPROVE="N" && STATUS=1
        /// และ ไม่อนุมัติ(สมัคร) > IS_APPROVE="N" && STATUS=3
        /// </summary>
        private void StatusInit()
        {
            DTO.UserProfile usrProfile = (DTO.UserProfile)Session[PageList.UserProfile];

            if (usrProfile.IS_APPROVE.Equals("N"))
            {
                ResponseService <Registration> res;
                using (BLL.RegistrationBiz biz = new BLL.RegistrationBiz())
                {
                    res = biz.GetById(this.UserProfile.Id);
                }

                if (!res.IsError)
                {
                    if (res.DataResponse.STATUS == DTO.RegistrationStatus.WaitForApprove.GetEnumValue().ToString())
                    {
                        lblMessage.Text    = this.waitApprove;
                        lblMessage.Visible = true;
                    }
                    else if (res.DataResponse.STATUS == DTO.RegistrationStatus.NotApprove.GetEnumValue().ToString())
                    {
                        lblMessage.Text    = this.notApprove;
                        lblMessage.Visible = true;
                    }
                }
            }
        }
Exemplo n.º 6
0
 private void SetSessionLogin(DTO.UserProfile profile)
 {
     HttpContext.Current.Session["LogingName"]  = profile.LoginName;
     HttpContext.Current.Session["OICUserId"]   = profile.OIC_User_Id;
     HttpContext.Current.Session["DeptCode"]    = profile.DeptCode;
     HttpContext.Current.Session["CompanyCode"] = profile.CompCode;
     HttpContext.Current.Session["CreatedBy"]   = profile.Id;
 }
Exemplo n.º 7
0
        public DTO.ResponseMessage <bool> IsChangePassword(DTO.UserProfile userProfile)
        {
            DTO.ResponseMessage <Boolean> res = new DTO.ResponseMessage <bool>();
            try
            {
                var User = base.ctx.AG_IAS_USERS.FirstOrDefault(s => s.USER_ID == userProfile.Id);
                if (User == null)
                {
                    res.ErrorMsg = "ไม่พบข้อมูลผู้ใช้งาน";
                    LoggerFactory.CreateLog().LogError(String.Format("ไม่พบข้อมูลผู้ใช้งาน AG_IAS_USERS->USER_ID :{0}", userProfile.Id));
                    return(res);
                }

                res.ResultMessage = false;

                // เปลี่ยนรหัสผ่านครั้งแรกที่ Login เฉพาะเจ้าหน้าที่สนามสอบ
                if (User.USER_TYPE == "7")
                {
                    var begin_config = base.ctx.AG_IAS_APPROVE_CONFIG.FirstOrDefault(s => s.KEYWORD == "Change_Password_Begin");
                    if (begin_config.ITEM_VALUE == "Y" && String.IsNullOrEmpty(User.RESET_TIMES.ToString()))
                    {
                        res.ResultMessage = true;
                        return(res);
                    }
                }

                //เปลี่ยนทุก 3 เดือน
                var month_config = base.ctx.AG_IAS_APPROVE_CONFIG.FirstOrDefault(s => s.KEYWORD == "Change_Password_3months");
                if (month_config.ITEM_VALUE == "Y")
                {
                    int      addMonths  = 3;
                    DateTime ChangsPass = (DateTime)User.LASTPASSWORD_CHANGDATE;

                    string formatCurrDate = DateTime.Now.ToString("dd/MM/yyyy");
                    string formatPassDate = (ChangsPass.AddMonths(addMonths)).ToString("dd/MM/yyyy");

                    DateTime currTime = DateTime.Parse(formatCurrDate);
                    DateTime passTime = DateTime.Parse(formatPassDate);

                    int dateCompare = DateTime.Compare(passTime, currTime);
                    // วันที่เปลี่ยน password ล่าสุด + เงื่อนไข  แล้วน้อยกว่าวันที่ปัจจุบัน
                    if (dateCompare < 1)
                    {
                        res.ResultMessage = true;
                    }
                    else
                    {
                        res.ResultMessage = false;
                    }
                }
            }
            catch (Exception ex)
            {
                res.ErrorMsg = "พบข้อผิดพลาดในการตรวจสอบการเปลี่ยนรหัสผ่าน";
                LoggerFactory.CreateLog().Fatal(string.Format("AccountService_IsChangePassword USER_ID :{0}", userProfile.Id), ex);
            }
            return(res);
        }
Exemplo n.º 8
0
        public void SetDisapprove(DTO.UserProfile userProfile)
        {
            if (userProfile.MemberType != (int)DTO.MemberType.OIC)
            {
                throw new ApplicationException(Resources.errorBaseRegistration_002);
            }

            this.STATUS = ((int)States.RegistrationStatus.Disapprove).ToString();

            this._state.Disapprove(this);
        }
Exemplo n.º 9
0
        protected void btnOk_Click(object sender, EventArgs e)
        {
            DTO.ResponseMessage <bool> resValidate = this.RegPassValidation();
            if (resValidate.ResultMessage == false)
            {
                UCModalError.ShowMessageError = this.RegPassValidation().ErrorMsg;
                UCModalError.ShowModalError();
                return;
            }
            else if (resValidate.ResultMessage == true)
            {
                if (txtNewPassword.Text == txtConfirmPassword.Text)
                {
                    //chek รหัสเดิมห้ามตรงกับรหัสใหม่
                    if (txtOldPassword.Text == txtNewPassword.Text)
                    {
                        UCModalError.ShowMessageError = "รหัสผ่านใหม่ห้ามซ้ำกับรหัสผ่านเดิม";
                        UCModalError.ShowModalError();
                        return;
                    }



                    var biz = new BLL.UserAuthenBiz();

                    if (Session[PageList.UserProfile] != null)
                    {
                        DTO.UserProfile userProfile = (DTO.UserProfile)Session[PageList.UserProfile];
                        var             res         = biz.ChangePassword(userProfile.Id, txtOldPassword.Text, txtNewPassword.Text);
                        if (res.IsError)
                        {
                            var errorMsg = res.ErrorMsg;

                            UCModalError.ShowMessageError = res.ErrorMsg;
                            UCModalError.ShowModalError();
                            return;
                        }
                        else
                        {
                            string Alert = "alert('" + Resources.infoSysMessage_RegisSuccess2 + "');window.location.assign('../home.aspx')";
                            ToolkitScriptManager.RegisterStartupScript(this, this.GetType(), "alert", Alert, true);
                        }
                    }
                    else
                    {
                        var errorMsg = Resources.errorChangePass_001;

                        UCModalError.ShowMessageError = errorMsg;
                        UCModalError.ShowModalError();
                        return;
                    }
                }
            }
        }
Exemplo n.º 10
0
 GetLicenseByCriteria(string licenseNo, string licenseType,
                      DateTime?startDate, DateTime?toDate,
                      string paymentNo, string licenseTypeReceive,
                      DTO.UserProfile userProfile,
                      int pageNo, int recordPerPage)
 {
     return(svc.GetLicenseByCriteria(licenseNo, licenseType,
                                     startDate, toDate,
                                     paymentNo, licenseTypeReceive,
                                     userProfile,
                                     pageNo, recordPerPage));
 }
Exemplo n.º 11
0
 GetPaymentByCriteria(DTO.UserProfile userProfile,
                      string paymentType,
                      DateTime?startDate, DateTime?toDate,
                      string idCard, string billNo,
                      int pageNo, int recordPerPage)
 {
     return(svc.GetPaymentByCriteria(userProfile,
                                     paymentType,
                                     startDate, toDate,
                                     idCard, billNo,
                                     pageNo, recordPerPage));
 }
Exemplo n.º 12
0
 public DTO.ResponseService <DataSet> GetListLicenseDetailByPersonal(string licenseNo, string licenseType,
                                                                     DateTime?startDate, DateTime?toDate,
                                                                     string paymentNo, string licenseTypeReceive,
                                                                     DTO.UserProfile userProfile,
                                                                     int pageNo, int recordPerPage, Boolean CountAgain)
 {
     return(svc.GetListLicenseDetailByPersonal(licenseNo, licenseType,
                                               startDate, toDate,
                                               paymentNo, licenseTypeReceive,
                                               userProfile,
                                               pageNo, recordPerPage, CountAgain));
 }
Exemplo n.º 13
0
 public DTO.ResponseService <DataSet> GetListLicenseDetailAdminByCriteria(string licenseNo, string licenseType,
                                                                          DateTime?startDate, DateTime?toDate,
                                                                          string paymentNo, string licenseTypeReceive,
                                                                          DTO.UserProfile userProfile,
                                                                          int pageNo, int recordPerPage, string PageCount)
 {
     return(svc.GetListLicenseDetailAdminByCriteria(licenseNo, licenseType,
                                                    startDate, toDate,
                                                    paymentNo, licenseTypeReceive,
                                                    userProfile,
                                                    pageNo, recordPerPage, PageCount));
 }
Exemplo n.º 14
0
        private String GetSourceType(DTO.UserProfile userProfile)
        {
            switch (userProfile.MemberType)
            {
            case 2: return("C");

            case 3: return("A");

            default:
                return("");
            }
        }
Exemplo n.º 15
0
        public LicenseFileHeader(IAS.DAL.Interfaces.IIASPersonEntities ctx, DTO.UserProfile userProfile, String fileName, String pettitionTypeCode, String licenseTypeCode)
        {
            _ctx = ctx;
            String id = OracleDB.GetGenAutoId();

            this.IMPORT_ID = Convert.ToInt64(id);
            //this.LICENSE_TYPE_CODE = licenseTypeCode;
            this.PETTITION_TYPE            = pettitionTypeCode;
            this._pettitionTypeUserRequest = pettitionTypeCode;
            this._licenseTypeUserRequest   = licenseTypeCode;
            this.FILE_NAME = fileName;
            _userProfile   = userProfile;
        }
Exemplo n.º 16
0
        GetCountPaymentDetailByCriteria(DTO.UserProfile userProfile,
                                        string paymentType,
                                        string order,
                                        DateTime?startDate, DateTime?toDate,
                                        string idCard, string billNo, string ViewYear)

        {
            return(svc.GetCountPaymentDetailByCriteria(userProfile,
                                                       paymentType,
                                                       order,
                                                       startDate, toDate,
                                                       idCard, billNo, ViewYear));
        }
Exemplo n.º 17
0
 private static DTO.UserProfile CreateUserProfile()
 {
     DTO.UserProfile userProfile;
     userProfile = new DTO.UserProfile()
     {
         Id         = "131106132209758",
         MemberType = 2,
         LoginName  = "testname",
         STATUS     = "A",
         CompCode   = "1022"
     };
     return(userProfile);
 }
Exemplo n.º 18
0
 public ExamFileHeader(ExamFileHeaderRequest request)
 {
     _ctx              = request.Context;
     UPLOAD_GROUP_NO   = OracleDB.GetGenAutoId();
     _createBy         = request.UserProfile;
     ASSOCIATE_NAME    = ExamSubStringHelper.Get(request.LineData, 1, 80).Trim();
     LICENSE_TYPE_CODE = ExamSubStringHelper.Get(request.LineData, 81, 2).Trim();
     PROVINCE_CODE     = ExamSubStringHelper.Get(request.LineData, 83, 2).Trim();
     ASSOCIATE_CODE    = ExamSubStringHelper.Get(request.LineData, 85, 3).Trim();
     TESTING_DATE      = ExamSubStringHelper.Get(request.LineData, 88, 10).Trim();
     EXAM_TIME_CODE    = ExamSubStringHelper.Get(request.LineData, 98, 2).Trim();
     CNT_PER           = request.LineData.Length > 100
         ? ExamSubStringHelper.Get(request.LineData, 100, request.LineData.Length).Trim():"";
 }
Exemplo n.º 19
0
        protected void btn4_Click(object sender, EventArgs e)
        {
            var biz = new BLL.PaymentBiz();

            DTO.UserProfile userProfile = new DTO.UserProfile
            {
                CompCode   = "1008",
                Id         = "123",
                IdCard     = "456",
                MemberType = 2,
            };
            //var res =  biz.GetSubGroup("01", userProfile, 0, 10);
            //gv.DataSource = res.DataResponse;
            //gv.DataBind();
        }
        public void LicenseRequest_UploadFile_ValidationTest()
        {
            IAS.DAL.Interfaces.IIASPersonEntities ctx = DAL.DALFactory.GetPersonContext();
            DTO.UserProfile userProfile = CreateUserProfile();

            DTO.UploadData data     = ReadDataFromFile("ขอใหม่ - li01_1001_84.csv");
            String         fileName = "testData.txt";
            //LicenseFileHeader licenseHeader = LicenseFileFactory.ConcreateLicenseRequest(ctx, userProfile, fileName, data, "11");


            var res = CreateLicenseDataResponse();


            //res.DataResponse = licenseHeader.ValidateDataOfKTB();
            //if (res.IsError)
            //{
            //    throw new ApplicationException(res.ErrorMsg);
            //}

            //AG_IAS_TEMP_PAYMENT_HEADER payment_g_t = new AG_IAS_TEMP_PAYMENT_HEADER();
            //licenseHeader.MappingToEntity<CityFileHeader, AG_IAS_TEMP_PAYMENT_HEADER>(payment_g_t);
            //ctx.AG_IAS_TEMP_PAYMENT_HEADER.AddObject(payment_g_t);

            //foreach (CityFileDetail item in licenseHeader.CityFileDetails)
            //{
            //    AG_IAS_TEMP_PAYMENT_DETAIL detail = new AG_IAS_TEMP_PAYMENT_DETAIL();
            //    item.MappingToEntity<AG_IAS_TEMP_PAYMENT_DETAIL>(detail);
            //    ctx.AG_IAS_TEMP_PAYMENT_DETAIL.AddObject(detail);
            //}


            //ctx.AG_IAS_TEMP_PAYMENT_TOTAL.AddObject(licenseHeader.GetAG_IAS_TEMP_PAYMENT_TOTAL());

            //try
            //{
            //    using (var ts = new TransactionScope())
            //    {
            //        ctx.SaveChanges();
            //        ts.Complete();
            //    }
            //}
            //catch (Exception ex)
            //{

            //    throw;
            //}
        }
Exemplo n.º 21
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!Page.IsPostBack)
     {
         Class.CustomConfigTable ConfigTable1 = new Class.CustomConfigTable("11");
         ConfigTable1.PetitionTypeCode = "11";
         ConfigTable1.ViewStateMode    = System.Web.UI.ViewStateMode.Enabled;
         DTO.UserProfile user = new DTO.UserProfile();
         user.Name = "pichit";
         Session[PageList.UserProfile] = user;
         Session["ConfigTable1"]       = ConfigTable1;
         pnlMain.Controls.Add(ConfigTable1);
     }
     else
     {
         pnlMain.Controls.Add((Class.CustomConfigTable)Session["ConfigTable1"]);
     }
 }
Exemplo n.º 22
0
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            ReceiveLicenseHeader rech = new ReceiveLicenseHeader();
            var arrCom = ddlCompany.SelectedValue.Split('[', ']');

            rech.IMPORT_DATETIME   = DateTime.Now;
            rech.PETTITION_TYPE    = ddlRequestLicenseType.SelectedValue;
            rech.LICENSE_TYPE_CODE = rech.LICENSE_TYPE = ddlLicenseType.SelectedValue;
            rech.COMP_CODE         = arrCom[1];
            rech.COMP_NAME         = arrCom[0];
            rech.SEND_DATE         = DateTime.Today;
            rech.TOTAL_AGENT       = 1;
            rech.TOTAL_FEE         = txtFee.Text.ToDecimal();

            ReceiveLicenseDetail recd = new ReceiveLicenseDetail();

            recd.IMPORT_ID     = rech.IMPORT_ID;
            recd.PETITION_TYPE = rech.PETTITION_TYPE;
            recd.COMP_CODE     = rech.COMP_CODE;
            recd.SEQ           = "0001";
            recd.LICENSE_FEE   = txtFee.Text.ToDecimal();
            recd.LICENSE_NO    = txtLicenseNumber.Text;
            recd.CITIZEN_ID    = base.IdCard;
            recd.TITLE_NAME    = base.UserProfile.TitleName;
            recd.NAME          = base.UserProfile.Name;
            recd.SURNAME       = base.UserProfile.LastName;

            AttatchFileLicense att = new AttatchFileLicense();
            UserProfile        a   = new DTO.UserProfile();

            BLL.LicenseBiz biz = new BLL.LicenseBiz();
            var            res = biz.InsertSingleReceiveLicense(rech, recd, base.UserProfile);

            if (res.IsError)
            {
                UCModalError.ShowMessageError = res.ErrorMsg;
                UCModalError.ShowModalError();
            }
            else
            {
                UCModalSuccess.ShowMessageSuccess = SysMessage.SuccessInsertLicenseSingle;
                UCModalSuccess.ShowModalSuccess();
            }
        }
        public void LicenseRequestFactory_Can_Reader_ComposeFile()
        {
            IAS.DAL.Interfaces.IIASPersonEntities ctx = DAL.DALFactory.GetPersonContext();
            DTO.UserProfile userProfile = CreateUserProfile();

            String filepath = @"D:\OIC\IAS\IAS.DataServiceTest\SimpleFile\83.rar";

            DTO.DataLicenseRequest request = new DataLicenseRequest()
            {
                FileName          = filepath,
                LicenseTypeCode   = "01",
                PettitionTypeCode = "01",
                UserProfile       = userProfile
            };

            DTO.ResponseService <LicenseFileHeader> res = LicenseFileFactory.ConcreateLicenseRequest(ctx, request);


            Assert.IsNotNull(res.DataResponse);
        }
Exemplo n.º 24
0
        private ApplicantFileHeader CreateHeader()
        {
            String testingNumber = "561644";

            DTO.UserProfile userProfile = CreateUserProfile();
            String          filename    = "test.txt";

            String[] _lineData             = _header.Split(',');
            ApplicantHeaderRequest request = new ApplicantHeaderRequest()
            {
                Context       = ctx,
                UserProfile   = userProfile,
                FileName      = filename,
                TestingNumber = testingNumber,
                LineData      = _lineData
            };
            ApplicantFileHeader applicantHeader = ConcreateApplicantFileHeader(request);

            return(applicantHeader);
        }
Exemplo n.º 25
0
        public bool UpdateEmployee(int userId, int id, object dtoItem, out Library.DTO.Notification notification)
        {
            DTO.UserProfile dtoProfile = ((Newtonsoft.Json.Linq.JObject)dtoItem).ToObject <DTO.UserProfile>();
            notification = new Library.DTO.Notification()
            {
                Type = Library.DTO.NotificationType.Success
            };
            try
            {
                using (User2MngEntities context = CreateContext())
                {
                    Employee dbItem = context.Employee.FirstOrDefault(o => o.EmployeeID == id);
                    if (dbItem == null)
                    {
                        throw new Exception("Employee not found!");
                    }
                    dbItem.UpdatedBy   = userId;
                    dbItem.UpdatedDate = DateTime.Now;
                    converter.DTO2DB(dtoProfile, ref dbItem, FrameworkSetting.Setting.AbsoluteUserTempFolder + userId.ToString() + @"\", userId);
                    dbItem.EmployeeFactory.ToList().ForEach(o => context.EmployeeFactory.Remove(o));
                    foreach (DTO.EmployeeFactory dtoFactory in dtoProfile.EmployeeFactories)
                    {
                        EmployeeFactory dbFactory = new EmployeeFactory();
                        dbItem.EmployeeFactory.Add(dbFactory);
                        dbFactory.FactoryID = dtoFactory.FactoryID;
                    }
                    context.SaveChanges();

                    return(true);
                }
            }
            catch (Exception ex)
            {
                notification = new Library.DTO.Notification()
                {
                    Message = ex.Message, Type = Library.DTO.NotificationType.Error
                };
                return(false);
            }
        }
Exemplo n.º 26
0
        public ApplicantFileHeader(ApplicantHeaderRequest request)
        {
            flagRoomExam    = true;
            _applyDate      = DateTime.Now;
            _ctx            = request.Context;
            UPLOAD_GROUP_NO = OracleDB.GetGenAutoId();
            SOURCE_TYPE     = GetSourceType(request.UserProfile);
            _testingNumber  = request.TestingNumber;
            _examPlaceCode  = request.ExamPlaceCode;

            _createBy = request.UserProfile;

            PROVINCE_CODE = request.LineData.GetIndexOf(1);
            //EXAM_PLACE_CODE = request.LineData.GetIndexOf(1);
            COMP_CODE         = request.LineData.GetIndexOf(2);
            LICENSE_TYPE_CODE = request.LineData.GetIndexOf(3);
            TESTING_DATE      = PhaseDateHelper.PhaseToDate(request.LineData.GetIndexOf(4));
            EXAM_APPLY        = PhaseApplyAmountHelper.Phase(request.LineData.GetIndexOf(5));
            EXAM_AMOUNT       = PhaseCurrencyAmount.Phase(request.LineData.GetIndexOf(6));
            TEST_TIME_CODE    = request.LineData.GetIndexOf(7);
            FILENAME          = request.FileName;
            this._examLicense = CTX.AG_EXAM_LICENSE_R.SingleOrDefault(w => w.TESTING_NO == _testingNumber && w.EXAM_PLACE_CODE == _examPlaceCode);
            this._examPlace   = _ctx.AG_EXAM_PLACE_R.SingleOrDefault(w => w.EXAM_PLACE_CODE == _examPlaceCode);
            this._examTime    = _ctx.AG_EXAM_TIME_R.SingleOrDefault(w => w.TEST_TIME_CODE == _examLicense.TEST_TIME_CODE);
            this._licenseType = _ctx.AG_IAS_LICENSE_TYPE_R.SingleOrDefault(w => w.LICENSE_TYPE_CODE == LICENSE_TYPE_CODE);

            //if (this.SourceFrom == DTO.RegistrationType.Association)
            //{
            //    //this._examLicense = _ctx.AG_EXAM_LICENSE_R.SingleOrDefault(e => e.EXAM_PLACE_CODE == _examPlaceCode
            //    //                                                            && e.TESTING_DATE == _TestTingDate
            //    //                                                            && e.TEST_TIME_CODE == _TestTimeCode
            //    //                                                            && e.LICENSE_TYPE_CODE == _LicenseTypeCode);
            //}
            //else if (this.SourceFrom == DTO.RegistrationType.Insurance)
            //{
            //    //this._examLicense = _ctx.AG_EXAM_LICENSE_R.SingleOrDefault(e => e.TESTING_NO == _testingNumber && e.EXAM_PLACE_CODE == _examPlaceCode);
            //}
        }
Exemplo n.º 27
0
        public DTO.ResponseService <DTO.UserProfile> RefeshUserProfileStatus(DTO.UserProfile userProfile)
        {
            DTO.ResponseService <DTO.UserProfile> response = new DTO.ResponseService <DTO.UserProfile>();

            if (userProfile == null)
            {
                response.ErrorMsg = Resources.errorPersonBiz_001;
                return(response);
            }

            var res = svc.GetUserProfile(userProfile.Id, userProfile.MemberType.ToString());

            if (res.IsError)
            {
                response.ErrorMsg = res.ErrorMsg;
                return(response);
            }

            userProfile.STATUS = res.DataResponse.STATUS;

            response.DataResponse = userProfile;
            return(response);
        }
Exemplo n.º 28
0
 public void DTO2DB(DTO.UserProfile dtoItem, ref Employee dbItem, string TmpFile, int userId)
 {
     AutoMapper.Mapper.Map <DTO.UserProfile, Employee>(dtoItem, dbItem);
     if (!string.IsNullOrEmpty(dtoItem.DateOfBirth))
     {
         if (DateTime.TryParse(dtoItem.DateOfBirth, nl, System.Globalization.DateTimeStyles.None, out tmpDate))
         {
             dbItem.DateOfBirth = tmpDate;
         }
     }
     if (dtoItem.HasChanged)
     {
         dbItem.PersonalPhoto = fwFactory.CreateFilePointer(TmpFile, dtoItem.NewFile, dbItem.PersonalPhoto);
     }
     if (dtoItem.CVHasChanged)
     {
         dbItem.ResumeFile = fwFactory.CreateNoneImageFilePointer(TmpFile, dtoItem.CVNewFile, dbItem.ResumeFile, dtoItem.CVFileName);
     }
     if (dtoItem.SignatureHasChanged)
     {
         dbItem.SignatureFile = fwFactory.CreateNoneImageFilePointer(TmpFile, dtoItem.SignatureNewFile, dbItem.SignatureFile, dtoItem.SignatureFileName);
     }
 }
Exemplo n.º 29
0
        public Boolean SaveChanges()
        {
            BLL.DataCenterBiz          biz             = new BLL.DataCenterBiz();
            IList <DTO.ConfigDocument> configDocuments = new List <DTO.ConfigDocument>();

            foreach (GridViewRow row in this.Rows)
            {
                String             id         = ((Label)row.Cells[0].Controls[0]).Text;
                Boolean            checkValue = ((CheckBox)row.Cells[4].Controls[0]).Checked;
                DTO.ConfigDocument config     = new DTO.ConfigDocument();
                config.ID = Convert.ToInt16(id);
                config.DOCUMENT_REQUIRE = (checkValue) ? "Y" : "N";
                configDocuments.Add(config);
            }
            DTO.UserProfile profile           = (DTO.UserProfile)Context.Session[PageList.UserProfile];
            DTO.ResponseMessage <Boolean> res = biz.UpdateConfigApproveLicense(configDocuments.ToList(), profile);
            if (res.IsError)
            {
                return(false);
            }

            return(true);
        }
Exemplo n.º 30
0
 public DTO.ResponseMessage <bool> UpdateConfigCheckExamLicense(List <DTO.ConfigEntity> cfgEnt, DTO.UserProfile userProfile)
 {
     return(svc.UpdateConfigCheckExamLicense(cfgEnt.ToArray(), userProfile));
 }