コード例 #1
0
ファイル: DelegationsDAL.cs プロジェクト: nmtri1987/stadavn
        private bool IsDelegationNotApprovedYet(Delegation delegation, int currentUserInfoId, SPWeb web)
        {
            var isDelegationNotApprovedYet = false;

            string listUrl     = delegation.ListUrl;
            int    itemId      = delegation.ListItemID;
            var    queryString = $"<Where><Eq><FieldRef Name='ID'></FieldRef><Value Type='Integer'>{itemId.ToString(CultureInfo.InvariantCulture)}</Value></Eq></Where>";
            SPList list        = web.GetList(string.Format("{0}{1}", this.SiteUrl, listUrl));
            var    query       = new SPQuery {
                Query = queryString
            };
            var results = list.GetItems(query);

            if (results != null && results.Count > 0)
            {
                int fromEmployeeId    = 0;
                var delegatedEmployee = DelegationManager.GetCurrentEmployeeProcessing(listUrl, results[0], web);
                if (delegatedEmployee != null)
                {
                    fromEmployeeId = delegatedEmployee.LookupId;
                }
                if (fromEmployeeId > 0)
                {
                    var isDelegation = DelegationPermissionManager.IsDelegation(fromEmployeeId, currentUserInfoId, listUrl, itemId, this.SiteUrl);
                    if (isDelegation != null)
                    {
                        isDelegationNotApprovedYet = true;
                    }
                }
                return(isDelegationNotApprovedYet);
            }

            return(false);
        }
コード例 #2
0
ファイル: FilterTask.cs プロジェクト: nmtri1987/stadavn
        public FilterTask(Models.VehicleManagement vehicleManagement)
        {
            string vehicleType = vehicleManagement.Type;

            if (CultureInfo.CurrentUICulture.LCID == 1066)
            {
                if (vehicleType.ToLower().IndexOf("company") >= 0)
                {
                    vehicleType = ResourceHelper.GetLocalizedString("VehicleManagement_VehicleType_Choice_Company", StringConstant.ResourcesFileLists, CultureInfo.CurrentUICulture.LCID);
                }
                else
                {
                    vehicleType = ResourceHelper.GetLocalizedString("VehicleManagement_VehicleType_Choice_Private", StringConstant.ResourcesFileLists, CultureInfo.CurrentUICulture.LCID);
                }
            }

            string fromDesc = ResourceHelper.GetLocalizedString("VehicleManagement_CommonFrom", StringConstant.ResourcesFileLists, CultureInfo.CurrentUICulture.LCID);
            string toDesc   = ResourceHelper.GetLocalizedString("VehicleManagement_CommonTo", StringConstant.ResourcesFileLists, CultureInfo.CurrentUICulture.LCID);
            string fromVal  = vehicleManagement.From.ToString(StringConstant.DateFormatddMMyyyyHHmm);
            string toVal    = vehicleManagement.ToDate.ToString(StringConstant.DateFormatddMMyyyyHHmm);

            this.Description     = string.Format("{0} - ({1}: {2} - {3}: {4})", vehicleType, fromDesc, fromVal, toDesc, toVal);
            this.Requester       = vehicleManagement.Requester;
            this.Department      = vehicleManagement.CommonDepartment;
            this.CreatedDate     = vehicleManagement.Created;
            this.DueDate         = vehicleManagement.RequestDueDate == DateTime.MinValue ? vehicleManagement.From : vehicleManagement.RequestDueDate; // TODO
            this.ItemId          = vehicleManagement.ID;
            this.ItemApprovalUrl = $"{DelegationManager.BuildListItemApprovalUrl2(VehicleManagementList.ListUrl, vehicleManagement.ID)}&Source=/SitePages/Overview.aspx";
            this.InitModule(VehicleManagementList.ListUrl);
        }
コード例 #3
0
ファイル: Delegation.cs プロジェクト: nmtri1987/stadavn
        public Delegation(Models.VehicleManagement vehicleManagement, SPWeb currentWeb = null) : this(currentWeb)
        {
            //ModuleName = "Vehicle Registration Management";
            //VietnameseModuleName = "Quản Lý Đăng Ký Đi Xe";
            ListItemID          = vehicleManagement.ID;
            ListUrl             = StringConstant.VehicleManagementList.ListUrl;
            ListItemCreatedDate = vehicleManagement.Created;
            Requester           = vehicleManagement.Requester;
            Department          = vehicleManagement.CommonDepartment;

            string vehicleType = vehicleManagement.Type;
            if (CultureInfo.CurrentUICulture.LCID == 1066)
            {
                if (vehicleType.ToLower().IndexOf("company") >= 0)
                {
                    vehicleType = ResourceHelper.GetLocalizedString("VehicleManagement_VehicleType_Choice_Company", StringConstant.ResourcesFileLists, CultureInfo.CurrentUICulture.LCID);
                }
                else
                {
                    vehicleType = ResourceHelper.GetLocalizedString("VehicleManagement_VehicleType_Choice_Private", StringConstant.ResourcesFileLists, CultureInfo.CurrentUICulture.LCID);
                }
            }

            string fromDesc = ResourceHelper.GetLocalizedString("VehicleManagement_CommonFrom", StringConstant.ResourcesFileLists, CultureInfo.CurrentUICulture.LCID);
            string toDesc   = ResourceHelper.GetLocalizedString("VehicleManagement_CommonTo", StringConstant.ResourcesFileLists, CultureInfo.CurrentUICulture.LCID);
            string fromVal  = vehicleManagement.From.ToString(StringConstant.DateFormatddMMyyyyHHmm);
            string toVal    = vehicleManagement.ToDate.ToString(StringConstant.DateFormatddMMyyyyHHmm);
            ListItemDescription = string.Format("{0} - ({1}: {2} - {3}: {4})", vehicleType, fromDesc, fromVal, toDesc, toVal);
            ListItemApprovalUrl = DelegationManager.BuildListItemApprovalUrl2(this.ListUrl, vehicleManagement.ID);
            this.InitModuleName(VehicleManagementList.ListUrl);
        }
コード例 #4
0
ファイル: FilterTask.cs プロジェクト: nmtri1987/stadavn
        public FilterTask(Models.FreightManagement freightManagement)
        {
            string bringerVal = string.Empty;

            if (freightManagement.CompanyVehicle == true)
            {
                bringerVal = ResourceHelper.GetLocalizedString("FreightManagement_CompanyVehicle", StringConstant.ResourcesFileLists, CultureInfo.CurrentUICulture.LCID);
            }
            else
            {
                LookupItem bringerLookupItem = freightManagement.Bringer;
                if (bringerLookupItem != null && bringerLookupItem.LookupId > 0)
                {
                    bringerVal = bringerLookupItem.LookupValue;
                }
                else
                {
                    bringerVal = freightManagement.BringerName;
                }
            }

            this.Description     = string.Format("{0} - {1}", bringerVal, freightManagement.Reason);
            this.Requester       = freightManagement.Requester;
            this.Department      = freightManagement.Department;
            this.CreatedDate     = freightManagement.Created;
            this.DueDate         = freightManagement.RequestDueDate == DateTime.MinValue ? freightManagement.TransportTime : freightManagement.RequestDueDate; // TODO
            this.ItemId          = freightManagement.ID;
            this.ItemApprovalUrl = $"{DelegationManager.BuildListItemApprovalUrl2(FreightManagementList.ListUrl, freightManagement.ID)}&Source=/SitePages/Overview.aspx";
            this.InitModule(FreightManagementList.ListUrl);
        }
コード例 #5
0
ファイル: Delegation.cs プロジェクト: nmtri1987/stadavn
        public Delegation(Models.FreightManagement freightManagement, SPWeb currentWeb = null) : this(currentWeb)
        {
            //ModuleName = "Freight Management";
            //VietnameseModuleName = "Quản Lý Vận Chuyển Hàng Hóa";
            ListItemID          = freightManagement.ID;
            ListUrl             = StringConstant.FreightManagementList.ListUrl;
            ListItemCreatedDate = freightManagement.Created;
            Requester           = freightManagement.Requester;
            Department          = freightManagement.Department;

            string bringerVal = string.Empty;
            if (freightManagement.CompanyVehicle == true)
            {
                bringerVal = ResourceHelper.GetLocalizedString("FreightManagement_CompanyVehicle", StringConstant.ResourcesFileLists, CultureInfo.CurrentUICulture.LCID);
            }
            else
            {
                LookupItem bringerLookupItem = freightManagement.Bringer;
                if (bringerLookupItem != null && bringerLookupItem.LookupId > 0)
                {
                    bringerVal = bringerLookupItem.LookupValue;
                }
                else
                {
                    bringerVal = freightManagement.BringerName;
                }
            }
            ListItemDescription = string.Format("{0} - {1}", bringerVal, freightManagement.Reason);
            ListItemApprovalUrl = DelegationManager.BuildListItemApprovalUrl2(this.ListUrl, freightManagement.ID);
            this.InitModuleName(FreightManagementList.ListUrl);
        }
コード例 #6
0
 // Start is called before the first frame update
 void Start()
 {
     delMngr = GameObject.FindObjectOfType <DelegationManager>();
     foreach (var actor in GameObject.FindObjectsOfType <DelegationActor>())
     {
         registerActor(actor);
     }
 }
コード例 #7
0
    void Start()
    {
        delMnger   = GameObject.FindObjectOfType <DelegationManager>();
        actorMnger = GameObject.FindObjectOfType <ActorManager>();

        // use the globale game event system to do something.
        // globalEventSystem.Quit += resetAssignments;
    }
コード例 #8
0
        /// <summary>
        /// When have new task, check assignee who has delegation or no. If have, insert into delegations list.
        /// </summary>
        /// <param name="properties">The SPItemEventProperties object.</param>
        private void UpdateDelegationOfNewTask(SPItemEventProperties properties)
        {
            string     listUrl                   = properties.List.RootFolder.ServerRelativeUrl;
            int        taskFromEmployeeId        = 0;
            LookupItem currentEmployeeProcessing = DelegationManager.GetCurrentEmployeeProcessing(listUrl, properties.ListItem, properties.Web);

            if (currentEmployeeProcessing != null)
            {
                taskFromEmployeeId = currentEmployeeProcessing.LookupId;
            }

            if (taskFromEmployeeId > 0)
            {
                string webUrl = properties.WebUrl;
                var    delegationOfNewTasks = DelegationPermissionManager.HasDelegationOfNewTasks(taskFromEmployeeId, listUrl, webUrl);
                if (delegationOfNewTasks != null)
                {
                    foreach (var delegationOfNewTask in delegationOfNewTasks)
                    {
                        try
                        {
                            var delegationListItem = DelegationManager.GetDelegationListItem(listUrl, properties.ListItem, properties.Web);
                            if (delegationListItem != null)
                            {
                                List <int> toEmployeeIds       = delegationOfNewTask.ToEmployee.Select(e => e.LookupId).ToList();
                                bool       isDelegationExisted = DelegationManager.IsDelegationExisted(taskFromEmployeeId, toEmployeeIds, listUrl, properties.ListItemId, delegationOfNewTask.FromDate, delegationOfNewTask.ToDate, properties.Web.Url);
                                if (isDelegationExisted == true)
                                {
                                    return;
                                }

                                delegationListItem.FromDate     = delegationOfNewTask.FromDate;
                                delegationListItem.ToDate       = delegationOfNewTask.ToDate;
                                delegationListItem.FromEmployee = delegationOfNewTask.FromEmployee;
                                delegationListItem.ToEmployee   = delegationOfNewTask.ToEmployee;
                                StringBuilder toEmployeesBuilder = new StringBuilder();
                                foreach (var toEmployee in delegationListItem.ToEmployee)
                                {
                                    toEmployeesBuilder.AppendFormat("{0}; ", toEmployee.LookupValue);
                                }
                                delegationListItem.Title = string.Format("{0} - {1}", delegationListItem.FromEmployee.LookupValue, toEmployeesBuilder.ToString());
                                var delegationsDAL = new DelegationsDAL(webUrl);
                                int id             = delegationsDAL.SaveItem(delegationListItem);
                                if (id <= 0)
                                {
                                    ULSLogging.LogError(new Exception("Updating for new delegation was unsuccessfully."));
                                }
                            }
                        }
                        catch (Exception ex)
                        {
                            ULSLogging.LogError(ex);
                        }
                    }
                }
            }
        }
コード例 #9
0
 private void Awake()
 {
     if (_instance != null && _instance != this)
     {
         Destroy(this.gameObject);
     }
     else
     {
         _instance = this;
     }
 }
コード例 #10
0
ファイル: FilterTask.cs プロジェクト: nmtri1987/stadavn
 public FilterTask(Models.Request requestManagement)
 {
     this.Description     = requestManagement.Title;
     this.Requester       = requestManagement.CommonCreator;
     this.Department      = requestManagement.Department;
     this.CreatedDate     = requestManagement.Created;
     this.DueDate         = requestManagement.RequestDueDate == DateTime.MinValue ? requestManagement.FinishDate : requestManagement.RequestDueDate;// TODO
     this.ItemId          = requestManagement.ID;
     this.ItemApprovalUrl = $"{DelegationManager.BuildListItemApprovalUrl(RequestsList.Url, this.ItemId)}&Source=/SitePages/Overview.aspx";
     this.InitModule(RequestsList.Url);
 }
コード例 #11
0
ファイル: FilterTask.cs プロジェクト: nmtri1987/stadavn
 public FilterTask(Models.EmployeeRequirementSheet recruitmentManagement)
 {
     this.Description     = recruitmentManagement.Position;
     this.Requester       = recruitmentManagement.CommonCreator;
     this.Department      = recruitmentManagement.CommonDepartment;
     this.CreatedDate     = recruitmentManagement.Created;
     this.DueDate         = recruitmentManagement.RequestDueDate == DateTime.MinValue ? recruitmentManagement.AvailableTime : recruitmentManagement.RequestDueDate;// Policy: 15 ngay // TODO
     this.ItemId          = recruitmentManagement.ID;
     this.ItemApprovalUrl = $"{DelegationManager.BuildListItemApprovalUrl(EmployeeRequirementSheetsList.Url, this.ItemId)}&Source=/SitePages/Overview.aspx";
     this.InitModule(EmployeeRequirementSheetsList.Url);
 }
コード例 #12
0
ファイル: FilterTask.cs プロジェクト: nmtri1987/stadavn
 public FilterTask(Models.OverTimeManagement overtimeManagement)
 {
     this.Description     = string.Format("{0} - {1}", overtimeManagement.CommonDate.ToString("dd/MM/yyyy", CultureInfo.InvariantCulture), overtimeManagement.Requester.LookupValue);
     this.Requester       = overtimeManagement.Requester;
     this.Department      = overtimeManagement.CommonDepartment;
     this.CreatedDate     = overtimeManagement.Created;
     this.DueDate         = overtimeManagement.RequestDueDate == DateTime.MinValue ? overtimeManagement.CommonDate : overtimeManagement.RequestDueDate; // TODO
     this.ItemId          = overtimeManagement.ID;
     this.ItemApprovalUrl = $"{DelegationManager.BuildListItemApprovalUrl2(OverTimeManagementList.ListUrl, this.ItemId)}&Source=/SitePages/Overview.aspx";
     this.InitModule(OverTimeManagementList.ListUrl);
 }
コード例 #13
0
ファイル: FilterTask.cs プロジェクト: nmtri1987/stadavn
 public FilterTask(Models.RequestForDiplomaSupply requestForDiplomaSupply)
 {
     this.Description     = requestForDiplomaSupply.Position;
     this.Requester       = requestForDiplomaSupply.CommonCreator;
     this.Department      = requestForDiplomaSupply.CommonDepartment;
     this.CreatedDate     = requestForDiplomaSupply.Created;
     this.DueDate         = DateTime.MinValue; // TODO
     this.ItemId          = requestForDiplomaSupply.ID;
     this.ItemApprovalUrl = $"{DelegationManager.BuildListItemApprovalUrl(RequestForDiplomaSuppliesList.Url, this.ItemId)}&Source=/SitePages/Overview.aspx";
     this.InitModule(RequestForDiplomaSuppliesList.Url);
 }
コード例 #14
0
ファイル: FilterTask.cs プロジェクト: nmtri1987/stadavn
 public FilterTask(ShiftManagement shiftManagement)
 {
     this.Description     = string.Format("{0}/{1} - {2}", shiftManagement.Month, shiftManagement.Year, shiftManagement.Requester.LookupValue);
     this.Requester       = shiftManagement.Requester;
     this.Department      = shiftManagement.Department;
     this.CreatedDate     = shiftManagement.Created;
     this.DueDate         = DateTime.Now;
     this.ItemId          = shiftManagement.ID;
     this.ItemApprovalUrl = $"{DelegationManager.BuildListItemApprovalUrl2(ShiftManagementList.ListUrl, this.ItemId)}&Source=/SitePages/Overview.aspx";
     this.InitModule(ShiftManagementList.ListUrl);
 }
コード例 #15
0
ファイル: FilterTask.cs プロジェクト: nmtri1987/stadavn
 public FilterTask(Models.GuestReceptionManagement guestReceptionManagement)
 {
     this.Description     = guestReceptionManagement.Title;
     this.Requester       = guestReceptionManagement.CommonCreator;
     this.Department      = guestReceptionManagement.CommonDepartment;
     this.CreatedDate     = guestReceptionManagement.Created;
     this.DueDate         = DateTime.MinValue; // TODO
     this.ItemId          = guestReceptionManagement.ID;
     this.ItemApprovalUrl = $"{DelegationManager.BuildListItemApprovalUrl(GuestReceptionManagementList.Url, this.ItemId)}&Source=/SitePages/Overview.aspx";
     this.InitModule(GuestReceptionManagementList.Url);
 }
コード例 #16
0
ファイル: FilterTask.cs プロジェクト: nmtri1987/stadavn
 public FilterTask(Models.RequisitionOfMeetingRoom requisitionOfMeetingRoom)
 {
     this.Description     = requisitionOfMeetingRoom.Title;
     this.Requester       = requisitionOfMeetingRoom.CommonCreator;
     this.Department      = requisitionOfMeetingRoom.CommonDepartment;
     this.CreatedDate     = requisitionOfMeetingRoom.Created;
     this.DueDate         = DateTime.MinValue; // TODO
     this.ItemId          = requisitionOfMeetingRoom.ID;
     this.ItemApprovalUrl = $"{DelegationManager.BuildListItemApprovalUrl(RequisitionOfMeetingRoomList.Url, this.ItemId)}&Source=/SitePages/Overview.aspx";
     this.InitModule(RequisitionOfMeetingRoomList.Url);
 }
コード例 #17
0
ファイル: Delegation.cs プロジェクト: nmtri1987/stadavn
 /// <summary>
 /// Initialize from RequestForDiplomaSupply object.
 /// </summary>
 /// <param name="requestForDiplomaSupply">The RequestForDiplomaSupply object.</param>
 public Delegation(Models.RequestForDiplomaSupply requestForDiplomaSupply, SPWeb currentWeb = null) : this(currentWeb)
 {
     //this.ModuleName = "Request For Diploma Supply Management";
     //this.VietnameseModuleName = "Quản Lý Phiếu Đề Nghị Bổ Sung Bằng Cấp";
     this.ListItemDescription = string.Format("{0} - {1}", requestForDiplomaSupply.EmployeeName, requestForDiplomaSupply.Position);
     this.Requester           = requestForDiplomaSupply.CommonCreator;
     this.Department          = requestForDiplomaSupply.CommonDepartment;
     this.ListItemCreatedDate = requestForDiplomaSupply.Created;
     this.ListUrl             = RequestForDiplomaSuppliesList.Url;
     this.ListItemID          = requestForDiplomaSupply.ID;
     this.ListItemApprovalUrl = DelegationManager.BuildListItemApprovalUrl(this.CurrentWeb, this.ListUrl, this.ListItemID);
     this.InitModuleName(RequestForDiplomaSuppliesList.Url);
 }
コード例 #18
0
ファイル: Delegation.cs プロジェクト: nmtri1987/stadavn
 /// <summary>
 /// Initialize from Request object.
 /// </summary>
 /// <param name="request">The Request object.</param>
 public Delegation(Models.Request request, SPWeb currentWeb = null) : this(currentWeb)
 {
     //this.ModuleName = "Requests Management";
     //this.VietnameseModuleName = "Quản Lý Phiếu Đề Nghị";
     this.ListItemDescription = request.Title;
     this.Requester           = request.CommonCreator;
     this.Department          = request.Department;
     this.ListItemCreatedDate = request.Created;
     this.ListUrl             = RequestsList.Url;
     this.ListItemID          = request.ID;
     this.ListItemApprovalUrl = DelegationManager.BuildListItemApprovalUrl(this.CurrentWeb, this.ListUrl, this.ListItemID);
     this.InitModuleName(RequestsList.Url);
 }
コード例 #19
0
ファイル: Delegation.cs プロジェクト: nmtri1987/stadavn
 /// <summary>
 /// Initialize from EmployeeRequirementSheet object.
 /// </summary>
 /// <param name="employeeRequirementSheet">The EmployeeRequirementSheet object.</param>
 public Delegation(Models.EmployeeRequirementSheet employeeRequirementSheet, SPWeb currentWeb = null) : this(currentWeb)
 {
     //this.ModuleName = "Recruitment Management";
     //this.VietnameseModuleName = "Quản Lý Yêu Cầu Tuyển Dụng";
     this.ListItemDescription = employeeRequirementSheet.Position;
     this.Requester           = employeeRequirementSheet.CommonCreator;
     this.Department          = employeeRequirementSheet.CommonDepartment;
     this.ListItemCreatedDate = employeeRequirementSheet.Created;
     this.ListUrl             = EmployeeRequirementSheetsList.Url;
     this.ListItemID          = employeeRequirementSheet.ID;
     this.ListItemApprovalUrl = DelegationManager.BuildListItemApprovalUrl(this.CurrentWeb, this.ListUrl, this.ListItemID);
     this.InitModuleName(EmployeeRequirementSheetsList.Url);
 }
コード例 #20
0
ファイル: Delegation.cs プロジェクト: nmtri1987/stadavn
 /// <summary>
 /// Initialize from RequisitionOfMeetingRoom object.
 /// </summary>
 /// <param name="request">The RequisitionOfMeetingRoom object.</param>
 public Delegation(Models.RequisitionOfMeetingRoom requisitionOfMeetingRoom, SPWeb currentWeb = null) : this(currentWeb)
 {
     //this.ModuleName = "Requisition Of Meeting Room Management";
     //this.VietnameseModuleName = "Quản Lý Yêu Cầu Phòng Họp";
     this.ListItemDescription = requisitionOfMeetingRoom.Title;
     this.Requester           = requisitionOfMeetingRoom.CommonCreator;
     this.Department          = requisitionOfMeetingRoom.CommonDepartment;
     this.ListItemCreatedDate = requisitionOfMeetingRoom.Created;
     this.ListUrl             = RequisitionOfMeetingRoomList.Url;
     this.ListItemID          = requisitionOfMeetingRoom.ID;
     this.ListItemApprovalUrl = DelegationManager.BuildListItemApprovalUrl(this.CurrentWeb, this.ListUrl, this.ListItemID);
     this.InitModuleName(RequisitionOfMeetingRoomList.Url);
 }
コード例 #21
0
ファイル: Delegation.cs プロジェクト: nmtri1987/stadavn
 /// <summary>
 /// Initialize from GuestReceptionManagement object.
 /// </summary>
 /// <param name="request">The GuestReceptionManagement object.</param>
 public Delegation(Models.GuestReceptionManagement guestReceptionManagement, SPWeb currentWeb = null) : this(currentWeb)
 {
     //this.ModuleName = "Requirement For Guest Reception Management";
     //this.VietnameseModuleName = "Quản Lý Yêu Đón Tiếp Khách";
     this.ListItemDescription = guestReceptionManagement.Title;
     this.Requester           = guestReceptionManagement.CommonCreator;
     this.Department          = guestReceptionManagement.CommonDepartment;
     this.ListItemCreatedDate = guestReceptionManagement.Created;
     this.ListUrl             = GuestReceptionManagementList.Url;
     this.ListItemID          = guestReceptionManagement.ID;
     this.ListItemApprovalUrl = DelegationManager.BuildListItemApprovalUrl(this.CurrentWeb, this.ListUrl, this.ListItemID);
     this.InitModuleName(GuestReceptionManagementList.Url);
 }
コード例 #22
0
        /// <summary>
        /// GetSelectedDelegationTasks
        /// </summary>
        /// <returns></returns>
        private List <Delegation> GetSelectedDelegationTasks()
        {
            var res = new List <Delegation>();

            var delegationTasks = this.Page.Session[DelegationTasksSessionKey] as List <Delegation>;

            if (delegationTasks != null && delegationTasks.Count > 0)
            {
                string     title        = string.Format("{0} - {1}", this.ddlFromEmployee.SelectedItem.Text, this.ddlToEmployee.SelectedItem.Text);
                DateTime   fromDate     = this.dtFromDate.SelectedDate.Date;
                DateTime   toDate       = this.dtToDate.SelectedDate.Date;
                LookupItem fromEmployee = new LookupItem {
                    LookupId = int.Parse(this.ddlFromEmployee.SelectedItem.Value), LookupValue = this.ddlFromEmployee.SelectedItem.Text
                };
                List <LookupItem>    toEmployees = new List <LookupItem>();
                JavaScriptSerializer seriallizer = new JavaScriptSerializer();
                var selectedToEmployees          = seriallizer.Deserialize <List <int> >(this.hdSelectedToEmployees.Value);
                foreach (var toEmployee in selectedToEmployees)
                {
                    LookupItem lookupItem = new LookupItem();
                    lookupItem.LookupId = toEmployee;
                    toEmployees.Add(lookupItem);
                }

                foreach (GridViewRow gridViewRow in this.gridTasks.Rows)
                {
                    if (gridViewRow.RowType == DataControlRowType.DataRow)
                    {
                        var cbSelect = gridViewRow.FindControl("cbSelect") as CheckBox;
                        if (cbSelect.Checked)
                        {
                            Delegation delegation = delegationTasks[gridViewRow.RowIndex];
                            delegation.Title        = title;
                            delegation.FromDate     = fromDate;
                            delegation.ToDate       = toDate;
                            delegation.FromEmployee = fromEmployee;
                            delegation.ToEmployee   = toEmployees;
                            var isExisted = DelegationManager.IsDelegationExisted(delegation, this.SiteUrl);
                            if (!isExisted)
                            {
                                res.Add(delegation);
                            }
                        }
                    }
                }
            }

            return(res);
        }
コード例 #23
0
ファイル: FilterTask.cs プロジェクト: nmtri1987/stadavn
        public FilterTask(ChangeShiftManagement changeShiftManagement)
        {
            InitEmployeeDAL(SPContext.Current.Web);

            this.Description = string.Format("{0}/{1} - {2}/{3}", changeShiftManagement.FromDate.ToString("dd/MM/yyyy", CultureInfo.InvariantCulture), changeShiftManagement.FromShift.LookupValue, changeShiftManagement.ToDate.ToString("dd/MM/yyyy", CultureInfo.InvariantCulture), changeShiftManagement.ToShift.LookupValue);
            this.Requester   = changeShiftManagement.Requester;
            var requesterInfo = _employeeInfoDAL.GetByID(changeShiftManagement.Requester.LookupId);

            this.Department      = requesterInfo.Department;
            this.CreatedDate     = changeShiftManagement.Created;
            this.DueDate         = changeShiftManagement.RequestDueDate == DateTime.MinValue ? changeShiftManagement.FromDate : changeShiftManagement.RequestDueDate; // TODO
            this.ItemId          = changeShiftManagement.ID;
            this.ItemApprovalUrl = $"{DelegationManager.BuildListItemApprovalUrl2(ChangeShiftList.ListUrl, this.ItemId)}&Source=/SitePages/Overview.aspx";
            this.InitModule(ChangeShiftList.ListUrl);
        }
コード例 #24
0
ファイル: FilterTask.cs プロジェクト: nmtri1987/stadavn
        public FilterTask(Models.NotOvertimeManagement notOvertimeManagement)
        {
            InitEmployeeDAL(SPContext.Current.Web);

            this.Description = string.Format("{0} - {1}", notOvertimeManagement.Date.ToString("dd/MM/yyyy", CultureInfo.InvariantCulture), notOvertimeManagement.Requester.LookupValue);
            this.Requester   = notOvertimeManagement.Requester;
            var requesterInfo = _employeeInfoDAL.GetByID(notOvertimeManagement.Requester.LookupId);

            this.Department      = requesterInfo.Department;
            this.CreatedDate     = notOvertimeManagement.Created;
            this.DueDate         = notOvertimeManagement.RequestDueDate == DateTime.MinValue ? notOvertimeManagement.FromDate : notOvertimeManagement.RequestDueDate;// TODO
            this.ItemId          = notOvertimeManagement.ID;
            this.ItemApprovalUrl = $"{DelegationManager.BuildListItemApprovalUrl2(NotOvertimeList.ListUrl, this.ItemId)}&Source=/SitePages/Overview.aspx";
            this.InitModule(NotOvertimeList.ListUrl);
        }
コード例 #25
0
ファイル: Delegation.cs プロジェクト: nmtri1987/stadavn
 /// <summary>
 /// Initialize from Overtime Management object.
 /// </summary>
 /// <param name="shiftManagement">The Overtime Management object.</param>
 public Delegation(Models.OverTimeManagement overtimeManagement, SPWeb currentWeb = null) : this(currentWeb)
 {
     if (currentWeb == null)
     {
         currentWeb = SPContext.Current.Web;
     }
     this.ListItemDescription = string.Format("{0} - {1}", overtimeManagement.CommonDate.ToString("dd/MM/yyyy", CultureInfo.InvariantCulture), overtimeManagement.Requester.LookupValue);
     this.Requester           = overtimeManagement.Requester;
     this.Department          = overtimeManagement.CommonDepartment;
     this.ListItemCreatedDate = overtimeManagement.Created;
     this.ListUrl             = OverTimeManagementList.ListUrl;
     this.ListItemID          = overtimeManagement.ID;
     this.ListItemApprovalUrl = DelegationManager.BuildListItemApprovalUrl2(this.ListUrl, this.ListItemID);
     this.InitModuleName(OverTimeManagementList.ListUrl);
 }
コード例 #26
0
ファイル: FilterTask.cs プロジェクト: nmtri1987/stadavn
        public FilterTask(Models.LeaveManagement leaveManagement)
        {
            string requestFor = leaveManagement.RequestFor.LookupValue;
            string fromDesc   = ResourceHelper.GetLocalizedString("LeaveList_From", StringConstant.ResourcesFileLists, CultureInfo.CurrentUICulture.LCID);
            string toDesc     = ResourceHelper.GetLocalizedString("LeaveList_To", StringConstant.ResourcesFileLists, CultureInfo.CurrentUICulture.LCID);
            string fromVal    = leaveManagement.From.ToString(StringConstant.DateFormatddMMyyyyHHmm);
            string toVal      = leaveManagement.To.ToString(StringConstant.DateFormatddMMyyyyHHmm);

            this.Description     = string.Format("{0} - ({1}: {2} - {3}: {4})", requestFor, fromDesc, fromVal, toDesc, toVal);
            this.Requester       = leaveManagement.Requester;
            this.Department      = leaveManagement.Department;
            this.CreatedDate     = leaveManagement.Created;
            this.DueDate         = leaveManagement.RequestDueDate == DateTime.MinValue ? leaveManagement.From : leaveManagement.RequestDueDate;// TODO
            this.ItemId          = leaveManagement.ID;
            this.ItemApprovalUrl = $"{DelegationManager.BuildListItemApprovalUrl2(LeaveManagementList.ListUrl, this.ItemId)}&Source=/SitePages/Overview.aspx";
            this.InitModule(LeaveManagementList.ListUrl);
        }
コード例 #27
0
ファイル: Delegation.cs プロジェクト: nmtri1987/stadavn
 /// <summary>
 /// Initialize from Shift Management object.
 /// </summary>
 /// <param name="shiftManagement">The Shift Management object.</param>
 public Delegation(Models.ShiftManagement shiftManagement, SPWeb currentWeb = null) : this(currentWeb)
 {
     //this.ModuleName = "Shift Management";
     //this.VietnameseModuleName = "Quản Lý Đi Ca";
     if (currentWeb == null)
     {
         currentWeb = SPContext.Current.Web;
     }
     this.ListItemDescription = string.Format("{0}/{1} - {2}", shiftManagement.Month, shiftManagement.Year, shiftManagement.Requester.LookupValue);
     this.Requester           = shiftManagement.Requester;
     this.Department          = shiftManagement.Department;
     this.ListItemCreatedDate = shiftManagement.Created;
     this.ListUrl             = ShiftManagementList.ListUrl;
     this.ListItemID          = shiftManagement.ID;
     this.ListItemApprovalUrl = DelegationManager.BuildListItemApprovalUrl2(this.ListUrl, this.ListItemID);
     this.InitModuleName(ShiftManagementList.ListUrl);
 }
コード例 #28
0
ファイル: Delegation.cs プロジェクト: nmtri1987/stadavn
        /// <summary>
        /// Initialize from Not Overtime Management object.
        /// </summary>
        /// <param name="shiftManagement">The Not Overtime Management object.</param>
        public Delegation(Models.NotOvertimeManagement notOvertimeManagement, EmployeeInfo fromEmployee, SPWeb currentWeb = null) : this(currentWeb)
        {
            if (currentWeb == null)
            {
                currentWeb = SPContext.Current.Web;
            }
            InitEmployeeDAL(currentWeb);

            this.ListItemDescription = string.Format("{0} - {1}", notOvertimeManagement.Date.ToString("dd/MM/yyyy", CultureInfo.InvariantCulture), notOvertimeManagement.Requester.LookupValue);
            this.Requester           = notOvertimeManagement.Requester;
            var requesterInfo = _employeeInfoDAL.GetByID(notOvertimeManagement.Requester.LookupId);
            this.Department          = requesterInfo.Department;
            this.ListItemCreatedDate = notOvertimeManagement.Created;
            this.ListUrl             = NotOvertimeList.ListUrl;
            this.ListItemID          = notOvertimeManagement.ID;
            this.ListItemApprovalUrl = DelegationManager.BuildListItemApprovalUrl2(this.ListUrl, this.ListItemID);
            this.InitModuleName(NotOvertimeList.ListUrl);
        }
コード例 #29
0
ファイル: Delegation.cs プロジェクト: nmtri1987/stadavn
        /// <summary>
        /// Initialize from Change Shift Management object.
        /// </summary>
        /// <param name="shiftManagement">The Change Shift Management object.</param>
        public Delegation(Models.ChangeShiftManagement changeShiftManagement, EmployeeInfo fromEmployee, SPWeb currentWeb = null) : this(currentWeb)
        {
            if (currentWeb == null)
            {
                currentWeb = SPContext.Current.Web;
            }
            InitEmployeeDAL(currentWeb);

            this.ListItemDescription = string.Format("{0}/{1} - {2}/{3}", changeShiftManagement.FromDate.ToString("dd/MM/yyyy", CultureInfo.InvariantCulture), changeShiftManagement.FromShift.LookupValue, changeShiftManagement.ToDate.ToString("dd/MM/yyyy", CultureInfo.InvariantCulture), changeShiftManagement.ToShift.LookupValue);
            this.Requester           = changeShiftManagement.Requester;
            var requesterInfo = _employeeInfoDAL.GetByID(changeShiftManagement.Requester.LookupId);
            this.Department          = requesterInfo.Department;
            this.ListItemCreatedDate = changeShiftManagement.Created;
            this.ListUrl             = ChangeShiftList.ListUrl;
            this.ListItemID          = changeShiftManagement.ID;
            this.ListItemApprovalUrl = DelegationManager.BuildListItemApprovalUrl2(this.ListUrl, this.ListItemID);
            this.InitModuleName(ChangeShiftList.ListUrl);
        }
コード例 #30
0
ファイル: Delegation.cs プロジェクト: nmtri1987/stadavn
        public Delegation(Models.LeaveManagement leaveManagement, SPWeb currentWeb = null) : this(currentWeb)
        {
            //ModuleName = "Leave Management";
            //VietnameseModuleName = "Quản Lý Nghỉ Phép";
            ListItemID          = leaveManagement.ID;
            ListUrl             = StringConstant.LeaveManagementList.ListUrl;
            ListItemCreatedDate = leaveManagement.Created;
            Requester           = leaveManagement.Requester;
            Department          = leaveManagement.Department;

            string requestFor = leaveManagement.RequestFor.LookupValue;
            string fromDesc   = ResourceHelper.GetLocalizedString("LeaveList_From", StringConstant.ResourcesFileLists, CultureInfo.CurrentUICulture.LCID);
            string toDesc     = ResourceHelper.GetLocalizedString("LeaveList_To", StringConstant.ResourcesFileLists, CultureInfo.CurrentUICulture.LCID);
            string fromVal    = leaveManagement.From.ToString(StringConstant.DateFormatddMMyyyyHHmm);
            string toVal      = leaveManagement.To.ToString(StringConstant.DateFormatddMMyyyyHHmm);
            ListItemDescription = string.Format("{0} - ({1}: {2} - {3}: {4})", requestFor, fromDesc, fromVal, toDesc, toVal);
            ListItemApprovalUrl = DelegationManager.BuildListItemApprovalUrl2(this.ListUrl, leaveManagement.ID);
            this.InitModuleName(LeaveManagementList.ListUrl);
        }