Exemplo n.º 1
0
 public void addUnits()
 {
     using (var context = new CompanyDbContext())
     {
         Console.WriteLine("Add Business Units:");
         Console.Write("Enter UnitName:");
         unit.UnitName = Console.ReadLine();
         Console.Write("Enter CompanyId");
         unit.CompanyId = Convert.ToInt32(Console.ReadLine());
         Console.Write("Enter NumberOfProjects:");
         unit.NumberOfProjects = Convert.ToInt32(Console.ReadLine());
         Console.Write("Enter NumberOfEmployees:");
         unit.NumberOfEmployees = Convert.ToInt32(Console.ReadLine());
         BusinessUnits.Add(unit);
         SaveChanges();
     }
 }
Exemplo n.º 2
0
        protected void Initialise()
        {
            string groupID = settings.VariableKey1;

            TalentAccessDetailList = new List <TalentDataAccess>();
            try
            {
                TalentAccessDetailList = objAudit.GetCommandsByGroupId(int.Parse(groupID));
                DESQLParameter currBusinessUnit = null;
                foreach (TalentDataAccess sqlAccess in TalentAccessDetailList)
                {
                    currBusinessUnit = sqlAccess.CommandElements.CommandParameter.Find(x => x.ParamName.Contains(BUSINESS_UNIT));
                    if (!(currBusinessUnit == null))
                    {
                        HasBusinessUnit = true;
                    }
                }
                if (HasBusinessUnit)
                {
                    string[] items = TalentSystemDefaults.Utilities.GetBusinessUnits(settings);
                    foreach (string item in items)
                    {
                        bool selected = string.Compare(currBusinessUnit.ParamValue.ToString(), item, true) == 0;
                        BusinessUnits.Add(new SelectListItem {
                            Text = item, Value = item, Selected = selected
                        });
                    }
                }
                ConnectionStrings.Add(new SelectListItem {
                    Text = "TALENTEBUSINESS", Value = "SQL2005", Selected = true
                });
                ConnectionStrings.Add(new SelectListItem {
                    Text = "TALENT CONFIGURATION", Value = "TALENT_CONFIG", Selected = false
                });
                if (!string.IsNullOrEmpty(settings.SearchText))
                {
                    BackURL += "&searchText={1}";
                }
                BackURL        = string.Format(BackURL, settings.Module_Name, settings.SearchText);
                AuditGroupInfo = objAudit.RetrieveAuditGroupInfo(int.Parse(groupID));
            }
            catch (Exception)
            {
            }
        }
        /// <summary>
        /// Returns All Business Units in the table
        /// </summary>
        /// <param name="userId"></param>
        /// <returns>BusinessUnits</returns>
        public BusinessUnits FindAll(int userId)
        {
            MySqlCommand.CommandType = CommandType.StoredProcedure;
            MySqlCommand.CommandText = FindAllStoredProcedure;
            MySqlCommand.Parameters.AddWithValue("userid", userId);
            MySqlCommand.Parameters.Add(new MySqlParameter("@result", MySqlDbType.Int32));
            MySqlCommand.Parameters["@result"].Direction = ParameterDirection.Output;
            MySqlDataAdapter.SelectCommand = MySqlCommand;
            MySqlDataAdapter.Fill(BusinessUnitDataSet);

            //Now lets return buis
            var businessUnits = new BusinessUnits();
            DataTable dataTable = BusinessUnitDataSet.Tables[0]; // Only 1 table
            for (var i = 0; i < dataTable.Rows.Count; i++)
            {
                #region Add to list
                businessUnits.Add(new BusinessUnit
                {
                    BuId =
                    {
                        DataValue = Int32.Parse(dataTable.Rows[i][(int)BusinessUnitTableDefinition.BuId].ToString())
                    },
                    BuName =
                    {
                        DataValue = (dataTable.Rows[i][(int)BusinessUnitTableDefinition.BuName].ToString())
                    },
                    BuEmailAddress =
                    {
                        DataValue = (dataTable.Rows[i][(int)BusinessUnitTableDefinition.BuEmailAddress].ToString())
                    },
                    BuContactNum1 =
                    {
                        DataValue = (dataTable.Rows[i][(int)BusinessUnitTableDefinition.BuContactNum1].ToString())
                    },
                    BuContactNum2 =
                    {
                        DataValue = (dataTable.Rows[i][(int)BusinessUnitTableDefinition.BuContactNum2].ToString())
                    },
                    BuContactNum3 =
                    {
                        DataValue = (dataTable.Rows[i][(int)BusinessUnitTableDefinition.BuContactNum3].ToString())
                    },
                    BuAddress1 =
                    {
                        DataValue = (dataTable.Rows[i][(int)BusinessUnitTableDefinition.BuAddress1].ToString())
                    },
                    BuAddress2 =
                    {
                        DataValue = (dataTable.Rows[i][(int)BusinessUnitTableDefinition.BuAddress2].ToString())
                    },
                    BuAddress3 =
                    {
                        DataValue = (dataTable.Rows[i][(int)BusinessUnitTableDefinition.BuAddress3].ToString())
                    },
                    BuParish =
                    {
                        DataValue = (dataTable.Rows[i][(int)BusinessUnitTableDefinition.BuParish].ToString())
                    },
                    BuCountry =
                    {
                        DataValue = (dataTable.Rows[i][(int)BusinessUnitTableDefinition.BuCountry].ToString())
                    },
                    CreatedAt =
                    {
                        DataValue = DateTime.Parse(dataTable.Rows[i][(int)BusinessUnitTableDefinition.CreatedAt].ToString())
                    },
                    CreatedBy =
                    {
                        DataValue = Int32.Parse(dataTable.Rows[i][(int)BusinessUnitTableDefinition.CreatedBy].ToString())
                    },
                    UpdatedAt =
                    {
                        DataValue = DateTime.Parse(dataTable.Rows[i][(int)BusinessUnitTableDefinition.UpdatedAt].ToString())
                    },
                    UpdatedBy =
                    {
                        DataValue = Int32.Parse(dataTable.Rows[i][(int)BusinessUnitTableDefinition.UpdatedBy].ToString())
                    }
                });
                #endregion

            }
            return businessUnits;
        }
        public BusinessUnits FindAll(int userId)
        {
            BusinessUnits businessUnits = new BusinessUnits();

                businessUnits.Add(new BusinessUnit
                    {
                        BuId =
                            {
                                DataValue = 1

                            },
                        BuName =
                            {
                                DataValue = "Design Business Name"
                            },
                        BuEmailAddress =
                            {
                                DataValue = "*****@*****.**"

                            },
                        BuContactNum1 =
                            {
                                DataValue = "18764431234"
                            },
                        BuContactNum2 =
                            {
                                DataValue = "18764431234"
                            },
                        BuContactNum3 =
                            {
                                DataValue = "18764431234"

                            },
                        BuAddress1 =
                            {
                                DataValue = "13 Design Address Street"
                            },
                        BuAddress2 =
                            {
                                DataValue = "Design Town"
                            },
                        BuAddress3 =
                            {
                                DataValue = ""
                            },
                        BuParish =
                            {
                                DataValue = "Design Parish"
                            },
                        BuCountry =
                            {
                                DataValue = "JamRock"
                            },
                        CreatedAt =
                            {
                                DataValue = DateTime.Now
                            },
                        CreatedBy =
                            {
                                DataValue = 1

                            },
                        UpdatedAt =
                            {
                                DataValue = DateTime.Now
                            },
                        UpdatedBy =
                            {
                                DataValue = 1
                            }
                    });

            return businessUnits;
        }
        /// <summary>
        /// Returns All Business Units in the table
        /// </summary>
        /// <param name="userId"></param>
        /// <returns>BusinessUnits</returns>

        public BusinessUnits FindAll(int userId)
        {
            MySqlCommand.CommandType = CommandType.StoredProcedure;
            MySqlCommand.CommandText = FindAllStoredProcedure;
            MySqlCommand.Parameters.AddWithValue("userid", userId);
            MySqlCommand.Parameters.Add(new MySqlParameter("@result", MySqlDbType.Int32));
            MySqlCommand.Parameters["@result"].Direction = ParameterDirection.Output;
            MySqlDataAdapter.SelectCommand = MySqlCommand;
            MySqlDataAdapter.Fill(BusinessUnitDataSet);

            //Now lets return buis
            var       businessUnits = new BusinessUnits();
            DataTable dataTable     = BusinessUnitDataSet.Tables[0]; // Only 1 table

            for (var i = 0; i < dataTable.Rows.Count; i++)
            {
                #region Add to list
                businessUnits.Add(new BusinessUnit
                {
                    BuId =
                    {
                        DataValue = Int32.Parse(dataTable.Rows[i][(int)BusinessUnitTableDefinition.BuId].ToString())
                    },
                    BuName =
                    {
                        DataValue = (dataTable.Rows[i][(int)BusinessUnitTableDefinition.BuName].ToString())
                    },
                    BuEmailAddress =
                    {
                        DataValue = (dataTable.Rows[i][(int)BusinessUnitTableDefinition.BuEmailAddress].ToString())
                    },
                    BuContactNum1 =
                    {
                        DataValue = (dataTable.Rows[i][(int)BusinessUnitTableDefinition.BuContactNum1].ToString())
                    },
                    BuContactNum2 =
                    {
                        DataValue = (dataTable.Rows[i][(int)BusinessUnitTableDefinition.BuContactNum2].ToString())
                    },
                    BuContactNum3 =
                    {
                        DataValue = (dataTable.Rows[i][(int)BusinessUnitTableDefinition.BuContactNum3].ToString())
                    },
                    BuAddress1 =
                    {
                        DataValue = (dataTable.Rows[i][(int)BusinessUnitTableDefinition.BuAddress1].ToString())
                    },
                    BuAddress2 =
                    {
                        DataValue = (dataTable.Rows[i][(int)BusinessUnitTableDefinition.BuAddress2].ToString())
                    },
                    BuAddress3 =
                    {
                        DataValue = (dataTable.Rows[i][(int)BusinessUnitTableDefinition.BuAddress3].ToString())
                    },
                    BuParish =
                    {
                        DataValue = (dataTable.Rows[i][(int)BusinessUnitTableDefinition.BuParish].ToString())
                    },
                    BuCountry =
                    {
                        DataValue = (dataTable.Rows[i][(int)BusinessUnitTableDefinition.BuCountry].ToString())
                    },
                    CreatedAt =
                    {
                        DataValue = DateTime.Parse(dataTable.Rows[i][(int)BusinessUnitTableDefinition.CreatedAt].ToString())
                    },
                    CreatedBy =
                    {
                        DataValue = Int32.Parse(dataTable.Rows[i][(int)BusinessUnitTableDefinition.CreatedBy].ToString())
                    },
                    UpdatedAt =
                    {
                        DataValue = DateTime.Parse(dataTable.Rows[i][(int)BusinessUnitTableDefinition.UpdatedAt].ToString())
                    },
                    UpdatedBy =
                    {
                        DataValue = Int32.Parse(dataTable.Rows[i][(int)BusinessUnitTableDefinition.UpdatedBy].ToString())
                    }
                });
                #endregion
            }
            return(businessUnits);
        }
Exemplo n.º 6
0
        public BusinessUnits FindAll(int userId)
        {
            BusinessUnits businessUnits = new BusinessUnits();

            businessUnits.Add(new BusinessUnit
            {
                BuId =
                {
                    DataValue = 1
                },
                BuName =
                {
                    DataValue = "Design Business Name"
                },
                BuEmailAddress =
                {
                    DataValue = "*****@*****.**"
                },
                BuContactNum1 =
                {
                    DataValue = "18764431234"
                },
                BuContactNum2 =
                {
                    DataValue = "18764431234"
                },
                BuContactNum3 =
                {
                    DataValue = "18764431234"
                },
                BuAddress1 =
                {
                    DataValue = "13 Design Address Street"
                },
                BuAddress2 =
                {
                    DataValue = "Design Town"
                },
                BuAddress3 =
                {
                    DataValue = ""
                },
                BuParish =
                {
                    DataValue = "Design Parish"
                },
                BuCountry =
                {
                    DataValue = "JamRock"
                },
                CreatedAt =
                {
                    DataValue = DateTime.Now
                },
                CreatedBy =
                {
                    DataValue = 1
                },
                UpdatedAt =
                {
                    DataValue = DateTime.Now
                },
                UpdatedBy =
                {
                    DataValue = 1
                }
            });

            return(businessUnits);
        }