public bool BeforeAddOrUpdate(DepartmentList objModal, int?ID)
 {
     if (objModal.parentid <= 0)
     {
         ModelState.AddModelError("Invalid Operation", "不可修改最上级部门名称。");
         return(false);
     }
     return(true);
 }
        public ActionResult GetDepartmentlist()
        {
            #region
            var result = new StandardJsonResult <DepartmentManageResultModel>();
            result.Try(() =>
            {
                var userservice           = ML.BC.Infrastructure.Ioc.GetService <IFrontUserManagementService>();
                List <DepartmentDto> list = new List <DepartmentDto>();
                if (HasFunction(Functions.Root_SystemSetting_OrganizationManagement_ShowAll))
                {
                    list = service.GetMyDepartment(BCSession.User.EnterpriseID);
                }
                else if (BCSession.User.DepartmentID.HasValue)
                {
                    list = service.GetMyDepartment(BCSession.User.EnterpriseID, BCSession.User.DepartmentID);
                }
                if (list != null && list.Count > 0)
                {
                    List <DepartmentList> jsonlist = new List <DepartmentList>();
                    foreach (var d in list)
                    {
                        var dlist          = new DepartmentList();
                        dlist.Available    = d.Available;
                        dlist.Deleted      = d.Deleted;
                        dlist.DepartmentID = d.DepartmentID;
                        dlist.Name         = d.Name;
                        dlist.Description  = d.Description;
                        dlist.ParentID     = d.ParentID;
                        dlist.id           = d.DepartmentID;
                        dlist._parentId    = d.ParentID;
                        dlist.EnterpriseID = d.EnterpriseID;
                        jsonlist.Add(dlist);
                        //dlist.id = _helper.processSID(fun.FunctionID);
                        //dlist._parentId = _helper.processSID(fun.ParentID);
                    }
                    jsonlist[0]._parentId = 0;
                    result.Value          = new DepartmentManageResultModel();
                    result.Value.total    = list.Count;
                    result.Value.rows     = jsonlist;
                }
                else
                {
                    result.Value       = new DepartmentManageResultModel();
                    result.Value.total = 0;
                    result.Value.rows  = new List <DepartmentList>();
                }
            });
            if (!result.Success)
            {
                result.Value = new DepartmentManageResultModel();
            }

            return(Json(result.Value, JsonRequestBehavior.AllowGet));

            #endregion
        }
Esempio n. 3
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!Page.IsPostBack)
     {
         DepartmentList departments = new DepartmentList();
         departments = departments.GetAll();
         ddlDepartments.DataSource = departments.List;
         ddlDepartments.DataBind();
     }
 }
        public int DepatmentAdd(Department department)
        {
            var res = databaseServiceSoapClient.DepatmentAdd(department);

            if (res > 0)
            {
                DepartmentList.Add(department);
            }
            return(res);
        }
Esempio n. 5
0
        public void DeleteDepartment(VinaGerman.Entity.BusinessEntity.DepartmentEntity newEntity)
        {
            VinaGerman.Entity.BusinessEntity.DepartmentEntity oldEntity = DepartmentList.FirstOrDefault <VinaGerman.Entity.BusinessEntity.DepartmentEntity>(p => p.DepartmentId == newEntity.DepartmentId);

            if (oldEntity != null)
            {
                DepartmentList.Remove(oldEntity);
            }

            DepartmentList = new List <VinaGerman.Entity.BusinessEntity.DepartmentEntity>(_departmentList);
        }
Esempio n. 6
0
        public string GetParentName(int?id)
        {
            if (id == null)
            {
                return(null);
            }
            var    parentName = DepartmentList.FirstOrDefault(d => d.DepartmentID == id);
            string pN         = parentName.Name;

            return(pN);
        }
Esempio n. 7
0
        private async Task GetDepartmentList()
        {
            var repoDepartmentRepository = new DepartmentRepository();
            await repoDepartmentRepository.ReadAsync();

            DepartmentList.Clear();
            foreach (var item in repoDepartmentRepository.Items)
            {
                DepartmentList.Add(item);
            }
        }
Esempio n. 8
0
        public void TestDeleteDepartments()
        {
            var f  = new DepartmentList();
            int id = GlobalItems.getKey("departments", "name", "Biologia");

            if (id > 0)
            {
                f.delete_department(id.ToString());
                Assert.IsFalse(GlobalItems.checkItemsInDB("departments", "name", "Biologia"));
            }
        }
Esempio n. 9
0
    void BindDepartment()
    {
        Doctors o  = new Doctors();
        DataSet ds = o.getDepartment();

        DepartmentList.DataSource     = ds;
        DepartmentList.DataTextField  = "ShortName";
        DepartmentList.DataValueField = "Id";
        DepartmentList.DataBind();
        DepartmentList.Items.Insert(0, "Select");
    }
Esempio n. 10
0
        protected override async Task MapEditedItemToEditor(EmployeeJob item)
        {
            await base.MapEditedItemToEditor(item);

            SelectedEmployee   = EmployeeList.First(e => e.Id == item.EmployeeId);
            SelectedJob        = JobList.First(e => e.Id == item.JobId);
            SelectedDepartment = DepartmentList.First(e => e.Id == item.DepartmentId);
            SelectedCompany    = CompanyList.First(e => e.Id == item.CompanyId);
            BranchList         = (await _branchRepository.GetItemsWithDetailsByCompany(item.CompanyId)).ToAsyncObservableCollection();
            SelectedBranch     = BranchList.First(e => e.Id == item.BranchId);
        }
Esempio n. 11
0
        // Получаем название департамента
        public string GetDepartamentName(int?id)
        {
            if (id == null)
            {
                return(null);
            }
            var    departamentName = DepartmentList.FirstOrDefault(d => d.DepartmentID == id);
            string dN = departamentName.Name;

            return(dN);
        }
    protected void Button1_Click(object sender, EventArgs e)
    {
        if (Page.IsValid)
        {
            decimal currentSale = 0;

            SqlConnection con = new SqlConnection(
                WebConfigurationManager.ConnectionStrings["myConnectionString"].ConnectionString);
            con.Open();
            String     name;
            string     query = "select name from PRODUCT where productID = " + ProductList.SelectedValue;
            SqlCommand cmd   = new SqlCommand(query, con);
            name = cmd.ExecuteScalar().ToString();

            con.Close();

            TableRow tRow1 = new TableRow();


            TableCell tCell0 = new TableCell();
            tCell0.Text = ProductList.SelectedValue;
            tRow1.Cells.Add(tCell0);
            TableCell tCell1 = new TableCell();
            tCell1.Text = name;
            tRow1.Cells.Add(tCell1);
            TableCell tCell2 = new TableCell();
            tCell2.Text = PriceLabel.Text;
            tRow1.Cells.Add(tCell2);
            TableCell tCell3 = new TableCell();
            tCell3.Text = QuantityTxt.Text;
            tRow1.Cells.Add(tCell3);

            decimal   subtotal = Convert.ToDecimal(PriceLabel.Text) * Convert.ToDecimal(QuantityTxt.Text);
            TableCell tCell4   = new TableCell();
            tCell4.Text = subtotal.ToString();
            tRow1.Cells.Add(tCell4);


            TableRows.Add(tRow1);
            QuantityTxt.Text = "0";
            StockTxt.Text    = "0";

            foreach (TableRow row in TableRows)
            {
                Table1.Rows.Add(row);
                currentSale += Convert.ToDecimal(row.Cells[4].Text);
            }
            DepartmentList.ClearSelection();
            ProductList.SelectedIndex = 0;
            String currentTotal = currentSale.ToString();
            TotalLbl.Text = currentTotal;
        }
    }
        public JsonResult GetDetails(string id)
        {
            var disbursementListDetail = db.DisbursementListDetails.Include(d => d.DisbursementList).Include(d => d.StationeryCatalog)
                                         .Where(DisbursementListDetails => DisbursementListDetails.ListNumber == id)
                                         .ToList();
            DisbursementList disbursementList = db.DisbursementLists.Where(d => d.ListNumber == id).Single();
            DepartmentList   departmentList   = db.DepartmentLists.Where(d => d.DepartmentCode == disbursementList.DepartmentCode).Single();
            CollectionPoint  collectionPoint  = db.CollectionPoints.Where(c => c.CollectionPointCode == departmentList.CollectionPoint).Single();
            Employee         employee         = db.Employees.Where(e => e.Id == departmentList.RepresentativeId).Single();

            return(Json(new { data = new { detailId = disbursementListDetail.Select(x => x.ListDetailsNumber), listId = disbursementListDetail.Select(x => x.DisbursementList.ListNumber), ItemNumber = disbursementListDetail.Select(x => x.ItemNumber), Category = disbursementListDetail.Select(x => x.StationeryCatalog.Category), desc = disbursementListDetail.Select(x => x.StationeryCatalog.Description), quantity = disbursementListDetail.Select(x => x.Quantity), received = disbursementListDetail.Select(x => x.QuantityReceived), remark = disbursementListDetail.Select(x => x.Remarks) } }, JsonRequestBehavior.AllowGet));
        }
Esempio n. 14
0
        protected void ddlSections_SelectedIndexChanged(object sender, EventArgs e)
        {
            DepartmentList dList = new DepartmentList();

            dList = dList.GetAll();                //Get all Departments

            ddlDepartment.DataSource = dList.List; //Add all Departments to DropDownList
            ddlDepartment.DataBind();
            ddlDepartment.Items.Add("Choose Department");
            ddlDepartment.SelectedValue = "Choose Department";
            ddlDepartment.Visible       = true; //Show DropDownList for Departments
        }
Esempio n. 15
0
        public void AddDepartment(string departmentName)
        {
            if (mProject != null)
            {
                mProject.UserDepartmentAdd(departmentName);
            }

            if (DepartmentList.FindItemWithText(departmentName) == null)
            {
                DepartmentList.Items.Add(departmentName);
            }
        }
Esempio n. 16
0
        protected void Bind()
        {
            List <Model.Department> list = BLL.DepartmentBLL.GetDepartmentList();

            list.Insert(0, new Model.Department()
            {
                ID = -1, Name = "==请选择部门==="
            });
            DepartmentList.DataSource     = list;
            DepartmentList.DataTextField  = "Name";
            DepartmentList.DataValueField = "Id";
            DepartmentList.DataBind();
        }
Esempio n. 17
0
        public void refreshDepartments()
        {
            this.DepartmentList.Rows.Clear();
            List <object>[] rs;
            string[]        columns = { "strDepCode", "strDepName" };
            rs = dbConnect.Select("Select * from tblDepartment where boolDepIsDel = false;", columns);

            for (int i = 0; i < rs[0].Count; i++)
            {
                this.DepartmentList.Rows.Add(rs[0].ElementAt(i).ToString(), rs[1].ElementAt(i).ToString());
            }
            //clear selection
            DepartmentList.ClearSelection();
        }
Esempio n. 18
0
        public void Add()
        {
            var newEntity = new VinaGerman.Entity.BusinessEntity.DepartmentEntity()
            {
                Deleted      = false,
                Description  = "",
                Phone        = "",
                DepartmentId = -1,
                CompanyId    = ApplicationHelper.CurrentUserProfile.CompanyId
            };

            DepartmentList.Add(newEntity);
            DepartmentList = new List <VinaGerman.Entity.BusinessEntity.DepartmentEntity>(_departmentList);
        }
Esempio n. 19
0
        /// <summary>
        /// 创建部门
        /// </summary>
        /// <param name="accessToken">调用接口凭证</param>
        /// <param name="name">部门名称。长度限制为1~64个字符</param>
        /// <param name="parentId">父亲部门id。根部门id为1 </param>
        /// <param name="order">在父部门中的次序。从1开始,数字越大排序越靠后</param>
        /// <param name="id">部门ID。用指定部门ID新建部门,不指定此参数时,则自动生成</param>
        /// <param name="timeOut">代理请求超时时间(毫秒)</param>
        /// <returns></returns>
        public static CreateDepartmentResult CreateDepartment(string accessToken, DepartmentList dept, int timeOut = Config.TIME_OUT)
        {
            var url = string.Format("https://qyapi.weixin.qq.com/cgi-bin/department/create?access_token={0}", accessToken);

            var data = new
            {
                name     = dept.name,
                parentid = dept.parentid,
                order    = dept.order,
                //id = dept.id
            };

            return(CommonJsonSend.Send <CreateDepartmentResult>(null, url, data, CommonJsonSendType.POST, timeOut));
        }
Esempio n. 20
0
    void BindDepartment()
    {
        Doctors o  = new Doctors();
        DataSet ds = o.getDepartment();

        DepartmentList.DataSource     = ds;
        DepartmentList.DataTextField  = "ShortName";
        DepartmentList.DataValueField = "Id";
        DepartmentList.DataBind();
        DepartmentList.Items.Insert(0, "Select");
        foreach (ListItem _listItem in this.DepartmentList.Items)
        {
            _listItem.Attributes.Add("title", _listItem.Text);
        }
    }
        protected void gviewDepartments_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            //Grab the department FIS code from the datakey
            Department dept = new Department();

            dept.DepartmentFIS = (string)gviewDepartments.DataKeys[e.RowIndex]["DepartmentFIS"];

            //Remove the corresponding department from the DepartmentList
            DepartmentList.Remove(dept);

            gviewDepartments.DataSource = DepartmentList;
            gviewDepartments.DataBind();

            e.Cancel = true;
        }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            TableRows.Clear();
            SqlConnection con = new SqlConnection(
                WebConfigurationManager.ConnectionStrings["myConnectionString"].ConnectionString);
            con.Open();
            string     query = "select Dept_number, Dept_name  from DEPARTMENT";
            SqlCommand cmd   = new SqlCommand(query, con);
            DepartmentList.DataSource = cmd.ExecuteReader();
            DepartmentList.DataBind();
            ListItem defaultDept = new ListItem("Select department", "-1");
            DepartmentList.Items.Insert(0, defaultDept);
            con.Close();
        }
        //EmployeeLbl.Text = Session["user"].ToString();
        //CustomerLbl.Text = ;
        //InvLbl.Text =;
        StockTxt.ReadOnly  = true;
        StockTxt.BackColor = System.Drawing.SystemColors.Window;

        TableRow tRow = new TableRow();

        Table1.Rows.Add(tRow);


        TableCell tCell0 = new TableCell();

        tCell0.Text = "Product_ID";
        tRow.Cells.Add(tCell0);
        TableCell tCell1 = new TableCell();

        tCell1.Text = "Item name";
        tRow.Cells.Add(tCell1);
        TableCell tCell2 = new TableCell();

        tCell2.Text = "Unit Price";
        tRow.Cells.Add(tCell2);
        TableCell tCell3 = new TableCell();

        tCell3.Text = "Quantity";
        tRow.Cells.Add(tCell3);
        TableCell tCell4 = new TableCell();

        tCell4.Text = "Sub-Total";
        tRow.Cells.Add(tCell4);
    }
Esempio n. 23
0
        private void Type_list_SelectedIndexChanged(object sender, EventArgs e)
        {
            string curItem = Type_list.SelectedItem.ToString();

            if (curItem == "Student")
            {
                SemesterBox.Show();
                Year_list.Show();
                DepartmentList.Show();
            }
            else
            {
                SemesterBox.Hide();
                Year_list.Hide();
                DepartmentList.Show();
            }
        }
Esempio n. 24
0
        public void AddOrUpdateDepartment(VinaGerman.Entity.BusinessEntity.DepartmentEntity newEntity)
        {
            VinaGerman.Entity.BusinessEntity.DepartmentEntity oldEntity = DepartmentList.FirstOrDefault <VinaGerman.Entity.BusinessEntity.DepartmentEntity>(p => p.Description == newEntity.Description);

            if (oldEntity == null)
            {
                DepartmentList.Insert(0, newEntity);
            }
            else
            {
                int index = DepartmentList.IndexOf(oldEntity);
                DepartmentList.Remove(oldEntity);
                DepartmentList.Insert(index, newEntity);
            }

            DepartmentList = new List <VinaGerman.Entity.BusinessEntity.DepartmentEntity>(_departmentList);
        }
Esempio n. 25
0
        public int DepartmenRemove(Department deparment)
        {
            var res = databaseServiceSoapClient.DepartmenRemove(deparment);

            if (res > 0)
            {
                for (int i = MainWindow.ContactList.Count - 1; i >= 0; i--)
                {
                    if (MainWindow.ContactList[i].Category.Id == deparment.Id)
                    {
                        MainWindow.ContactList.Remove(MainWindow.ContactList[i]);
                    }
                    continue;
                }
                DepartmentList.Remove(deparment);
            }
            return(res);
        }
Esempio n. 26
0
        public void loadLists(MerkatoDbContext _context)
        {
            SelectListItem all = new SelectListItem()
            {
                Text = "All", Value = "0"
            };

            DepartmentList = _context.Department.Select(p => new SelectListItem()
            {
                Text = p.Name, Value = p.Id.ToString()
            }).ToList();
            DepartmentList.Add(all);
            GenderList = _context.Gender.Select(p => new SelectListItem()
            {
                Text = p.Name, Value = p.Id.ToString()
            }).ToList();
            GenderList.Add(all);
        }
        /// <summary>
        /// TODO: move methode
        /// </summary>
        /// <param name="usermail"></param>
        /// <param name="groupData"></param>
        /// <returns></returns>
        private GroupUser GetGroupsAndDepartmentsForUPN(string usermail, GroupListDetails groupData)
        {
            try
            {
                var _filledGroupList = new GroupListDetails();

                var user = new GroupUser();
                user.UPN = usermail.ToLower();

                var usergroups = new List <GroupList>();
                foreach (var groupItem in groupData.GroupList)
                {
                    GroupList grp = new GroupList();
                    grp.Name = groupItem.Name.ToString();
                    if (groupItem.Members.Contains(user.UPN))
                    {
                        grp.Selected = true;
                    }
                    usergroups.Add(grp);
                }
                user.Groups = usergroups;

                var userdepartments = new List <DepartmentList>();
                foreach (var departnmentItem in groupData.DepartmentList)
                {
                    DepartmentList dep = new DepartmentList();
                    dep.Name = departnmentItem.Name.ToString();
                    if (departnmentItem.Members.Contains(user.UPN))
                    {
                        dep.Selected = true;
                    }
                    userdepartments.Add(dep);
                }
                user.Departments = userdepartments;


                return(user);
            }
            catch (Exception e)
            {
                _logger.LogError(8, e, "HomeController");
                return(null);
            }
        }
Esempio n. 28
0
        public bool updateDepartment(string depID, string name, string hodID, string newDepID, string newName, string newhodID)
        {
            IDepartment Dep = this.DepartmentList.FirstOrDefault(dep => dep.DepartmentID == depID.Trim());

            if (hodID is null)
            {
                IStaff hod = this.StaffList.FirstOrDefault(user => user.UserID.Equals(newhodID));
                this.StaffList.Remove(hod);
                hod.isHOD = 1;
                this.StaffList.Add(hod);
                DataLayer.updateStaffMemberToOrFromHODinDB(hod, hod.isHOD);
                DepartmentList.Remove(Dep);
                Dep.HeadOfDepartmentID = newhodID;
                DepartmentList.Add(Dep);
                DataLayer.UpdateDepartmentInDB(hod, Dep, depID);
            }
            else
            {
                IStaff hod = this.StaffList.FirstOrDefault(user => user.UserID.Equals(hodID));
                // Remove department and hod from their lists //
                this.DepartmentList.Remove(Dep);
                this.StaffList.Remove(hod);

                // Add them back with changes //
                hod.isHOD = 0;
                DataLayer.updateStaffMemberToOrFromHODinDB(hod, hod.isHOD);
                this.StaffList.Add(hod);

                hod = this.StaffList.FirstOrDefault(user => user.UserID.Equals(newhodID));
                this.StaffList.Remove(hod);
                hod.isHOD = 1;
                this.StaffList.Add(hod);
                DataLayer.updateStaffMemberToOrFromHODinDB(hod, hod.isHOD);

                Dep.DepartmentID       = newDepID;
                Dep.HeadOfDepartmentID = newhodID;
                Dep.Name = newName;
                this.DepartmentList.Add(Dep);

                DataLayer.UpdateDepartmentInDB(hod, Dep, depID);
            }

            return(true);
        }
        protected void lbtnAddDepartment_Click(object sender, EventArgs e)
        {
            CAESDO.Recruitment.Core.Domain.Unit selectedUnit = UnitBLL.GetByID(dlistDepartment.SelectedValue);

            Department associatedDepartment = new Department();

            associatedDepartment.AssociatedPosition = currentPosition;
            associatedDepartment.DepartmentFIS      = selectedUnit.ID;
            associatedDepartment.Unit        = selectedUnit;
            associatedDepartment.PrimaryDept = DepartmentList.Count == 0;

            if (DepartmentList.Contains(associatedDepartment) == false)
            {
                DepartmentList.Add(associatedDepartment);
            }

            gviewDepartments.DataSource = DepartmentList;
            gviewDepartments.DataBind();
        }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Session["user"] == null)
     {
         Response.Redirect("~/Login.aspx");
     }
     if (!IsPostBack)
     {
         SqlConnection con = new SqlConnection(
             WebConfigurationManager.ConnectionStrings["myConnectionString"].ConnectionString);
         con.Open();
         string     query = "select Dept_number, Dept_name  from DEPARTMENT";
         SqlCommand cmd   = new SqlCommand(query, con);
         DepartmentList.DataSource = cmd.ExecuteReader();
         DepartmentList.DataBind();
         ListItem defaultDept = new ListItem("Select department", "-1");
         DepartmentList.Items.Insert(0, defaultDept);
         con.Close();
     }
 }
Esempio n. 31
0
 /// <summary>
 /// Gets a list of Departments
 /// </summary>
 /// <returns>List of Departments</returns>
 public static DepartmentList GetItem()
 {
     DepartmentList myDepartmentList = null;
     using (SqlConnection myConnection = new SqlConnection(AppSettings.ConnectionString))
     {
         SqlCommand myCommand = new SqlCommand("spSelectDepartmentList", myConnection);
         myCommand.CommandType = CommandType.StoredProcedure;
         myConnection.Open();
         using (SqlDataReader myDataReader = myCommand.ExecuteReader())
         {
             if (myDataReader.HasRows)
             {
                 myDepartmentList = new DepartmentList();
                 while (myDataReader.Read())
                 {
                     myDepartmentList.Add(FillRecord(myDataReader));
                 }
             }
             myDataReader.Close();
         }
         myConnection.Close();
     }
     return myDepartmentList;
 }
Esempio n. 32
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["User"] == null) Response.Redirect("Default.aspx");

        Display disp = new Display();
        Date dt = new Date();
        SAPDB db = new SAPDB();
        SQLDB sql = new SQLDB();
        PeriodDB perdb = new PeriodDB();

        Person user = (Person)Session["User"];

        //List<Role> rol = user.Roles;
        //foreach (Role r in rol)
        //    Response.Write(r.RoleID + " = " + r.RoleName);

        if (!IsPostBack)
        {
            fillMonths();
            if (Request.QueryString["data"] == null)
                period.SelectedValue = dt.getMonthToday();
        }

        year = period.SelectedItem.Text.Substring(period.SelectedItem.Text.Length - 4);
        month = period.SelectedItem.Value;

        string fio = "";
        string tab_number = "";
        string post = "";
        check = false;
        closed = false;

        count_days = dt.getCountDays(Convert.ToInt32(month), Convert.ToInt32(year));

        if (Request.QueryString["type"] != null) role = Request.QueryString["type"].ToString();

        Period per = perdb.getPeriod(Convert.ToInt32(month), Convert.ToInt32(year));

        if (per.IsClosed == 1)
        {
            lbStatus.Text = "������";
            Traffic.Text = "<img alt='' src='App_Resources/red.bmp' style='position:relative; top:4px;' />";
            closed = true;
        }
        else Traffic.Text = "<img alt='' src='App_Resources/green.bmp' style='position:relative; top:4px;' />";

        if (Request.QueryString["data"] != null)
        {
            EncryptedQueryString QueryString = new EncryptedQueryString(Request.QueryString["data"]);
            if (QueryString["fio"] != null) fio = QueryString["fio"];
            if (QueryString["tab"] != null) tab_number = QueryString["tab"];
            if (QueryString["post"] != null) post = QueryString["post"];
            if (QueryString["role"] != null) role = QueryString["role"];
            if (QueryString["check"] != null) check = true;
            if (!QueryString["month"].Equals(period.SelectedItem.Value))
            {
                fio = "";
                tab_number = "";
                post = "";
                check = false;
            }
        }

        //Response.Write(month);

        //Response.Write("fio=" + fio + "tab=" + tab_number + " - " + month + "<br>");
        //Response.Write(post + "<br>");

        string start_date = dt.getSAPStartPeriodDate(month, year);
        string end_date = dt.getSAPEndPeriodDate(month, year);

        StartDateOfPeriod = start_date;
        EndDateOfPeriod = end_date;
        //Response.Write(start_date + end_date);

        Label lb = new Label();
        lb.Text = disp.DisplayDaysTabel(count_days, 18);
        days.Controls.Add(lb);

        //Response.Write(start_date + end_date);
        //Period period_time = perdb.getPeriod(Convert.ToInt32(month), Convert.ToInt32(year));

        setButtons(role);

        //Response.Write(start_date + "-" + end_date + "<br>");

        this.employees = null;/// db.getEmployeeList(start_date, end_date, user.TabNum, this.role);
        EmployeeList emp_list = new EmployeeList();
        List<Post> post_list = null;/// pl.getPosts(db.getPostList(start_date, end_date, user.TabNum, this.role));
        if (post_list != null)
        {
            fillPosts(post_list);
        }
        else
        {
            ListItem li = new ListItem("�������� ���������");
            ddl_post.Items.Add(li);
        }

        /*if (post != "")
        {
            if (post != "���")
            {
                EmployeeList empl = new EmployeeList();
               // this.employees = empl.getEmployeesOnCurrentPost(post, employees);

            }
        }

        if (fio != "")
        {
            EmployeeList emp_fio = new EmployeeList();
            this.employees = emp_fio.getEmployeesByFIO(fio, employees);
        }

        if (tab_number != "")
        {
            EmployeeList emp_tab = new EmployeeList();
            this.employees = emp_tab.getEmployeesByTab(tab_number, employees);
        }*/

        if (check)
        {
            EmployeeList emp_check = new EmployeeList();
            /////this.employees = emp_check.getWrongCheckedEmployees(employees, count_days, hours, overhours);
        }

        if (employees != null)
        {

            DepartmentList department_list = new DepartmentList();
            List<Department> departments = department_list.getDepartments(employees);

            foreach (Department dep in departments)
            {

                Label depart = new Label();
                depart.Text = disp.DisplayDepartmentName(dep.DepartmentName, dep.DepartmentID, StartDateOfPeriod);
                content.Controls.Add(depart);

                Label lbEmps = new Label();
                lbEmps.Text = "<div  id='" + dep.DepartmentID + "' style='display:none'>";

                // �������� ���� �������� ��� �������� ��������
                /*EmployeeList emp_list = new EmployeeList();
                List<Employee> emps = emp_list.getEmployeesOfDepartment(dep.DepartmentID, employees);
                EmployeeComparerByPostASC cmpByPostASC = new EmployeeComparerByPostASC();
                emps.Sort(cmpByPostASC);
                //for (int j = 0; j < 100; j++)
                foreach (Employee em in emps)
                {
                    lbEmps.Text += "<table cellpadding='0' cellspacing='0' border='0' class='employee'><tr><td class='main_info_left_no'>&nbsp</td><td class='employee_post'>" + em.Post + "</td><td class='employee_id'>" + em.EmployeeID + "</td><td class='employee_name'><img src='App_Resources/person.gif' style='cursor: hand; cursor: pointer;'>&nbsp<span style='cursor: hand; cursor: pointer;'  onclick='window.open(\"" + getCardUrl(em.EmployeeID) +"\",\"displayWindow\",\"menubar=no,width=800,height=600,resizable=yes,scrollbars=yes\")'>" + em.FullName + "</span></td><td class='employee_grid_line_center'>&nbsp;</td><td>" + disp.DisplaySchedules(count_days, 18, em.EmployeeID, dep.DepartmentID, hours, overhours, em.Schedule, em.ScheduleDeflection, role, check, closed) + "</td><td class='main_info_right_no'></td></tr></table>";

                }*/
                lbEmps.Text += "</div>";
                content.Controls.Add(lbEmps);

            }

        }

        // ajax �� �������� ������ ����������� ������������� �������������
        string cbReference = Page.ClientScript.GetCallbackEventReference(this, "arg", "ClientCallback", "context");
        string func_name = "FillEmployeesCallback";
        string cbScript = "function " + func_name + "(arg, context)" + "{" + cbReference + ";" + "}";
        Page.ClientScript.RegisterClientScriptBlock(this.GetType(), func_name, cbScript, true);
    }
Esempio n. 33
0
    protected void Save_Click(object sender, ImageClickEventArgs e)
    {
        //Response.Write(Request.Form["test"]);
        Person user = (Person)Session["User"];
        PeriodDB perdb = new PeriodDB();
        Period per = perdb.getPeriod(Convert.ToInt32(this.month), Convert.ToInt32(this.year));

        if (this.employees != null)
        {

            DepartmentList department_list = new DepartmentList();
            List<Department> departments = department_list.getDepartments(employees);

            foreach (Department dep in departments)
            {
                EmployeeList emp_list = new EmployeeList();
                List<Employee> emps = null;//// emp_list.getEmployeesOfDepartment(dep.DepartmentID, employees);
                EmployeeComparerByPostASC cmpByPostASC = new EmployeeComparerByPostASC();
                emps.Sort(cmpByPostASC);
                foreach (Employee em in emps)
                {
                    EmployeeList emplist = new EmployeeList();
                    List<TimekeeperHours> current = null;//emplist.getEmployeesTimekeeperHours(em);
                    List<HRHours> hr_current = null;/// emplist.getEmployeesHRHours(em);

                    for (int i = 1; i <= count_days; i++)
                    {
                        string textbox_id = "tb" + dep.DepartmentID + em.PostID + em.EmployeeID + i.ToString();
                        //string hr_id = "hr" + dep.DepartmentID + em.EmployeeID + i.ToString();

                        Date dt = new Date();
                        SQLDB db = new SQLDB();

                        string hour = Request.Form[textbox_id];
                        //string overhour = Request.Form[hr_id];

                        TimekeeperHours th = current.Find(delegate(TimekeeperHours ht) { return ht.Day == i.ToString(); });

                        decimal h = -1;
                        string sym = "";

                        if ((hour != "") && (hour != null))
                        {
                            if (HasSymbols(hour))
                            {
                                if (th == null)
                                    db.insertTimekeeperHoursAndSymbols(em.EmployeeID, em.StartPeriod, em.BeginDate, em.EndDate, h, hour, user.TabNum, dep.DepartmentID, em.PostID, i.ToString(), month, year, per.PeriodID);
                                else
                                    if (!th.Symbols.Equals(hour))
                                        db.updateTimekeeperHoursAndSymbols(user.TabNum, h, hour, th.ID);
                            }
                            else
                            {
                                h = Convert.ToDecimal(hour);

                                if (th == null)
                                    db.insertTimekeeperHoursAndSymbols(em.EmployeeID, em.StartPeriod, em.BeginDate, em.EndDate, h, sym, user.TabNum, dep.DepartmentID, em.PostID, i.ToString(), month, year, per.PeriodID);
                                else
                                    if (th.Hours != h)
                                        db.updateTimekeeperHoursAndSymbols(user.TabNum, h, sym, th.ID);
                            }
                        }

                        if ((hour == "") && (th != null)) db.deleteTimekeeperHours(th.ID);

                    }
                }

            }
        }

        EncryptedQueryString QueryString = new EncryptedQueryString();
        QueryString.Add("month", period.SelectedItem.Value);
        QueryString.Add("role", role);
        //Server.Transfer("TimeTable.aspx?data=" + QueryString.ToString());
        //Response.Redirect("Tabel.aspx?data=" + QueryString.ToString());
    }