Пример #1
0
        public void TestSetup()
        {
            dutyPlace_testObject = new DutyPlace();
            busDutyPlace         = new BDutyPlace();

            DatabaseGateway.TA_DutyPlaceDataTable dutyTable = dutyPlaceTA.GetRoot();
            DatabaseGateway.TA_DutyPlaceRow       dutyPlaceRow;
            if (dutyTable.Rows.Count == 0)
            {
                dutyPlaceTA.Insert("TestDutyPlaceRoot", "0-00Test", 0);
                dutyTable = dutyPlaceTA.GetRoot();
            }
            dutyPlaceRow                = dutyTable.Rows[0] as DatabaseGateway.TA_DutyPlaceRow;
            ADODutyPlaceRoot.ID         = dutyPlaceRow.dutyPlc_ID;
            ADODutyPlaceRoot.CustomCode = dutyPlaceRow.dutyPlc_CustomCode;
            ADODutyPlaceRoot.Name       = dutyPlaceRow.dutyPlc_Name;
            ADODutyPlaceRoot.ParentID   = 0;

            dutyPlaceTA.Insert("TestDutyPlace1", "0-00Test1", ADODutyPlaceRoot.ID);
            dutyTable                = dutyPlaceTA.GetDataByCustomCode("0-00Test1");
            dutyPlaceRow             = dutyTable.Rows[0] as DatabaseGateway.TA_DutyPlaceRow;
            ADODutyPlace1.ID         = dutyPlaceRow.dutyPlc_ID;
            ADODutyPlace1.Name       = dutyPlaceRow.dutyPlc_Name;
            ADODutyPlace1.CustomCode = dutyPlaceRow.dutyPlc_CustomCode;
            ADODutyPlace1.ParentID   = dutyPlaceRow.dutyPlc_ParentID;

            dutyPlaceTA.Insert("TestDutyPlace2", "0-00Test2", ADODutyPlaceRoot.ID);
            dutyTable                = dutyPlaceTA.GetDataByCustomCode("0-00Test2");
            dutyPlaceRow             = dutyTable.Rows[0] as DatabaseGateway.TA_DutyPlaceRow;
            ADODutyPlace2.ID         = dutyPlaceRow.dutyPlc_ID;
            ADODutyPlace2.Name       = dutyPlaceRow.dutyPlc_Name;
            ADODutyPlace2.CustomCode = dutyPlaceRow.dutyPlc_CustomCode;
            ADODutyPlace2.ParentID   = dutyPlaceRow.dutyPlc_ParentID;

            DatasetGatewayWorkFlow.TA_PrecardGroupsDataTable precardTable = new DatasetGatewayWorkFlow.TA_PrecardGroupsDataTable();
            precardGroupTA.FillByName(precardTable, PrecardGroupsName.leave.ToString());
            ADOPrecardGroup1.ID   = Convert.ToInt32(precardTable.Rows[0][0]);
            ADOPrecardGroup1.Name = "HourlyLeave";

            precardTA.Insert("TestPrecard1", true, ADOPrecardGroup1.ID, true, false, true, "99999999", false);

            DatasetGatewayWorkFlow.TA_PrecardDataTable pTable = new DatasetGatewayWorkFlow.TA_PrecardDataTable();
            pTable          = precardTA.GetDataByName("TestPrecard1");
            ADOPrecar1.ID   = Convert.ToInt32(pTable.Rows[0][0]);
            ADOPrecar1.Name = "TestPrecard1";

            requestTA.Insert(ADOPrecar1.ID, ADOPerson1.ID, new DateTime(2010, 5, 1), new DateTime(2010, 5, 1), 420, 600, "", DateTime.Now, ADOUser1.ID);

            DatasetGatewayWorkFlow.TA_RequestDataTable requestTable = new DatasetGatewayWorkFlow.TA_RequestDataTable();
            requestTable   = requestTA.GetDataByPersonId(ADOPerson1.ID);
            ADORequest1.ID = Convert.ToInt32(requestTable.Rows[0][0]);

            requestDetailTA.Insert(ADORequest1.ID, null, null, ADODutyPlace2.ID);
        }
Пример #2
0
 public void Delete_Test()
 {
     try
     {
         busDutyPlace.SaveChanges(ADODutyPlace1, UIActionType.DELETE);
         ClearSession();
         dutyPlace_testObject = busDutyPlace.GetByID(ADODutyPlace1.ID);
         Assert.Fail();
     }
     catch (ItemNotExists ex)
     {
         Assert.Pass();
     }
 }
        private void Fill_trvDutyPlace_ReportParameter()
        {
            string[] retMessage = new string[4];
            try
            {
                this.InitializeCulture();

                IList <DutyPlace> dutyPlcaeList = this.DutyBusiness.GetAll();
                DutyPlace         rootDuty      = this.DutyBusiness.GetDutyPalcesTree();
                TreeViewNode      rootDutyNode  = new TreeViewNode();
                rootDutyNode.ShowCheckBox = true;
                rootDutyNode.ID           = rootDuty.ID.ToString();
                string rootDepNodeText = string.Empty;
                if (GetLocalResourceObject("OrgNode_trvDutyPlace_ReportParameter") != null)
                {
                    rootDepNodeText = GetLocalResourceObject("OrgNode_trvDutyPlace_ReportParameter").ToString();
                }
                else
                {
                    rootDepNodeText = rootDuty.Name;
                }
                rootDutyNode.Text  = rootDepNodeText;
                rootDutyNode.Value = rootDuty.CustomCode;
                if (File.Exists(AppDomain.CurrentDomain.BaseDirectory + "Images\\TreeView\\folder.gif"))
                {
                    rootDutyNode.ImageUrl = "Images/TreeView/folder.gif";
                }
                this.trvDutyPlace_ReportParameter.Nodes.Add(rootDutyNode);
                rootDutyNode.Expanded = true;

                this.GetChildDuty_trvDutyPlace_ReportParameter(dutyPlcaeList, rootDutyNode, rootDuty);
            }
            catch (UIValidationExceptions ex)
            {
                retMessage = this.exceptionHandler.HandleException(this.Page, ExceptionTypes.UIValidationExceptions, ex, retMessage);
                this.ErrorHiddenField_DutyPlace_ReportParameter.Value = this.exceptionHandler.CreateErrorMessage(retMessage);
            }
            catch (UIBaseException ex)
            {
                retMessage = this.exceptionHandler.HandleException(this.Page, ExceptionTypes.UIBaseException, ex, retMessage);
                this.ErrorHiddenField_DutyPlace_ReportParameter.Value = this.exceptionHandler.CreateErrorMessage(retMessage);
            }
            catch (Exception ex)
            {
                retMessage = this.exceptionHandler.HandleException(this.Page, ExceptionTypes.Exception, ex, retMessage);
                this.ErrorHiddenField_DutyPlace_ReportParameter.Value = this.exceptionHandler.CreateErrorMessage(retMessage);
            }
        }
Пример #4
0
 public void Update_Test()
 {
     try
     {
         ADODutyPlace1.Name = "TestDutyDuty";
         busDutyPlace.SaveChanges(ADODutyPlace1, UIActionType.EDIT);
         ClearSession();
         dutyPlace_testObject = busDutyPlace.GetByID(ADODutyPlace1.ID);
         Assert.AreEqual("TestDutyDuty", dutyPlace_testObject.Name);
         Assert.AreEqual(ADODutyPlace1.CustomCode, dutyPlace_testObject.CustomCode);
     }
     catch (Exception ex)
     {
         Assert.Fail(ex.Message);
     }
 }
Пример #5
0
        private void Fill_trvMissionLocationsIntroduction_MissionLocationsIntroduction()
        {
            string[] retMessage = new string[4];
            try
            {
                this.InitializeCulture();

                DutyPlace    rootMissLoc     = this.MissionLocationBusiness.GetDutyPalcesTree();
                TreeViewNode rootMissLocNode = new TreeViewNode();
                rootMissLocNode.ID = rootMissLoc.ID.ToString();
                string rootMissLocNodeText = string.Empty;
                if (GetLocalResourceObject("MissLocNode_trvMissionLocationsIntroduction_MissionLocationsIntroduction") != null)
                {
                    rootMissLocNodeText = GetLocalResourceObject("MissLocNode_trvMissionLocationsIntroduction_MissionLocationsIntroduction").ToString();
                }
                else
                {
                    rootMissLocNodeText = rootMissLoc.Name;
                }
                rootMissLocNode.Text  = rootMissLocNodeText;
                rootMissLocNode.Value = rootMissLoc.CustomCode;
                if (File.Exists(AppDomain.CurrentDomain.BaseDirectory + "\\Images\\TreeView\\folder.gif"))
                {
                    rootMissLocNode.ImageUrl = "Images/TreeView/folder.gif";
                }
                this.trvMissionLocationsIntroduction_MissionLocationsIntroduction.Nodes.Add(rootMissLocNode);
                rootMissLocNode.Expanded = true;

                GetChildMissionLocation_trvMissionLocationsIntroduction_MissionLocationIntroduction(rootMissLocNode, rootMissLoc);
            }
            catch (UIValidationExceptions ex)
            {
                retMessage = this.exceptionHandler.HandleException(this.Page, ExceptionTypes.UIValidationExceptions, ex, retMessage);
                this.ErrorHiddenField_MissionLocations.Value = this.exceptionHandler.CreateErrorMessage(retMessage);
            }
            catch (UIBaseException ex)
            {
                retMessage = this.exceptionHandler.HandleException(this.Page, ExceptionTypes.UIBaseException, ex, retMessage);
                this.ErrorHiddenField_MissionLocations.Value = this.exceptionHandler.CreateErrorMessage(retMessage);
            }
            catch (Exception ex)
            {
                retMessage = this.exceptionHandler.HandleException(this.Page, ExceptionTypes.Exception, ex, retMessage);
                this.ErrorHiddenField_MissionLocations.Value = this.exceptionHandler.CreateErrorMessage(retMessage);
            }
        }
 private void GetChildMissionLocation_trvMissionLocation_DailyRequestOnAbsence(TreeViewNode parentDutyPlaceNode, DutyPlace parentDutyPlace)
 {
     foreach (DutyPlace childDutyPlace in this.RequestBusiness.GetAllDutyPlaceChild(parentDutyPlace.ID))
     {
         TreeViewNode trvNodeChildDutyPlace = new TreeViewNode();
         trvNodeChildDutyPlace.Text = childDutyPlace.Name;
         trvNodeChildDutyPlace.ID   = childDutyPlace.ID.ToString();
         if (File.Exists(AppDomain.CurrentDomain.BaseDirectory + "\\Images\\TreeView\\folder.gif"))
         {
             trvNodeChildDutyPlace.ImageUrl = "Images/TreeView/folder.gif";
         }
         parentDutyPlaceNode.Nodes.Add(trvNodeChildDutyPlace);
         if (this.RequestBusiness.GetAllDutyPlaceChild(childDutyPlace.ID).Count > 0)
         {
             this.GetChildMissionLocation_trvMissionLocation_DailyRequestOnAbsence(trvNodeChildDutyPlace, childDutyPlace);
         }
     }
 }
 private void GetChildDuty_trvDutyPlace_ReportParameter(IList <DutyPlace> dutyPlacesList, TreeViewNode parentDutyNode, DutyPlace parentDutyPlace)
 {
     foreach (DutyPlace childDuty in this.DutyBusiness.GetDutyPlaceChilds(parentDutyPlace.ID))
     {
         TreeViewNode childDepNode = new TreeViewNode();
         childDepNode.ShowCheckBox = true;
         childDepNode.ID           = childDuty.ID.ToString();
         childDepNode.Text         = childDuty.Name;
         childDepNode.Value        = childDuty.CustomCode;
         if (File.Exists(AppDomain.CurrentDomain.BaseDirectory + "\\Images\\TreeView\\folder.gif"))
         {
             childDepNode.ImageUrl = "Images/TreeView/folder.gif";
         }
         parentDutyNode.Nodes.Add(childDepNode);
         try
         {
             if (parentDutyNode.Parent.Parent == null)
             {
                 parentDutyNode.Expanded = true;
             }
         }
         catch
         { }
         if (this.DutyBusiness.GetDutyPlaceChilds(childDuty.ID).Count > 0)
         {
             this.GetChildDuty_trvDutyPlace_ReportParameter(dutyPlacesList, childDepNode, childDuty);
         }
     }
 }
Пример #8
0
        public string[] UpdateMissionLocation_MissionLocationsPage(string state, string ParentMissionLocationID, string SelectedMissionLocationID, string MissionLocationCode, string MissionLocationName)
        {
            this.InitializeCulture();

            string[] retMessage = new string[4];

            try
            {
                decimal MissionLocationID         = 0;
                decimal selectedMissionLocationID = decimal.Parse(this.StringBuilder.CreateString(SelectedMissionLocationID));
                decimal parentMissionLocationID   = decimal.Parse(this.StringBuilder.CreateString(ParentMissionLocationID));
                MissionLocationCode = this.StringBuilder.CreateString(MissionLocationCode);
                MissionLocationName = this.StringBuilder.CreateString(MissionLocationName);
                UIActionType uam = (UIActionType)Enum.Parse(typeof(UIActionType), this.StringBuilder.CreateString(state).ToUpper());

                DutyPlace missionLocation = new DutyPlace();
                if (uam != UIActionType.DELETE)
                {
                    missionLocation.CustomCode = MissionLocationCode;
                    missionLocation.Name       = MissionLocationName;
                }

                switch (uam)
                {
                case UIActionType.ADD:
                    missionLocation.ParentID = selectedMissionLocationID;
                    missionLocation.ID       = 0;
                    MissionLocationID        = this.MissionLocationBusiness.InsertMissionLocation(missionLocation, uam);
                    break;

                case UIActionType.EDIT:
                    if (selectedMissionLocationID == 0)
                    {
                        retMessage = this.exceptionHandler.HandleException(this.Page, ExceptionTypes.Exception, new Exception(GetLocalResourceObject("NoMissionLocationSelectedforEdit").ToString()), retMessage);
                        return(retMessage);
                    }
                    else
                    {
                        missionLocation.ParentID = parentMissionLocationID;
                        missionLocation.ID       = selectedMissionLocationID;
                    }
                    MissionLocationID = this.MissionLocationBusiness.UpdateMissionLocation(missionLocation, uam);
                    break;

                case UIActionType.DELETE:
                    if (selectedMissionLocationID == 0)
                    {
                        retMessage = this.exceptionHandler.HandleException(this.Page, ExceptionTypes.Exception, new Exception(GetLocalResourceObject("NoMissionLocationSelectedforDelete").ToString()), retMessage);
                        return(retMessage);
                    }
                    else
                    {
                        missionLocation.ID = selectedMissionLocationID;
                    }
                    MissionLocationID = this.MissionLocationBusiness.DeleteMissionLocation(missionLocation, uam);
                    break;
                }

                retMessage[0] = GetLocalResourceObject("RetSuccessType").ToString();
                string SuccessMessageBody = string.Empty;
                switch (uam)
                {
                case UIActionType.ADD:
                    SuccessMessageBody = GetLocalResourceObject("AddComplete").ToString();
                    break;

                case UIActionType.EDIT:
                    SuccessMessageBody = GetLocalResourceObject("EditComplete").ToString();
                    break;

                case UIActionType.DELETE:
                    SuccessMessageBody = GetLocalResourceObject("DeleteComplete").ToString();
                    break;

                default:
                    break;
                }
                retMessage[1] = SuccessMessageBody;
                retMessage[2] = "success";
                retMessage[3] = MissionLocationID.ToString();
                return(retMessage);
            }
            catch (UIValidationExceptions ex)
            {
                retMessage = this.exceptionHandler.HandleException(this.Page, ExceptionTypes.UIValidationExceptions, ex, retMessage);
                return(retMessage);
            }
            catch (UIBaseException ex)
            {
                retMessage = this.exceptionHandler.HandleException(this.Page, ExceptionTypes.UIBaseException, ex, retMessage);
                return(retMessage);
            }
            catch (Exception ex)
            {
                retMessage = this.exceptionHandler.HandleException(this.Page, ExceptionTypes.Exception, ex, retMessage);
                return(retMessage);
            }
        }
Пример #9
0
 private void GetChildMissionLocation_trvMissionLocationsIntroduction_MissionLocationIntroduction(TreeViewNode parentMissionLocationNode, DutyPlace parentMissionLocation)
 {
     foreach (DutyPlace childMissionLocation in this.MissionLocationBusiness.GetDutyPlaceChilds(parentMissionLocation.ID))
     {
         TreeViewNode childMissionLocationNode = new TreeViewNode();
         childMissionLocationNode.ID    = childMissionLocation.ID.ToString();
         childMissionLocationNode.Text  = childMissionLocation.Name;
         childMissionLocationNode.Value = childMissionLocation.CustomCode;
         if (File.Exists(AppDomain.CurrentDomain.BaseDirectory + "\\Images\\TreeView\\folder.gif"))
         {
             childMissionLocationNode.ImageUrl = "Images/TreeView/folder.gif";
         }
         parentMissionLocationNode.Nodes.Add(childMissionLocationNode);
         try
         {
             if (parentMissionLocationNode.Parent.Parent == null)
             {
                 parentMissionLocationNode.Expanded = true;
             }
         }
         catch
         { }
         if (this.MissionLocationBusiness.GetDutyPlaceChilds(childMissionLocation.ID).Count > 0)
         {
             this.GetChildMissionLocation_trvMissionLocationsIntroduction_MissionLocationIntroduction(childMissionLocationNode, childMissionLocation);
         }
     }
 }
Пример #10
0
 public void GetTree_Test()
 {
     dutyPlace_testObject = busDutyPlace.GetDutyPalcesTree();
     Assert.AreEqual(dutyPlace_testObject.ID, ADODutyPlaceRoot.ID);
 }
Пример #11
0
 public void GetById_Test()
 {
     dutyPlace_testObject = busDutyPlace.GetByID(ADODutyPlace1.ID);
     Assert.AreEqual(ADODutyPlace1.Name, dutyPlace_testObject.Name);
 }