Esempio n. 1
0
        // GET: /Customers/GetCustomerID/:id

        public JsonResult GetCustomerID(int id)
        {
            Customers     cus_info = new Customers();
            CustomersData data3    = new CustomersData();

            cus_info = data3.GetCustomerInfo_ByID(id);

            StaffData     st        = new StaffData();
            DataTable     dt        = new DataTable();
            List <Staffs> staffList = new List <Staffs>();

            dt = st.GetStaffRole(0, 5);
            if (dt.Rows.Count > 0)
            {
                staffList = dt.AsEnumerable().Select(dr => new Staffs()
                {
                    StaffID        = dr.Field <int>("StaffID"),
                    StaffCode      = dr.Field <string>("StaffCode"),
                    StaffTitleName = dr.Field <string>("StaffTitleName"),
                    StaffFirstName = dr.Field <string>("StaffFirstName"),
                    StaffLastName  = dr.Field <string>("StaffLastName"),
                    StaffRoleID    = dr.Field <int>("StaffRoleID"),
                    StaffRoleName  = dr.Field <string>("StaffRoleName"),
                    StaffName      = dr.Field <string>("StaffTitleName") + dr.Field <string>("StaffFirstName") + " "
                                     + dr.Field <string>("StaffLastName"),
                }).ToList();
            }
            return(Json(new
            {
                dataCustomer = cus_info,
                dataZone = staffList,
                success = true
            }, JsonRequestBehavior.AllowGet));
        }
Esempio n. 2
0
 // GET: /Setting/GetZone
 public JsonResult GetZone()
 {
     try
     {
         // รับค่าราคา
         StaffData        st   = new StaffData();
         DataTable        dt   = new DataTable();
         List <ListItems> item = new List <ListItems>();
         dt = st.GetZoneName();
         if (dt.Rows.Count > 0)
         {
             item = dt.AsEnumerable().Select(dr => new ListItems()
             {
                 ID    = dr.Field <int>("zoneid"),
                 Code  = dr.Field <string>("zonecode"),
                 Value = dr.Field <string>("zonename"),
             }).ToList();
         }
         return(Json(new
         {
             data = item,
             success = true
         }, JsonRequestBehavior.AllowGet));
     }
     catch (Exception ex)
     {
         return(Json(new
         {
             data = ex.Message,
             success = false
         }, JsonRequestBehavior.AllowGet));
     }
 }
Esempio n. 3
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            string username = txtUsername.Text;
            string password = txtPassword.Text;

            var ad      = new AccountsData();
            var sd      = new StaffData();
            var message = new UserMessage();

            bool allInputsValid = ValidateInputs(username, password);        //check all users inputs are valid
            var  accountInfo    = ad.GetAccountPassword(username, password); //get account password from database
            bool passwordMatch  = accountInfo.Item1;                         //return if passwords matched between input and hashed stored password

            Int32.TryParse(accountInfo.Item2, out var staffId);              //get the staffs id that's trying to log in

            if (allInputsValid && passwordMatch)
            {
                //if everything's valid, get all that staffs information, store in a data structure
                var staff = sd.GetStaffInformation(staffId, username, password);
                //reset login data and hide login component
                SetupTextBoxes();
                Hide();
                //bring the logged in menu up, user is now logged in
                var menuInterface = new MenuInterface(staff, this);
                menuInterface.ShowDialog();
            }
            else if (allInputsValid)
            {
                message.Show("Your password does not match the password we have stored for your account.");
            }
        }
Esempio n. 4
0
 public IActionResult Delete([FromBody] StaffData request)
 {
     try
     {
         BaseResponse response = _staffsClient.DeleteAsync(request);
         LogData      logData  = new()
         {
             CallSide         = nameof(StaffController),
             CallerMethodName = nameof(Delete),
             CreatedOn        = _dateTimeUtil.GetCurrentDateTime(),
             Request          = request,
             Response         = response
         };
         _logger.AddLog(logData);
         return(Ok(response));
     }
     catch (Exception ex)
     {
         LogData logData = new()
         {
             CallSide         = nameof(StaffController),
             CallerMethodName = nameof(Delete),
             CreatedOn        = _dateTimeUtil.GetCurrentDateTime(),
             Request          = request,
             Response         = ex
         };
         _logger.AddErrorLog(logData);
         return(InternalServerError());
     }
 }
Esempio n. 5
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            if (ValidateInput())
            {
                try
                {
                    DataBase db = new StaffData();

                    _staff.FirstName = txtFirstName.Text;
                    _staff.LastName  = txtLastName.Text;
                    _staff.Addr1     = txtAddr1.Text;
                    _staff.Addr2     = txtAddr2.Text;
                    _staff.Addr3     = txtAddr3.Text;
                    _staff.Addr4     = txtAddr4.Text;
                    _staff.Postcode  = txtPostcode.Text;
                    _staff.Phone     = txtPhone.Text;
                    _staff.Email     = txtEmail.Text;

                    db.Update(_staff);
                    this.DialogResult = DialogResult.OK;
                    this.Close();
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
Esempio n. 6
0
        public void LoadFullList()
        {
            ep.SetError(dataGridView1, "");
            try
            {
                dataGridView1.AutoGenerateColumns = false;
                DataBase db;
                if (rdStudents.Checked)
                {
                    db = new StudenData();
                }
                else
                {
                    db = new StaffData();
                }

                _fullPersonList          = db.GetList();
                _bs.DataSource           = _fullPersonList;
                dataGridView1.DataSource = _bs.DataSource;

                if (Application.OpenForms["MDIMainForm"] as MDIMainForm != null)
                {
                    MDIMainForm mfrm = Application.OpenForms["MDIMainForm"] as MDIMainForm;
                }
                lblJobCount.Text = "Student Count - " + dataGridView1.Rows.Count.ToString();
            }
            catch (Exception ex)
            {
                ep.SetError(dataGridView1, ex.Message);
            }
        }
Esempio n. 7
0
        public JsonResult GetListStaffs(int staffID)
        {
            try
            {
                StaffData     st   = new StaffData();
                List <Staffs> item = new List <Staffs>();
                item = st.GetStaff(staffID);


                List <StaffRole> item2 = new List <StaffRole>();
                item2 = st.GetListStaffRole(0);


                return(Json(new
                {
                    data = item,
                    dataStaffRole = item2,
                    success = true
                }, JsonRequestBehavior.AllowGet));
            }
            catch (Exception ex)
            {
                return(Json(new
                {
                    data = ex.Message,
                    success = false
                }, JsonRequestBehavior.AllowGet));
            }
        }
Esempio n. 8
0
        public ActionResult Ajax_Reject_Request_Item(ajax_model ajax_data)
        {
            ajax_model data = new ajax_model
            {
                name      = ajax_data.name,
                main_data = ajax_data.main_data,
            };

            using (var db = new DataBaseContext())
            {
                int temp_id = Int32.Parse(data.main_data[0]);

                orders temp_order = db.orders_repository.Where(o => o.ordersId == temp_id).FirstOrDefault();
                temp_order.order_status = "Reject_by_Head";

                db.SaveChanges();
            }
            object reply_to_client = new
            {
                key_itemname_lis = "SUCCESS",
            };


            //Email Notification
            orders ord      = OrdersData.GetOrderById(Int32.Parse(data.main_data[0]));
            string emailadd = StaffData.GetStaffByName(ord.staff_obj.name).email;
            Task   task     = Task.Run(() => {
                EmailNotification.SendNotificationEmailToEmployee(emailadd, "Requisition Progress Updated", "Your requisition was just rejected by manager, please check.");
            });

            return(Json(reply_to_client, JsonRequestBehavior.AllowGet));
        }
Esempio n. 9
0
        // AJAX
        // Reject Department Requests
        public ActionResult Ajax_Reject_Department_Request(ajax_model ajax_model_data)
        {
            ajax_model ajax_data = new ajax_model
            {
                name      = ajax_model_data.name,
                main_data = ajax_model_data.main_data,
            };

            using (var db = new DataBaseContext())
            {
                List <orders> order_lis = db.orders_repository.Where(or => or.staff_obj.department_obj.department_name == ajax_data.name).ToList();

                foreach (orders or in order_lis)
                {
                    or.order_status = "Rejected_by_Clerk";

                    db.SaveChanges();
                }
            }
            object reply_to_client = new
            {
                key_itemname_lis = "SUCCESS",
            };

            //Email Notification
            staff  rep      = StaffData.GetStaffByName(DepartmentData.GetRepresentativebyDepName(ajax_data.name));
            string emailadd = rep.email;
            Task   task     = Task.Run(() => {
                EmailNotification.SendNotificationEmailToEmployee(emailadd, "New Disbursment Order Reminder", "There is a new disbursment order to your department was rejected by store clerk.");
            });

            return(Json(reply_to_client, 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();
            }
        }
Esempio n. 11
0
        public JsonResult ActivatedStaffs(int StaffID)
        {
            StaffData data = new StaffData();

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

                int UpdateBy = (Int32)Session["iuser"];

                data.ActivatedStaffs(StaffID, UpdateBy);

                return(Json(new
                {
                    data = "บันทึกข้อมูลสำเร็จ",
                    success = true
                }, JsonRequestBehavior.AllowGet));
            }
            catch (Exception ex)
            {
                return(Json(new
                {
                    data = ex.Message,
                    success = false
                }, JsonRequestBehavior.AllowGet));
            }
        }
Esempio n. 12
0
        //api : ../staffs/GetStaffPermission?staffroleID=1
        public JsonResult GetStaffPermission(int staffroleID)
        {
            try
            {
                StaffData st = new StaffData();
                List <StaffPermission> item  = new  List <StaffPermission>();
                List <StaffRole>       item1 = new List <StaffRole>();


                item  = st.GetStaffPermission();
                item1 = st.GetListStaffRole(staffroleID);

                List <int> item2 = st.GetListStaffPermissionID(staffroleID);

                return(Json(new
                {
                    data = item,
                    dataStaffRole = item1,
                    dataSelect = item2,
                    success = true
                }, JsonRequestBehavior.AllowGet));
            }
            catch (Exception ex)
            {
                return(Json(new
                {
                    data = ex.Message,
                    success = false
                }, JsonRequestBehavior.AllowGet));
            }
        }
Esempio n. 13
0
 public JsonResult GetStaffSettingOTP()
 {
     try
     {
         List <StaffSettingOTP> st = new List <StaffSettingOTP>();
         StaffData data            = new StaffData();
         st = data.GetStaffSettingOTP();
         List <int> select = new List <int>();
         select = data.GetStaffOTPSelect();
         return(Json(new
         {
             data = st,
             dataSelect = select,
             success = true
         }, JsonRequestBehavior.AllowGet));
     }
     catch (Exception ex)
     {
         return(Json(new
         {
             data = ex.Message,
             success = false
         }, JsonRequestBehavior.AllowGet));
     }
 }
Esempio n. 14
0
        // ------------------------------------------------------------------------------------
        // --------------------------  CREATE REQUEST ITEM ------------------------------------------
        public ActionResult View_Request_Item()
        {
            string user_name = Session["UserName"].ToString();

            using (var db = new DataBaseContext())
            {
                staff staff_obj = db.staff_repository.Where(x => x.name == user_name).Select(x => x).FirstOrDefault();

                List <orders> orders_lis = db.orders_repository.Where(x => x.staff_obj.staffId == staff_obj.staffId && (x.order_status == "pending" || x.order_status == "Reject_by_Head")).ToList();

                List <string> item_description_lis = new List <string>();
                foreach (orders or in orders_lis)
                {
                    item_description_lis.Add(or.item_obj.item_description);
                }

                ViewBag.item_description_lis = item_description_lis;
                ViewBag.order_lis            = (List <orders>)orders_lis;
            }

            //Email Notification
            staff  s        = StaffData.GetStaffByName((string)Session["UserName"]);
            string emailadd = StaffData.GetStaffByName(s.department_obj.head_name).email;
            Task   task     = Task.Run(() => {
                EmailNotification.SendNotificationEmailToEmployee(emailadd, "New Requisition Reminder", "There is a new requistion for your approval, please check.");
            });


            return(View());
        }
Esempio n. 15
0
        protected override StaffData Export(Staff entity, IReadContext context)
        {
            StaffData data = new StaffData();

            data.Deactivated   = entity.Deactivated;
            data.Id            = entity.Id;
            data.StaffType     = entity.Type.Code;
            data.Title         = entity.Title;
            data.FamilyName    = entity.Name.FamilyName;
            data.GivenName     = entity.Name.GivenName;
            data.MiddleName    = entity.Name.MiddleName;
            data.Sex           = entity.Sex.ToString();
            data.UserName      = entity.UserName;
            data.LicenseNumber = entity.LicenseNumber;
            data.BillingNumber = entity.BillingNumber;

            data.TelephoneNumbers = CollectionUtils.Map <TelephoneNumber, TelephoneNumberData>(entity.TelephoneNumbers,
                                                                                               delegate(TelephoneNumber tn) { return(new TelephoneNumberData(tn)); });
            data.Addresses = CollectionUtils.Map <Address, AddressData>(entity.Addresses,
                                                                        delegate(Address a) { return(new AddressData(a)); });
            data.EmailAddresses = CollectionUtils.Map <EmailAddress, EmailAddressData>(entity.EmailAddresses,
                                                                                       delegate(EmailAddress a) { return(new EmailAddressData(a)); });

            data.ExtendedProperties = ExtendedPropertyUtils.Copy(entity.ExtendedProperties);

            return(data);
        }
Esempio n. 16
0
        private void PopulateStaff()
        {
            DataBase     db    = new StaffData();
            List <Staff> list  = db.GetList().ConvertAll(x => x as Staff);
            List <Staff> list1 = db.GetList().ConvertAll(x => x as Staff);

            Staff staff = new Staff();

            staff.FullAddress = string.Empty;
            staff.PersonId    = 0;

            list.Insert(0, staff);
            list1.Insert(0, staff);

            cmbActivityCentreCoach.DataSource = list;
            cmbResidentCoach.DataSource       = list1;

            cmbActivityCentreCoach.DisplayMember = "FullName";
            cmbActivityCentreCoach.ValueMember   = "PersonId";

            cmbResidentCoach.DisplayMember = "FullName";
            cmbResidentCoach.ValueMember   = "PersonId";

            cmbActivityCentreCoach.DataBindings.Add("SelectedValue", _student, "ActivityCentreCoachId");
            cmbResidentCoach.DataBindings.Add("SelectedValue", _student, "ResidentCoachId");
        }
Esempio n. 17
0
        private void btnAddUser_Click(object sender, EventArgs e)
        {
            if (ValidateControls())
            {
                try
                {
                    SystemUser systemUser = new SystemUser();
                    if (cmbStaff.SelectedIndex != -1)
                    {
                        Staff staff = (Staff)cmbStaff.SelectedItem;
                        systemUser.PersonId = staff.PersonId;
                        if (staff.Email == string.Empty)
                        {
                            staff.Email = txtEmail.Text;
                            StaffData sd = new StaffData();
                            sd.Update(staff);
                        }
                    }

                    SystemUserData sud = new SystemUserData();
                    systemUser.FirstName    = txtFirstName.Text;
                    systemUser.LastName     = txtLastName.Text;
                    systemUser.UserName     = txtUserName.Text;
                    systemUser.Email        = txtEmail.Text;
                    systemUser.UserPassword = "******";

                    sud.CreateUser(systemUser);
                    this.DialogResult = DialogResult.OK;
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
Esempio n. 18
0
        protected void btnAttachDocYes_Click(object sender, EventArgs e)
        {
            try
            {
                btnAttachDocYes.Enabled = false;
                btnAttachDocNo.Enabled  = false;

                string type = new ConfigProductScreenBiz().GetFieldType(lblResultTicketId.Text.Trim(), SLMConstant.ConfigProductScreen.ActionType.View);

                if (cbResultHasAdamsUrl.Checked)
                {
                    LeadDataForAdam leadData = SlmScr003Biz.GetLeadDataForAdam(lblResultTicketId.Text.Trim());
                    StaffData       staff    = SlmScr003Biz.GetStaff(HttpContext.Current.User.Identity.Name);

                    string script = AppUtil.GetCallAdamScript(leadData, HttpContext.Current.User.Identity.Name, (staff.EmpCode != null ? staff.EmpCode : ""), true, type);

                    ScriptManager.RegisterClientScriptBlock(Page, GetType(), "calladam", script, true);
                }
                else
                {
                    Response.Redirect("SLM_SCR_004.aspx?ticketid=" + lblResultTicketId.Text.Trim() + "&type=" + type);
                }
            }
            catch (Exception ex)
            {
                string message = ex.InnerException != null ? ex.InnerException.Message : ex.Message;
                _log.Error(message);
                AppUtil.ClientAlertAndRedirect(Page, message, "SLM_SCR_003.aspx");
            }
        }
Esempio n. 19
0
        public string EditStaffData(StaffData dataObj)
        {
            try
            {
                string apiUrl = ConfigurationManager.AppSettings["DomainUrl"].ToString() + dataObj.Url;

                string result         = "";
                var    httpWebRequest = (HttpWebRequest)WebRequest.Create(apiUrl);
                httpWebRequest.ContentType     = "application/json";
                httpWebRequest.Method          = "POST";
                httpWebRequest.ProtocolVersion = HttpVersion.Version10;
                httpWebRequest.Headers.Add("Token", Request.Headers["Token"]);

                using (var streamWriter = new StreamWriter(httpWebRequest.GetRequestStream()))
                {
                    var jsonstring = new JavaScriptSerializer().Serialize(dataObj.ReqStaffData);
                    streamWriter.Write(jsonstring);
                    streamWriter.Flush();
                    streamWriter.Close();
                }

                var httpResponse = (HttpWebResponse)httpWebRequest.GetResponse();

                using (var streamReader = new StreamReader(httpResponse.GetResponseStream()))
                {
                    result = streamReader.ReadToEnd();
                }

                return(result);
            }
            catch (Exception exception)
            {
                return(exception.ToString());
            }
        }
        public ActionResult LogIn(StaffLogin login)
        {
            if (!String.IsNullOrEmpty(login.StaffCode) || !String.IsNullOrEmpty(login.StaffPassword))
            {
                if (Session["iuser"] == null)
                {
                    try
                    {
                        CustomersData data = new CustomersData();
                        login                 = data.GetStaffLogin(login);
                        Session["iuser"]      = login.StaffID;
                        Session["iusername"]  = login.StaffName;
                        Session["istaffrole"] = login.StaffRoleID;
                        Session["imageUrl"]   = login.ImageUrl;


                        StaffData st = new StaffData();
                        List <StaffPermissionGroup> item = new List <StaffPermissionGroup>();
                        item = st.GetStaffMenu(login.StaffRoleID);
                        string menu = st.GetMenu(item);

                        Session["imenu"] = menu;
                        return(RedirectToAction("Index"));
                    }
                    catch (Exception ex)
                    {
                        TempData["error"] = ex.Message;
                        return(View());
                    }
                }
                else
                {
                    return(RedirectToAction("Index"));
                }
            }
            else
            {
                if (String.IsNullOrEmpty(login.StaffCode) || String.IsNullOrEmpty(login.StaffPassword))
                {
                    TempData["error"] = "กรุณากรอกรหัสพนักงานและรหัสผ่าน";
                    return(View());
                }
                else if (String.IsNullOrEmpty(login.StaffCode))
                {
                    TempData["error"] = "กรุณากรอกรหัสพนักงาน";
                    return(View());
                }
                else if (String.IsNullOrEmpty(login.StaffPassword))
                {
                    TempData["error"] = "กรุณากรอกรหัสผ่าน";
                    return(View());
                }
                else
                {
                    TempData["error"] = "ไม่มีข้อมูลพนักงาน";
                    return(View());
                }
            }
        }
        public UpdateSelectedStaffWindowViewModel(StaffData StaffSelect, UserData UserList)
        {
            UserInfo = new UserData();
            UserInfo = UserList;

            LoadSelected(StaffSelect);
            Updatecommand = new DelegateCommand <object>(Update);
        }
Esempio n. 22
0
        public List <ReadableSale> GetSpecificWordGroup(string customer, string manufacturer, string keywords, int staff_Id, string helper,
                                                        DateTime salesOrderStartDate, DateTime salesOrderEndDate, DateTime salesStartDate,
                                                        DateTime salesEndDate)
        {
            using (DefaultConnection db = new DefaultConnection())
            {
                SQLWhereString whereString = new SQLWhereString();
                string where = whereString.SearchKeyWhere <ReadableSale>(db, keywords);
                int openCustomer_Id               = BusinessPartnerData.NameToId(db, customer)[0];
                int closeCustomer_Id              = BusinessPartnerData.NameToId(db, customer)[1];
                int openManufacturer_Id           = ManufacturerData.NameToId(db, manufacturer)[0];
                int closeManufacturer_Id          = ManufacturerData.NameToId(db, manufacturer)[1];
                int openStaff_Id                  = StaffData.GetIdRange(db, staff_Id)[0];
                int closeStaff_Id                 = StaffData.GetIdRange(db, staff_Id)[1];
                int openHelper_Id                 = HelperData.NameToId(db, helper)[0];
                int closeHelper_Id                = HelperData.NameToId(db, helper)[1];
                List <ReadableSale> readableSales = new List <ReadableSale>();
                if (!String.IsNullOrEmpty(keywords))
                {
                    readableSales = db.Database
                                    .SqlQuery <ReadableSale>(where)
                                    .ToList();
                    return(readableSales
                           .Where(rs => rs.Customer_Id >= openCustomer_Id &&
                                  rs.Customer_Id <= closeCustomer_Id &&
                                  rs.Manufacturer_Id >= openManufacturer_Id &&
                                  rs.Manufacturer_Id <= closeManufacturer_Id &&
                                  rs.ResponsibleStaff_Id >= openStaff_Id &&
                                  rs.ResponsibleStaff_Id <= closeStaff_Id &&
                                  rs.Helper_Id >= openHelper_Id &&
                                  rs.Helper_Id <= closeHelper_Id &&
                                  rs.SalesOrderDate >= salesOrderStartDate &&
                                  rs.SalesOrderDate <= salesOrderEndDate &&
                                  rs.SalesDate >= salesStartDate &&
                                  rs.SalesDate <= salesEndDate)
                           .ToList());
                }
                else
                {
                    readableSales = db.ReadableSales
                                    .Where(rs => rs.Customer_Id >= openCustomer_Id &&
                                           rs.Customer_Id <= closeCustomer_Id &&
                                           rs.Manufacturer_Id >= openManufacturer_Id &&
                                           rs.Manufacturer_Id <= closeManufacturer_Id &&
                                           rs.ResponsibleStaff_Id >= openStaff_Id &&
                                           rs.ResponsibleStaff_Id <= closeStaff_Id &&
                                           rs.Helper_Id >= openHelper_Id &&
                                           rs.Helper_Id <= closeHelper_Id &&
                                           rs.SalesOrderDate >= salesOrderStartDate &&
                                           rs.SalesOrderDate <= salesOrderEndDate &&
                                           rs.SalesDate >= salesStartDate &&
                                           rs.SalesDate <= salesEndDate)
                                    .ToList();

                    return(readableSales);
                }
            }
        }
Esempio n. 23
0
    public override ECommandResult Execute()
    {
        var data = new StaffData();

        data.Id   = DRStaff.Id;
        data.Name = Name;
        GameEntry.Database.Staff.AddStaff(data);
        return(ECommandResult.Success);
    }
        public bool ValidateInputs(string username, string password, string password2, int staffId)
        {
            var ad                 = new AccountsData();
            var sd                 = new StaffData();
            var av                 = new AccountValidation();
            var message            = new UserMessage();
            var passwordValidation = av.ValidatePassword(password, password2);

            //username validation class methods
            bool uniqueUsername = ad.CheckForExistingUsername(username);
            bool validUsername  = av.ValidateUsername(username);
            //password validation class methods
            bool passwordsEqual = passwordValidation.Item1;
            bool validPassword  = passwordValidation.Item2;
            //staff id validation class methods
            bool validStaffId      = sd.CheckForValidStaffId(staffId);
            bool staffIdHasAccount = sd.CheckIfStaffIdHasAccount(staffId);

            //messages to show user if any of the validations fail
            //username validation messages
            if (!validUsername)
            {
                message.Show("This is not a valid username, please ensure its at least 3 characters and only letters and numbers");
                return(false);
            }
            if (!uniqueUsername)
            {
                message.Show("This username already exists, please choose a different one.");
                return(false);
            }
            //password validation messages
            if (!passwordsEqual)
            {
                message.Show("Your passwords do not match, please ensure you enter the same password both times.");
                return(false);
            }
            if (!validPassword)
            {
                message.Show("This is not a valid password, please ensure it is at least 6 characters long.");
                return(false);
            }
            //staff id validation messages
            if (!validStaffId)
            {
                message.Show("This staff Id is not valid, please ensure it was entered correctly.");
                return(false);
            }
            //staff id already has an account
            if (!staffIdHasAccount)
            {
                message.Show("This staff Id already has an account associated with it, please talk to an administrator.");
                return(false);
            }

            return(true);
        }
        public void LoadAllStaff(int organizationID)
        {
            SqlDataReader reader = new StaffData().GetStaffByOrganizationID(organizationID);

            while (reader.Read())
            {
                this.Add(new Staff(reader));
            }
            reader.Close();
        }
Esempio n. 26
0
        public Staff(int personID) : base(personID)
        {
            SqlDataReader reader = new StaffData().GetStaffByID(personID);

            if (reader.Read())
            {
                LoadStaff(reader);
            }
            reader.Close();
        }
Esempio n. 27
0
        public Staff(Guid guid) : base(guid)
        {
            SqlDataReader reader = new StaffData().GetStaffByID(new Person(guid).PersonID);

            if (reader.Read())
            {
                LoadStaff(reader);
            }
            reader.Close();
        }
        public async Task <ActionResult <StaffData> > UpdateStaff([FromBody] StaffData ev, int id)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest());
            }
            var result = await staffRepo.updateAsync(id, ev);

            return(Ok());
        }
        public void LoadBySupervisorID(int supervisorID)
        {
            SqlDataReader reader = new StaffData().GetStaffBySupervisorID(supervisorID);

            while (reader.Read())
            {
                this.Add(new Staff(reader));
            }
            reader.Close();
        }
Esempio n. 30
0
 public List <BeforeSubmittingQuotation> UnitPriceSetting(string staffEmailAddress)
 {
     using (DefaultConnection db = new DefaultConnection())
     {
         string fullName = StaffData.EmailToFullName(db, staffEmailAddress);
         return(db.BeforeSubmittingQuotations
                .Where(sq => sq.ResponsibleStaff == fullName)
                .ToList());
     }
 }