Esempio n. 1
0
        private void MapSkillsDOSkillsMaster(long?TimeZone, DataSet objDataTable, out List <DOADM_SkillsMaster> lstDOADM_SkillsDetails)
        {
            lstDOADM_SkillsDetails = new List <DOADM_SkillsMaster>();
            try
            {
                foreach (DataRow dr in objDataTable.Tables[0].Rows)
                {
                    DOADM_SkillsMaster objDOADM_SkillsMaster = new DOADM_SkillsMaster();
                    if (dr.Table.Columns.Contains("ADM_SkillsMasterId"))
                    {
                        if (!DBNull.Value.Equals(dr["ADM_SkillsMasterId"]))
                        {
                            objDOADM_SkillsMaster.ADM_SkillsMasterId = (long)dr["ADM_SkillsMasterId"];
                        }
                    }
                    if (dr.Table.Columns.Contains("SkillsName"))
                    {
                        if (!DBNull.Value.Equals(dr["SkillsName"]))
                        {
                            objDOADM_SkillsMaster.SkillsName = dr["SkillsName"].ToString();
                        }
                    }
                    if (dr.Table.Columns.Contains("RoleLkup"))
                    {
                        if (!DBNull.Value.Equals(dr["RoleLkup"]))
                        {
                            objDOADM_SkillsMaster.RoleLkup = (long)dr["RoleLkup"];
                        }
                    }
                    if (dr.Table.Columns.Contains("BusinessSegmentLkup"))
                    {
                        if (!DBNull.Value.Equals(dr["BusinessSegmentLkup"]))
                        {
                            objDOADM_SkillsMaster.BusinessSegmentLkup = (long)dr["BusinessSegmentLkup"];
                        }
                    }
                    if (dr.Table.Columns.Contains("DiscrepancyCategoryLkup"))
                    {
                        if (!DBNull.Value.Equals(dr["DiscrepancyCategoryLkup"]))
                        {
                            objDOADM_SkillsMaster.DiscrepancyCategoryLkup = (long)dr["DiscrepancyCategoryLkup"];
                        }
                    }
                    if (dr.Table.Columns.Contains("CMN_DepartmentRef"))
                    {
                        if (!DBNull.Value.Equals(dr["CMN_DepartmentRef"]))
                        {
                            objDOADM_SkillsMaster.CMN_DepartmentRef = (long)dr["CMN_DepartmentRef"];
                        }
                    }
                    if (dr.Table.Columns.Contains("WorkBasketLkup"))
                    {
                        if (!DBNull.Value.Equals(dr["WorkBasketLkup"]))
                        {
                            objDOADM_SkillsMaster.WorkBasketLkup = (long)dr["WorkBasketLkup"];
                        }
                    }
                    if (dr.Table.Columns.Contains("IsActive"))
                    {
                        if (!DBNull.Value.Equals(dr["IsActive"]))
                        {
                            objDOADM_SkillsMaster.IsActive = Convert.ToBoolean(dr["IsActive"]);
                        }
                    }
                    if (dr.Table.Columns.Contains("UTCCreatedOn"))
                    {
                        if (!DBNull.Value.Equals(dr["UTCCreatedOn"]))
                        {
                            objDOADM_SkillsMaster.UTCCreatedOn = ZoneLookupUI.ConvertToTimeZone(dr["UTCCreatedOn"].ToDateTime(), TimeZone);
                        }
                    }
                    if (dr.Table.Columns.Contains("CreatedByRef"))
                    {
                        if (!DBNull.Value.Equals(dr["CreatedByRef"]))
                        {
                            objDOADM_SkillsMaster.CreatedByRef = (long)dr["CreatedByRef"];
                        }
                    }
                    if (dr.Table.Columns.Contains("UTCLastUpdatedOn"))
                    {
                        if (!DBNull.Value.Equals(dr["UTCLastUpdatedOn"]))
                        {
                            objDOADM_SkillsMaster.UTCLastUpdatedOn = ZoneLookupUI.ConvertToTimeZone(dr["UTCLastUpdatedOn"].ToDateTime(), TimeZone);
                        }
                    }
                    if (dr.Table.Columns.Contains("LastUpdatedByRef"))
                    {
                        if (!DBNull.Value.Equals(dr["LastUpdatedByRef"]))
                        {
                            objDOADM_SkillsMaster.LastUpdatedByRef = (long)dr["LastUpdatedByRef"];
                        }
                    }
                    if (dr.Table.Columns.Contains("CreatedByName"))
                    {
                        if (!DBNull.Value.Equals(dr["CreatedByName"]))
                        {
                            objDOADM_SkillsMaster.CreatedByName = dr["CreatedByName"].ToString();
                        }
                    }
                    if (dr.Table.Columns.Contains("RoleValue"))
                    {
                        if (!DBNull.Value.Equals(dr["RoleValue"]))
                        {
                            objDOADM_SkillsMaster.RoleValue = dr["RoleValue"].ToString();
                        }
                    }
                    if (dr.Table.Columns.Contains("BusinessSegmentValue"))
                    {
                        if (!DBNull.Value.Equals(dr["BusinessSegmentValue"]))
                        {
                            objDOADM_SkillsMaster.BusinessSegmentValue = dr["BusinessSegmentValue"].ToString();
                        }
                    }
                    if (dr.Table.Columns.Contains("WorkBasketValue"))
                    {
                        if (!DBNull.Value.Equals(dr["WorkBasketValue"]))
                        {
                            objDOADM_SkillsMaster.WorkBasketValue = dr["WorkBasketValue"].ToString();
                        }
                    }
                    if (dr.Table.Columns.Contains("DepartmentName"))
                    {
                        if (!DBNull.Value.Equals(dr["DepartmentName"]))
                        {
                            objDOADM_SkillsMaster.DepartmentName = dr["DepartmentName"].ToString();
                        }
                    }
                    if (dr.Table.Columns.Contains("LastUpdatedByName"))
                    {
                        if (!DBNull.Value.Equals(dr["LastUpdatedByName"]))
                        {
                            objDOADM_SkillsMaster.LastUpdatedByName = dr["LastUpdatedByName"].ToString();
                        }
                    }
                    if (dr.Table.Columns.Contains("LockedByRef"))
                    {
                        if (!DBNull.Value.Equals(dr["LockedByRef"]))
                        {
                            objDOADM_SkillsMaster.LockedByRef = Convert.ToInt64(dr["LockedByRef"].ToString());
                        }
                    }

                    if (dr.Table.Columns.Contains("LockedByName"))
                    {
                        if (!DBNull.Value.Equals(dr["LockedByName"]))
                        {
                            objDOADM_SkillsMaster.LockedByName = dr["LockedByName"].ToString();
                        }
                    }
                    if (dr.Table.Columns.Contains("UTCLockedOn"))
                    {
                        if (!DBNull.Value.Equals(dr["UTCLockedOn"]))
                        {
                            objDOADM_SkillsMaster.UTCLockedOn = ZoneLookupUI.ConvertToTimeZone(dr["UTCLockedOn"].ToDateTime(), TimeZone);
                        }
                    }

                    objDOADM_SkillsMaster.lstDOADM_SkillWorkQueuesCorrelation = new List <DOADM_SkillWorkQueuesCorrelation>();

                    if (objDataTable.Tables[1].Rows.Count > 0)
                    {
                        foreach (DataRow sklwrkQ in objDataTable.Tables[1].Rows)
                        {
                            DOADM_SkillWorkQueuesCorrelation objDOADM_SkillWorkQueuesCorrelation = new DOADM_SkillWorkQueuesCorrelation();
                            if (sklwrkQ.Table.Columns.Contains("ADM_SkillWorkQueuesCorrelationId"))
                            {
                                if (!DBNull.Value.Equals(sklwrkQ["ADM_SkillWorkQueuesCorrelationId"]))
                                {
                                    objDOADM_SkillWorkQueuesCorrelation.ADM_SkillWorkQueuesCorrelationId = (long)sklwrkQ["ADM_SkillWorkQueuesCorrelationId"];
                                }
                            }

                            if (sklwrkQ.Table.Columns.Contains("ADM_SkillsMasterRef"))
                            {
                                if (!DBNull.Value.Equals(sklwrkQ["ADM_SkillsMasterRef"]))
                                {
                                    objDOADM_SkillWorkQueuesCorrelation.ADM_SkillsMasterRef = (long)sklwrkQ["ADM_SkillsMasterRef"];
                                }
                            }

                            if (sklwrkQ.Table.Columns.Contains("WorkQueuesLkup"))
                            {
                                if (!DBNull.Value.Equals(sklwrkQ["WorkQueuesLkup"]))
                                {
                                    objDOADM_SkillWorkQueuesCorrelation.WorkQueuesLkup = (long)sklwrkQ["WorkQueuesLkup"];
                                }
                            }

                            if (sklwrkQ.Table.Columns.Contains("LastUpdatedByRef"))
                            {
                                if (!DBNull.Value.Equals(sklwrkQ["LastUpdatedByRef"]))
                                {
                                    objDOADM_SkillWorkQueuesCorrelation.LastUpdatedByRef = (long)sklwrkQ["LastUpdatedByRef"];
                                }
                            }

                            if (sklwrkQ.Table.Columns.Contains("LastUpdatedByName"))
                            {
                                if (!DBNull.Value.Equals(sklwrkQ["LastUpdatedByName"]))
                                {
                                    objDOADM_SkillWorkQueuesCorrelation.LastUpdatedByName = sklwrkQ["LastUpdatedByName"].ToString();
                                }
                            }

                            if (sklwrkQ.Table.Columns.Contains("CreatedByName"))
                            {
                                if (!DBNull.Value.Equals(sklwrkQ["CreatedByName"]))
                                {
                                    objDOADM_SkillWorkQueuesCorrelation.CreatedByName = sklwrkQ["CreatedByName"].ToString();
                                }
                            }

                            if (dr.Table.Columns.Contains("UTCCreatedOn"))
                            {
                                if (!DBNull.Value.Equals(dr["UTCCreatedOn"]))
                                {
                                    objDOADM_SkillWorkQueuesCorrelation.UTCCreatedOn = ZoneLookupUI.ConvertToTimeZone(sklwrkQ["UTCCreatedOn"].ToDateTime(), TimeZone);
                                }
                            }

                            if (dr.Table.Columns.Contains("UTCLastUpdatedOn"))
                            {
                                if (!DBNull.Value.Equals(dr["UTCLastUpdatedOn"]))
                                {
                                    objDOADM_SkillWorkQueuesCorrelation.UTCLastUpdatedOn = ZoneLookupUI.ConvertToTimeZone(sklwrkQ["UTCLastUpdatedOn"].ToDateTime(), TimeZone);
                                }
                            }

                            //if (sklwrkQ.Table.Columns.Contains("DiscrepancyCategoryLkup"))
                            //{
                            //    if (!DBNull.Value.Equals(sklwrkQ["DiscrepancyCategoryLkup"]))
                            //    {
                            //        objDOADM_SkillWorkQueuesCorrelation.DiscrepancyCategoryLkup = (long)sklwrkQ["DiscrepancyCategoryLkup"];
                            //    }
                            //}

                            if (sklwrkQ.Table.Columns.Contains("IsActive"))
                            {
                                if (!DBNull.Value.Equals(sklwrkQ["IsActive"]))
                                {
                                    objDOADM_SkillWorkQueuesCorrelation.IsActive = (bool)sklwrkQ["IsActive"];
                                }
                            }

                            objDOADM_SkillsMaster.lstDOADM_SkillWorkQueuesCorrelation.Add(objDOADM_SkillWorkQueuesCorrelation);
                        }
                    }
                    lstDOADM_SkillsDetails.Add(objDOADM_SkillsMaster);
                }
            }
            catch
            {
            }
        }
Esempio n. 2
0
        public ActionResult AddWorkQueuesToSession(DOADM_SkillWorkQueuesCorrelation objDOADM_SkillWorkQueuesCorrelation, long lDiscrepancyCatLkup = 0, long lPreviousWorkQueue = 0, int mode = 0)
        {
            long?TimeZone = currentUser.ADM_UserPreference.TimezoneLkup != null ? currentUser.ADM_UserPreference.TimezoneLkup : (long)DefaultTimeZone.CentralStandardTime;
            List <DOADM_SkillWorkQueuesCorrelation> lstDOADM_SkillWorkQueuesCorrelation = new List <DOADM_SkillWorkQueuesCorrelation>();

            try
            {
                if (Session[ConstantTexts.SkillWorkQueueSessionKey] != null)
                {
                    lstDOADM_SkillWorkQueuesCorrelation = Session[ConstantTexts.SkillWorkQueueSessionKey] as List <DOADM_SkillWorkQueuesCorrelation>;
                }
                switch (mode)
                {
                case 0:    //Add new WQ to the list
                    if (lstDOADM_SkillWorkQueuesCorrelation.Where(xx => xx.WorkQueuesLkup == objDOADM_SkillWorkQueuesCorrelation.WorkQueuesLkup).Count() == 0)
                    {
                        objDOADM_SkillWorkQueuesCorrelation.IsActive          = true;
                        objDOADM_SkillWorkQueuesCorrelation.CreatedByRef      = currentUser.ADM_UserMasterId;
                        objDOADM_SkillWorkQueuesCorrelation.CreatedByName     = currentUser.FullName;
                        objDOADM_SkillWorkQueuesCorrelation.UTCCreatedOn      = ZoneLookupUI.ConvertToTimeZone(DateTime.UtcNow, TimeZone);
                        objDOADM_SkillWorkQueuesCorrelation.LastUpdatedByRef  = currentUser.ADM_UserMasterId;
                        objDOADM_SkillWorkQueuesCorrelation.LastUpdatedByName = currentUser.FullName;
                        objDOADM_SkillWorkQueuesCorrelation.UTCLastUpdatedOn  = ZoneLookupUI.ConvertToTimeZone(DateTime.UtcNow, TimeZone);
                        lstDOADM_SkillWorkQueuesCorrelation.Add(objDOADM_SkillWorkQueuesCorrelation);
                    }
                    else
                    {
                        objDOADM_SkillWorkQueuesCorrelation                   = lstDOADM_SkillWorkQueuesCorrelation.Where(xx => xx.WorkQueuesLkup == objDOADM_SkillWorkQueuesCorrelation.WorkQueuesLkup).FirstOrDefault();
                        objDOADM_SkillWorkQueuesCorrelation.IsActive          = true;
                        objDOADM_SkillWorkQueuesCorrelation.LastUpdatedByRef  = currentUser.ADM_UserMasterId;
                        objDOADM_SkillWorkQueuesCorrelation.LastUpdatedByName = currentUser.FullName;
                        objDOADM_SkillWorkQueuesCorrelation.UTCLastUpdatedOn  = ZoneLookupUI.ConvertToTimeZone(DateTime.UtcNow, TimeZone);
                    }
                    break;

                case 1:    //delete work queue from added list
                    if (lstDOADM_SkillWorkQueuesCorrelation.Where(xx => xx.WorkQueuesLkup == objDOADM_SkillWorkQueuesCorrelation.WorkQueuesLkup).Count() > 0)
                    {
                        objDOADM_SkillWorkQueuesCorrelation = lstDOADM_SkillWorkQueuesCorrelation.Where(xx => xx.WorkQueuesLkup == objDOADM_SkillWorkQueuesCorrelation.WorkQueuesLkup).FirstOrDefault();
                        objDOADM_SkillWorkQueuesCorrelation.LastUpdatedByRef  = currentUser.ADM_UserMasterId;
                        objDOADM_SkillWorkQueuesCorrelation.LastUpdatedByName = currentUser.FullName;
                        objDOADM_SkillWorkQueuesCorrelation.UTCLastUpdatedOn  = ZoneLookupUI.ConvertToTimeZone(DateTime.UtcNow, TimeZone);
                        objDOADM_SkillWorkQueuesCorrelation.IsActive          = false;
                    }
                    break;

                case 2:    //update existing work Queue
                    long NewWorkQueuesLkup = objDOADM_SkillWorkQueuesCorrelation.WorkQueuesLkup;
                    objDOADM_SkillWorkQueuesCorrelation = lstDOADM_SkillWorkQueuesCorrelation.Where(x => x.WorkQueuesLkup == lPreviousWorkQueue).FirstOrDefault();
                    if (objDOADM_SkillWorkQueuesCorrelation.ADM_SkillsMasterRef == 0)   //updating a queue for new record
                    {
                        objDOADM_SkillWorkQueuesCorrelation.CreatedByName = currentUser.FullName;
                        objDOADM_SkillWorkQueuesCorrelation.CreatedByRef  = currentUser.ADM_UserMasterId;
                    }
                    objDOADM_SkillWorkQueuesCorrelation.LastUpdatedByName = currentUser.FullName;
                    objDOADM_SkillWorkQueuesCorrelation.LastUpdatedByRef  = currentUser.ADM_UserMasterId;
                    objDOADM_SkillWorkQueuesCorrelation.UTCLastUpdatedOn  = ZoneLookupUI.ConvertToTimeZone(DateTime.UtcNow, TimeZone);
                    objDOADM_SkillWorkQueuesCorrelation.IsActive          = true;
                    objDOADM_SkillWorkQueuesCorrelation.WorkQueuesLkup    = NewWorkQueuesLkup;
                    break;

                case 3:    //removing all queues from session
                    foreach (var item in lstDOADM_SkillWorkQueuesCorrelation)
                    {
                        item.LastUpdatedByName = currentUser.FullName;
                        item.LastUpdatedByRef  = currentUser.ADM_UserMasterId;
                        item.UTCLastUpdatedOn  = ZoneLookupUI.ConvertToTimeZone(DateTime.UtcNow, TimeZone);
                        item.IsActive          = false;
                    }
                    break;
                }

                List <DOCMN_LookupMasterCorrelations> lstDOCMN_LookupMaster = CacheUtility.GetAllLookupMasterCorrelationFromCache((long)LookupTypesCorrelation.DiscripancyCategoryVQueue, lDiscrepancyCatLkup);
                lstDOCMN_LookupMaster = lstDOCMN_LookupMaster.Where(x => x.CMN_LookupMasterParentRef == lDiscrepancyCatLkup).ToList();
                ViewBag.WorkQueues    = lstDOCMN_LookupMaster;

                Session[ConstantTexts.SkillWorkQueueSessionKey] = lstDOADM_SkillWorkQueuesCorrelation;
                return(PartialView("_WorkQueue", lstDOADM_SkillWorkQueuesCorrelation.Where(xx => xx.IsActive == true).ToList()));
            }
            catch (Exception ex)
            {
                BLCommon.LogError(currentUser.ADM_UserMasterId, MethodBase.GetCurrentMethod().Name, (long)ErrorModuleName.ManageSkills, (long)ExceptionTypes.Uncategorized, ex.ToString(), ex.ToString());
                return(RedirectToAction("Maintenance", "Error", routeValues: ex.ToString()));
            }
        }