Example #1
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            Staffs st = new Staffs();

            st.Name         = txtName.Text;
            st.Surname      = txtSurname.Text;
            st.IDCARDNo     = mskIDCARD.Text;
            st.PhoneNo      = mskPhone.Text;
            st.Address      = txtAddress.Text;
            st.BirthdayDate = dtpBirthday.Value;
            st.DateOfEntry  = dtpJobStart.Value;
            st.Salary       = numSalary.Value;
            st.Username     = txtUsername.Text;
            st.Password     = txtPassword.Text;

            bool result = stOrm.Insert(st);

            if (result)
            {
                MessageBox.Show("Staff added successful!");
                dataGridView1.DataSource = stOrm.Select();
            }
            else
            {
                MessageBox.Show("Staff added not successful!");
            }
        }
        public async Task <IActionResult> Edit(long id, [Bind("Id,DesignationId,ClassId,Name,Cell,Email,Address")] Staffs staffs)
        {
            if (id != staffs.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(staffs);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!StaffsExists(staffs.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["ClassId"]       = new SelectList(_context.Classes, "Id", "Name", staffs.ClassId);
            ViewData["DesignationId"] = new SelectList(_context.Designations, "Id", "Name", staffs.DesignationId);
            return(View(staffs));
        }
        public JsonModel CreateUpdateStaff(StaffsDTO staff, TokenModel token)
        {
            using (var transaction = _context.Database.BeginTransaction())
            {
                token.OrganizationID = 2;
                token.UserID         = 1;

                JsonModel response = new JsonModel();
                //encrypt password
                if (!string.IsNullOrEmpty(staff.Password))
                {
                    staff.Password = CommonMethods.Encrypt(staff.Password);
                }
                //
                if (staff.Id == 0)
                {
                    User staffDB = iUserRepository.Get(m => (m.UserName == staff.UserName) && m.OrganizationID == token.OrganizationID);
                    if (staffDB != null) //if user try to enter duplicate records
                    {
                        response = new JsonModel(new object(), StatusMessage.StaffAlreadyExist, (int)HttpStatusCodes.UnprocessedEntity);
                    }
                    else // insert new staff
                    {
                        // insert Credentials in User table
                        User   requestUser  = SaveUser(staff, token);
                        Staffs staffsEntity = _mapper.Map <Staffs>(staff);
                        staffsEntity.CreatedBy      = token.UserID;
                        staffsEntity.UserID         = requestUser.Id;
                        staffsEntity.OrganizationID = token.OrganizationID;
                        staffsEntity.CreatedDate    = DateTime.UtcNow;
                        staffsEntity.IsActive       = true;
                        // save data in staff table
                        iStaffRepository.Create(staffsEntity);
                        iStaffRepository.SaveChanges();
                        response = new JsonModel(staffsEntity, StatusMessage.StaffCreated, (int)HttpStatusCodes.OK);
                    }
                }
                // update Staff Info
                else
                {
                    Staffs staffDB = iStaffRepository.GetFirstOrDefault(a => a.Id == staff.Id);
                    if (staffDB != null)
                    {
                        // Update info in User Table
                        User user = iUserRepository.GetFirstOrDefault(a => a.Id == staffDB.UserID);
                        user.UserName    = staff.UserName;
                        user.Password    = staff.Password;
                        user.UpdatedDate = DateTime.UtcNow;
                        user.UpdatedBy   = token.UserID;
                        iUserRepository.Update(user);
                        iUserRepository.SaveChanges();
                        //staffDB = _mapper.Map<Staffs>(staff);
                        Staffs updatedstaff = UpadteStaff(staffDB, staff, token);
                        response = new JsonModel(updatedstaff, StatusMessage.StaffUpdated, (int)HttpStatusCodes.OK);
                    }
                }
                transaction.Commit();
                return(response);
            }
        }
        public async Task <IActionResult> Edit(int id, [Bind("Id,StaffName,StaffPost,StaffExperience")] Staffs staffs)
        {
            if (id != staffs.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(staffs);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!StaffsExists(staffs.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(staffs));
        }
Example #5
0
        public async Task <IActionResult> Edit(int id, [Bind("StaffId,FirstName,LastName,Email,Phone,Active,StoreId,ManagerId")] Staffs staffs)
        {
            if (id != staffs.StaffId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(staffs);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!StaffsExists(staffs.StaffId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["ManagerId"] = new SelectList(_context.Staffs, "StaffId", "Email", staffs.ManagerId);
            ViewData["StoreId"]   = new SelectList(_context.Stores, "StoreId", "StoreName", staffs.StoreId);
            return(View(staffs));
        }
Example #6
0
        private void SaveStaff(object obj)
        {
            try
            {
                if (EmployeeShortImage != null && EmployeeShortImage.UriSource != null)
                {
                    SelectedStaff.ShortPhoto = ImageUtil.ToBytes(EmployeeShortImage);
                }

                var newObject = SelectedStaff.Id;
                SelectedStaff.Type = (StaffTypes)SelectedStaffType.Value;

                var stat = _staffService.InsertOrUpdate(SelectedStaff);

                if (stat != string.Empty)
                {
                    MessageBox.Show("Can't save"
                                    + Environment.NewLine + stat, "Can't save", MessageBoxButton.OK,
                                    MessageBoxImage.Error);
                }

                else if (newObject == 0)
                {
                    Staffs.Insert(0, SelectedStaff);
                }
            }
            catch (Exception exception)
            {
                MessageBox.Show("Can't save"
                                + Environment.NewLine + exception.Message, "Can't save", MessageBoxButton.OK,
                                MessageBoxImage.Error);
            }
        }
Example #7
0
        protected override void OnClearCommand()
        {
            try
            {
                UpdateViewState(Edit.Mode.Adding);
                Model = new StaffCdjr();

                if (CompanyDepartmentJobRoles != null)
                {
                    CompanyDepartmentJobRoles.MoveCurrentToFirst();
                }
                if (Staffs != null)
                {
                    Staffs.MoveCurrentToFirst();
                }
                if (Models != null)
                {
                    Models.MoveCurrentTo(null);
                }
            }
            catch (Exception ex)
            {
                Utility.DisplayMessage(ex.Message);
            }
        }
Example #8
0
        public JsonResult ShowDoctors()
        {
            Models.Staffs staffs   = new Staffs();
            DataSet       dsDoctor = staffs.getDoctor();

            List <Staffs> staffList = new List <Staffs>();

            foreach (DataRow dr in dsDoctor.Tables[0].Rows)
            {
                staffList.Add(new Staffs
                {
                    Staff_ID            = Convert.ToInt32(dr["Staff_ID"]),
                    Staff_Name          = dr["Staff_Name"].ToString(),
                    Staff_Spec          = dr["Spec_Name"].ToString(),
                    Staff_Qualification = dr["Staff_Qualification"].ToString(),
                    Staff_DOB           = dr["Staff_DOB"].ToString(),
                    Staff_Gender        = dr["Staff_Gender"].ToString(),
                    Staff_BloodGroup    = dr["Staff_BloodGp"].ToString(),
                    Staff_Email         = dr["Staff_Email"].ToString(),
                    Staff_Contact       = dr["Staff_Contact"].ToString(),
                    Staff_City          = dr["Staff_City"].ToString(),
                    Staff_State         = dr["Staff_State"].ToString(),
                    Staff_Country       = dr["Staff_Country"].ToString(),
                    Staff_Pin           = Convert.ToInt32(dr["Staff_Pin"]),
                    Staff_Acnt_Date     = dr["Staff_Acnt_Date"].ToString(),
                    Active = dr["Active"].ToString()
                });
            }
            var data = staffList;

            return(Json(new { data = data }, JsonRequestBehavior.AllowGet));
        }
        public List <ListCustomerOnMobile> GetListCustomerOnMobile(int StaffID)
        {
            StaffData     st   = new StaffData();
            List <Staffs> item = new List <Staffs>();

            item = st.GetStaff(StaffID);
            Staffs staff = new Staffs();

            staff = item.FirstOrDefault();


            List <ListCustomerOnMobile> list    = new List <ListCustomerOnMobile>();
            MySqlConnection             ObjConn = DBHelper.ConnectDb(ref errMsg);

            try
            {
                string sqlStr = @"  SELECT  c.CustomerId,ct.ContractID,CONCAT(c.CustomerTitleName,c.CustomerFirstName,' ',c.CustomerLastName) AS CustomerName
                ,ct.ContractStartDate,ct.ContractPeriod,ct.ContractPayEveryDay,ct.ContractSpecialholiday
                ,ct.ContractNumber,ct.ContractExpDate,ct.ContractAmount,ct.ContractPayment,
                 (ct.ContractPayment-d.TotalPay ) AS TotalPay
                 ,(       SELECT  DATE(DateAsOf) 
                 FROM  daily_receipts  WHERE ContractID=ct.ContractID AND CustomerID=c.CustomerId AND  PriceReceipts>0
                 ORDER BY DateAsOf DESC LIMIT 1) AS lastDate
                 FROM customer c 
                LEFT JOIN contract ct ON c.CustomerId=ct.contractCustomerID
                 LEFT JOIN (SELECT SUM(PriceReceipts)AS TotalPay , ContractID ,CustomerID  
                 FROM  daily_receipts
                 WHERE   Deleted=0
                GROUP BY   ContractID ,CustomerID ) d ON 
                d.ContractID=ct.ContractID AND d.CustomerID=ct.ContractCustomerID 
                WHERE  ct.ContractID IS NOT NULL
                 AND ct.contractstatus=1 and ct.Activated=1 and ct.Deleted=0 and  c.Deleted=0
                 ";


                DataTable dt1 = DBHelper.List("select * FROM staffrolepermission where StaffPermissionID=23 AND StaffRoleID=" + staff.StaffRoleID, ObjConn);

                if (dt1.Rows.Count != 1)
                {
                    sqlStr += "AND c.SaleID=" + StaffID;
                }


                DataTable dt = DBHelper.List(sqlStr, ObjConn);
                if (dt != null && dt.Rows.Count > 0)
                {
                    list = ListCustomerOnMobile.ToObjectList(dt);
                }

                return(list);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
            finally
            {
                ObjConn.Close();
            }
        }
Example #10
0
        protected override void SetSelectedModel()
        {
            try
            {
                Model = Models.CurrentItem as Inps;

                if (Staffs != null)
                {
                    ObservableCollection <Infrastructure.MangoService.Staff> staffs = (ObservableCollection <Infrastructure.MangoService.Staff>)Staffs.SourceCollection;
                    Infrastructure.MangoService.Staff staff = staffs.Where(s => s.Id == Model.Staff.Id).SingleOrDefault();
                    Staffs.MoveCurrentTo(staff);
                }

                if (Departments != null)
                {
                    List <Department> departments = (List <Department>)Departments.SourceCollection;
                    Department        department  = departments.Where(d => d.Id == Model.ResponsibleDepartment.Id).SingleOrDefault();
                    Departments.MoveCurrentTo(department);
                }

                UpdateViewState(Edit.Mode.Editing);
            }
            catch (Exception ex)
            {
                Utility.DisplayMessage(ex.Message);
            }
        }
Example #11
0
        public JsonModel Login(ApplicationUserDTO applicationUser, JwtIssuerOptions _jwtOptions)
        {
            // check user by Username
            User dbuser = iUserRepository.GetFirstOrDefault(a => a.UserName == applicationUser.UserName);


            if (dbuser != null)
            {
                // get User info
                Staffs staff = iStaffRepository.GetFirstOrDefault(a => a.UserID == dbuser.Id);
                if (staff == null)
                {
                    return(new JsonModel(null, StatusMessage.StaffInfoNotFound, (int)HttpStatusCodes.NotFound));
                }
                // check user active or inactive
                else if (staff.IsActive == false)
                {
                    return(new JsonModel(null, StatusMessage.AccountDeactivated, (int)HttpStatusCodes.Unauthorized));
                }
                else
                {
                    // check username and password
                    var identity = GetClaimsIdentity(applicationUser, dbuser);
                    if (identity != null)
                    {
                        return(LoginUser(applicationUser, _jwtOptions, dbuser, staff, identity));
                    }
                }
            }
            return(new JsonModel(null, StatusMessage.InvalidUserOrPassword, (int)HttpStatusCodes.Unauthorized));
        }
Example #12
0
 public static List <Staff> SearchStaff(string searchString)
 {
     searchString = searchString.ToLower();
     return(Staffs
            .Where(s => s.FirstName.ToLower().Contains(searchString) || s.LastName.ToLower().Contains(searchString))
            .ToList());
 }
Example #13
0
 public static int GetNewStaffId()
 {
     return(Staffs
            .Select(s => s.Id)
            .OrderByDescending(s => s)
            .FirstOrDefault() + 1);
 }
Example #14
0
        public void SetLastStaffRelativeOctave(string relativeOctave)
        {
            SetDefaultRelativeOctave(relativeOctave);
            Staff s = Staffs.Last();

            s.RelativeOctave = relativeOctave;
        }
Example #15
0
        /// <summary>
        /// 登录成功生成Cookie
        /// </summary>
        /// <param name="loginName"></param>
        /// <param name="model"></param>
        /// <param name="expiration"></param>
        public static void SignIn(string loginName, Staffs model, int expiration)
        {
            string data = JsonConvert.SerializeObject(model);
            //定义身份验证凭据
            FormsAuthenticationTicket ticket = new FormsAuthenticationTicket(2, loginName, DateTime.Now,
                                                                             DateTime.Now.AddDays(1),
                                                                             true, data);
            //将凭据加密为字符串
            string strTicket = FormsAuthentication.Encrypt(ticket);

            //定义cookie信息
            HttpCookie cookie = new HttpCookie(FormsAuthentication.FormsCookieName, strTicket);

            cookie.HttpOnly = true;
            cookie.Secure   = FormsAuthentication.RequireSSL;
            cookie.Domain   = FormsAuthentication.CookieDomain;
            cookie.Path     = FormsAuthentication.FormsCookiePath;
            cookie.Expires  = DateTime.Now.AddDays(expiration);

            HttpContext context = HttpContext.Current;

            //加入到响应信息中
            context.Response.Cookies.Remove(cookie.Name);
            context.Response.Cookies.Add(cookie);
        }
Example #16
0
        public async Task <IActionResult> PutStaffs(int id, Staffs staffs)
        {
            if (id != staffs.StaffId)
            {
                return(BadRequest());
            }

            _context.Entry(staffs).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!StaffsExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Example #17
0
        public HttpResponseMessage Get(int id)
        {
            try
            {
                StaffBusiness staffBusiness = new StaffBusiness();

                var    result   = staffBusiness.Find(id);
                Staffs tempData = new Staffs()
                {
                    CompanyId                    = result.CompanyId,
                    Name                         = result.Name,
                    Surname                      = result.Surname,
                    Address                      = result.Address,
                    DatetimeOfCreated            = result.DatetimeOfCreated,
                    Username                     = result.Username,
                    PhotoURL                     = result.PhotoURL,
                    CityOfBirth                  = result.CityOfBirth,
                    IdentificationNumber         = result.IdentificationNumber,
                    BeginningDateOfDriverLicense = result.BeginningDateOfDriverLicense,
                    EndingDateOfDriverLicense    = result.EndingDateOfDriverLicense,
                    Password                     = result.Password,
                    Id = result.Id
                };


                return(Request.CreateResponse(HttpStatusCode.OK, tempData));
            }
            catch (Exception ex)
            {
                LogHelper.Log(LogTarget.File,
                              "Staff Get failed. " + "\n" + ExceptionHelper.ExceptionToString(ex));
                return(null);
            }
        }
Example #18
0
        public async Task <ActionResult <Staffs> > PostStaffs(Staffs staffs)
        {
            _context.Staffs.Add(staffs);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetStaffs", new { id = staffs.StaffId }, staffs));
        }
Example #19
0
 private void DeleteStaff(object obj)
 {
     if (MessageBox.Show("Are you Sure You want to Delete this Staff?", "Delete Staff", MessageBoxButton.YesNoCancel, MessageBoxImage.Warning) == MessageBoxResult.Yes)
     {
         try
         {
             SelectedStaff.Enabled = false;
             var stat = _staffService.Disable(SelectedStaff);
             if (stat == string.Empty)
             {
                 Staffs.Remove(SelectedStaff);
             }
             else
             {
                 MessageBox.Show("Can't Delete, may be the data is already in use..."
                                 + Environment.NewLine + stat, "Can't Delete",
                                 MessageBoxButton.OK, MessageBoxImage.Error);
             }
         }
         catch (Exception ex)
         {
             MessageBox.Show("Can't Delete, may be the data is already in use..."
                             + Environment.NewLine + ex.Message + Environment.NewLine + ex.InnerException, "Can't Delete",
                             MessageBoxButton.OK, MessageBoxImage.Error);
         }
     }
 }
 private Staffs UpadteStaff(Staffs staffDB, StaffsDTO staff, TokenModel token)
 {
     //Update Staff Info
     staffDB.FirstName           = staff.FirstName;
     staffDB.LastName            = staff.LastName;
     staffDB.MiddleName          = staff.MiddleName;
     staffDB.Address             = staff.Address;
     staffDB.CountryID           = staff.CountryID;
     staffDB.City                = staff.City;
     staffDB.StateID             = staff.StateID;
     staffDB.Zip                 = staff.Zip;
     staffDB.Latitude            = staff.Latitude;
     staffDB.Longitude           = staff.Longitude;
     staffDB.PhoneNumber         = staff.PhoneNumber;
     staffDB.NPINumber           = staff.NPINumber;
     staffDB.TaxId               = staff.TaxId;
     staffDB.DOB                 = staff.DOB;
     staffDB.DOJ                 = staff.DOJ;
     staffDB.RoleID              = staff.RoleID;
     staffDB.Email               = staff.Email;
     staffDB.ApartmentNumber     = staff.ApartmentNumber;
     staffDB.CAQHID              = staff.CAQHID;
     staffDB.Language            = staff.Language;
     staffDB.DegreeID            = staff.DegreeID;
     staffDB.EmployeeID          = staff.EmployeeID;
     staffDB.PayRate             = staff.PayRate;
     staffDB.PayrollGroupID      = staff.PayrollGroupID;
     staffDB.IsRenderingProvider = staff.IsRenderingProvider;
     staffDB.AboutMe             = staff.AboutMe;
     staffDB.UpdatedBy           = token.UserID;
     staffDB.UpdatedDate         = DateTime.UtcNow;
     iStaffRepository.Update(staffDB);
     iStaffRepository.SaveChanges();
     return(staffDB);
 }
Example #21
0
        protected override void SetSelectedModel()
        {
            try
            {
                Model = Models.CurrentItem as StaffLocation;

                ObservableCollection <Staff> staffs = (ObservableCollection <Staff>)Staffs.SourceCollection;
                if (staffs != null)
                {
                    Staff staff = staffs.Where(s => s.Id == Model.Staff.Id).SingleOrDefault();
                    if (staff != null)
                    {
                        Staffs.MoveCurrentTo(staff);
                    }
                }

                ObservableCollection <Location> locations = (ObservableCollection <Location>)Locations.SourceCollection;
                if (locations != null)
                {
                    Location location = locations.Where(l => l.Id == Model.Location.Id).SingleOrDefault();
                    if (location != null)
                    {
                        Locations.MoveCurrentTo(location);
                    }
                }

                UpdateViewState(Edit.Mode.Editing);
            }
            catch (Exception ex)
            {
                Utility.DisplayMessage(ex.Message);
            }
        }
 public JsonModel DeleteStaff(int id, TokenModel token)
 {
     // Begin transaction
     using (var transaction = _context.Database.BeginTransaction())
     {
         token.OrganizationID = 2;
         token.UserID         = 1;
         // get staff info
         Staffs staff = iStaffRepository.Get(a => a.Id == id && a.IsDeleted == false && a.IsActive == true);
         if (staff != null)
         {
             User user = iUserRepository.GetFirstOrDefault(a => a.Id == staff.UserID);
             user.IsDeleted   = true;
             user.DeletedBy   = token.UserID;
             user.DeletedDate = DateTime.UtcNow;
             user.IsActive    = false;
             iUserRepository.Update(user);
             staff.IsDeleted   = true;
             staff.DeletedBy   = token.UserID;
             staff.UpdatedBy   = token.UserID;
             staff.DeletedDate = DateTime.UtcNow;
             user.IsActive     = false;
             iUserRepository.Update(user);
             iStaffRepository.Update(staff);
             iUserRepository.SaveChanges();
             iStaffRepository.SaveChanges();
             transaction.Commit();
             return(new JsonModel(new object(), StatusMessage.StaffDelete, (int)HttpStatusCodes.OK));
         }
         else
         {
             return(new JsonModel(new object(), StatusMessage.NotFound, (int)HttpStatusCodes.NotFound));
         }
     }
 }
Example #23
0
        public async Task <IActionResult> Edit(int id, [Bind("StaffId,FirstName,SurName,Address,Contact,Email")] Staffs staff)
        {
            if (id != staff.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(staff);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!StaffExists(staff.Id))
                    {
                        return(NotFound());
                    }

                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(staff));
        }
 public JsonModel GetStaff(int?id, TokenModel token)
 {
     token.OrganizationID = 2;
     // get staff info
     if (id == null)
     {
         List <StaffsDTO> staffModels = iStaffRepository.GetStaff <StaffsDTO>(token).ToList();
         return(new JsonModel(staffModels, StatusMessage.FetchMessage, (int)HttpStatusCodes.OK));
     }
     else
     {
         Staffs staffs = iStaffRepository.GetFirstOrDefault(a => a.Id == id && a.IsActive == true && a.IsDeleted == false);
         if (staffs != null)
         {
             // get user info by staffid
             User user = iUserRepository
                         .GetFirstOrDefault(a => a.Id == staffs.UserID && a.IsActive == true && a.IsDeleted == false);
             StaffsDTO staffDTO = _mapper.Map <StaffsDTO>(staffs);
             if (!string.IsNullOrEmpty(user.UserName))
             {
                 staffDTO.UserName = user.UserName;
             }
             // decrypt password
             if (!string.IsNullOrEmpty(user.Password))
             {
                 staffDTO.Password = CommonMethods.Decrypt(user.Password);
             }
             return(new JsonModel(staffDTO, StatusMessage.FetchMessage, (int)HttpStatusCodes.OK));
         }
         else
         {
             return(new JsonModel(new object(), StatusMessage.NotFound, (int)HttpStatusCodes.NotFound));
         }
     }
 }
Example #25
0
 public void CheckValues(Staffs a)
 {
     if (string.IsNullOrWhiteSpace(a.Email))
     {
         throw new AppException("Email is required to finish inserting this record");
     }
 }
Example #26
0
        public JsonResult EditStaffPassword(Staffs staff)
        {
            StaffData data = new StaffData();

            try
            {
                if (Session["iuser"] == null)
                {
                    throw new Exception(" Session หมดอายุ , กรุณาเข้าสู่ระบบใหม่อีกครั้ง !! ");
                }

                staff.UpdateBy = (Int32)Session["iuser"];

                data.EditStaffPassword(staff);

                return(Json(new
                {
                    data = "บันทึกข้อมูลสำเร็จ",
                    success = true
                }, JsonRequestBehavior.AllowGet));
            }
            catch (Exception ex)
            {
                return(Json(new
                {
                    data = ex.Message,
                    success = false
                }, JsonRequestBehavior.AllowGet));
            }
        }
        public async Task <IActionResult> Edit(int id, [Bind("Id,StaffRoleId,FirstName,LastName,Address,PhoneRes,PhoneMob,EnrollDate,IsActive,CreatedBy,CreatedOn,UpdatedBy,UpdatedOn")] Staffs staffs)
        {
            if (id != staffs.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(staffs);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!StaffsExists(staffs.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(staffs));
        }
Example #28
0
        public async Task <IActionResult> Edit(int id, [Bind("StaffId,IndividualId,DesignationId")] Staffs staffs)
        {
            if (id != staffs.StaffId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(staffs);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!StaffsExists(staffs.StaffId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["DesignationId"] = new SelectList(_context.Designations, "DesignationId", "DesignationDetails", staffs.DesignationId);
            ViewData["IndividualId"]  = new SelectList(_context.Individuals, "IndividualId", "Address", staffs.IndividualId);
            return(View(staffs));
        }
Example #29
0
 public PagedStaffList GetStaffList(int start, int limit)
 {
     return(new PagedStaffList()
     {
         Staffs = Staffs.GetPagedStaffList(start, limit),
         Total = Staffs.GetPagedStaffListCount()
     });
 }
Example #30
0
        /// <summary>
        /// 選択中の担当者を担当者一覧より削除
        /// </summary>
        public void RemoveSelectedStaff()
        {
            // 一覧より削除
            Staffs.Remove(SelectedStaff);

            // 初期化
            SelectedStaff = null;
        }
Example #31
0
        public void Render()
        {
            var renderHelper = new RenderHelper(scorePanel);
            double currentNoteTime = 0;
            double currentDevisions = 0;

            var staffs = new Staffs(renderHelper);

            staffs.Add(new Staff(renderHelper, ScoreLayoutDetails.LineSpacing_Y, ScoreLayoutDetails.Staff1_FristLineY));
            staffs.Add(new Staff(renderHelper, ScoreLayoutDetails.LineSpacing_Y, ScoreLayoutDetails.Staff2_FristLineY));
            staffs.AddBarLine(currentNoteTime);

            foreach (Part part in score.Parts)
                foreach (Measure measure in part.Measures)
                {
                    MeasureAttributes attributes = measure.Attributes;
                    if (attributes != null)
                    {
                        if (attributes.Divisions != -1) currentDevisions = attributes.Divisions;

                        UpdateMeasureAttributes(attributes, staffs, currentNoteTime);
                    }

                    double lastNoteDuration = 0;

                    foreach (Note note in measure.Notes)
                    {
                        //If the current note is part of a chord, we need to revert to the previous NoteTime
                        if (note.IsChord) currentNoteTime -= lastNoteDuration / currentDevisions;

                        Staff staff = GetStaffFromNote(staffs, note);
                        if (staff != null && note.IsDrawableEntity)
                        {
                            staff.AddNote(note, currentDevisions, currentNoteTime);
                        }

                        //After current note drawn, handle keeping track of noteTime in the piece
                        switch (note.NoteType)
                        {
                            case Note.NoteTypes.Backup: currentNoteTime -= note.Duration / currentDevisions;
                                break;
                            case Note.NoteTypes.Forward: currentNoteTime += note.Duration / currentDevisions;
                                break;
                            default: currentNoteTime += note.Duration / currentDevisions;
                                break;
                        }

                        lastNoteDuration = note.Duration;
                    }

                    staffs.AddBarLine(currentNoteTime);
                }

            double finalX = renderHelper.RenderItems(ScoreLayoutDetails.DefaultMargin_X);
            foreach (var staff in staffs) staff.DrawStaffLines(ScoreLayoutDetails.DefaultMargin_X, finalX);
        }