Пример #1
0
        public ApplicationUserCollection GetMasterUsers()
        {
            ApplicationUserCollection users = null;

            if (this.TryConnection())
            {
                DatabaseParameters parameters = new DatabaseParameters();
                base.CurSQLFactory.SelectCommand(parameters, this.CurDataStructure.Tables.MasterUsers.ActualTableName);
                DataTable table = base.CurDBEngine.SelectQuery(base.CurSQLFactory.SQL);
                if (table != null)
                {
                    users = new ApplicationUserCollection();
                    foreach (DataRow row in table.Rows)
                    {
                        ApplicationUser user = new ApplicationUser(row[this.CurDataStructure.Tables.MasterUsers.InternalID.ActualFieldName].ToString())
                        {
                            FirstName = row[this.CurDataStructure.Tables.MasterUsers.FirstName.ActualFieldName].ToString(),
                            UserID    = row[this.CurDataStructure.Tables.MasterUsers.UserID.ActualFieldName].ToString(),
                            LastName  = row[this.CurDataStructure.Tables.MasterUsers.LastName.ActualFieldName].ToString(),
                            Password  = row[this.CurDataStructure.Tables.MasterUsers.Password.ActualFieldName].ToString()
                        };
                        users.Add(user);
                    }
                    return(users);
                }
                base.error_occured = true;
                base.ErrMsg        = "[MasterUsers] : GetMasterUsers : " + base.CurDBEngine.ErrorMessage;
                return(users);
            }
            base.error_occured = true;
            base.ErrMsg        = "[MasterUsers] : GetMasterUsers : " + base.ErrMsg;
            return(users);
        }
Пример #2
0
    public string DownloadMasterUsersByJSON(DateTime dtCreated)
    {
        UploadManager CurUploadManager = new UploadManager();
        clsLog        oLog             = new clsLog();

        oLog.WriteToDebugLogFile("Starting Function", "DownloadMasterUsersByJSON");
        ApplicationUserCollection UserCollection = CurUploadManager.DownloadMasterUsersInColl(dtCreated);
        // DataTable objDataSet = CurUploadManager.DownloadMasterUsers(dtCreated);
        // Create a multidimensional jagged array
        // string[][] JaggedArray = new string[objDataSet.Rows.Count][];
        // int i = 0;
        // foreach (DataRow rs in objDataSet.Rows)
        //  {
        //JaggedArray[i] = new string[] { rs["user_id"].ToString(), rs["user_password"].ToString(), rs["user_firstname"].ToString() };
        // i = i + 1;
        //user.FirstName = ;
        // }

        // Return JSON data


        string json = JsonConvert.SerializeObject(UserCollection);

        return(json);
    }
Пример #3
0
 public LogMessageEnumerable(Session session, ThreadInfoCollection threads, ApplicationUserCollection users, List <GLFReader> availableReaders)
 {
     m_Session          = session;
     m_Threads          = threads;
     m_Users            = users;
     m_AvailableReaders = availableReaders;
 }
Пример #4
0
        public LogMessageEnumerator(Session session, ThreadInfoCollection threads, ApplicationUserCollection users, List <GLFReader> availableReaders)
        {
            m_Session          = session;
            m_AvailableReaders = availableReaders;
            m_UnloadedReaders  = new List <GLFReader>();
            m_Threads          = threads;
            m_Users            = users;

            Reset();
        }
    protected void Page_Load(object sender, EventArgs e)

    {
        this.CurSessionConfig = new SessionConfig(0, ConfigurationManager.AppSettings["swordfish_v1_ConnectionString"]);
        if (!base.IsPostBack)
        {
            string text = Convert.ToString((int)(DateTime.Now.Year - 1));
            string str2 = Convert.ToString(DateTime.Now.Year);
            string str3 = Convert.ToString((int)(DateTime.Now.Year + 1));
            this.ddl_year.Items.Add(new ListItem(text, text));
            this.ddl_year.Items.Add(new ListItem(str2, str2));
            this.ddl_year.Items.Add(new ListItem(str3, str3));
            this.ddl_plant.Items.Add(new ListItem("", ""));
            this.ddl_plant.Items.Add(new ListItem("320", "320"));
            this.ddl_plant.Items.Add(new ListItem("820", "820"));
            this.ddl_dchannel.Items.Add(new ListItem("", ""));
            this.ddl_dchannel.Items.Add(new ListItem("3I", "3I"));
            this.ddl_dchannel.Items.Add(new ListItem("3O", "3O"));
            this.ddl_dchannel.Items.Add(new ListItem("3S", "3S"));
            using (UserManager manager = new UserManager(this.CurSessionConfig))
            {
                this.ddl_engineer.Items.Add(new ListItem("[All Engineer]", "%"));
                ApplicationUserCollection masterUsers = manager.GetMasterUsers();
                if (masterUsers != null)
                {
                    masterUsers.SortByName();
                    foreach (ApplicationUser user in masterUsers)
                    {
                        this.ddl_engineer.Items.Add(new ListItem(user.FirstName + " (" + user.UserID + ")", user.UserID));
                    }
                }
            }
            using (EquipmentManager manager2 = new EquipmentManager(this.CurSessionConfig))
            {
                this.ddl_EquipmProfile.Items.Add(new ListItem("[All Equipm. Profile]", "%"));
                EquipmentCollection allEquipmentProfiles = manager2.GetAllEquipmentProfiles();
                if (allEquipmentProfiles != null)
                {
                    allEquipmentProfiles.SortByName();
                    foreach (EquipmentObj obj2 in allEquipmentProfiles)
                    {
                        if (obj2.EquipmentProfileID.Length > 0)
                        {
                            this.ddl_EquipmProfile.Items.Add(new ListItem(obj2.EquipmentProfileID, obj2.EquipmentProfileID));
                        }
                    }
                }
            }
        }
    }
 protected void ddl_dchannel_SelectedIndexChanged(object sender, EventArgs e)
 {
     this.ddl_engineer.Items.Clear();
     using (UserManager manager = new UserManager(this.CurSessionConfig))
     {
         ApplicationUserCollection masterUsers = manager.GetMasterUsers(this.ddl_dchannel.SelectedValue, this.ddl_plant.SelectedValue);
         if ((masterUsers != null) && (masterUsers.Count > 0))
         {
             foreach (ApplicationUser user in masterUsers)
             {
                 this.ddl_engineer.Items.Add(new ListItem(user.FirstName + " (" + user.UserID + ")", user.UserID));
             }
         }
     }
 }
Пример #7
0
 protected void ddl_dchannel_SelectedIndexChanged(object sender, EventArgs e)
 {
     using (UserManager manager = new UserManager(this.CurSessionConfig))
     {
         this.ddl_Employee.Items.Clear();
         this.ddl_Employee.Items.Add(new ListItem("[All Engineer]", "%"));
         ApplicationUserCollection masterUsers = manager.GetMasterUsers(this.ddl_dchannel.SelectedValue, this.ddl_plant.SelectedValue);
         if (masterUsers != null)
         {
             masterUsers.SortByName();
             foreach (ApplicationUser user in masterUsers)
             {
                 this.ddl_Employee.Items.Add(new ListItem(user.FirstName + " (" + user.UserID + ")", user.UserID));
             }
         }
     }
 }
Пример #8
0
        public ApplicationUserCollection GetMasterUsersInColl(DateTime dtCreated)
        {
            ApplicationUserCollection users = null;
            string str = dtCreated.Year.ToString() + "-" + dtCreated.Month.ToString() + "-" + dtCreated.Day.ToString() + " 00:00:00";

            if (this.TryConnection())
            {
                DatabaseParameters parameters = new DatabaseParameters();
                base.CurSQLFactory.SelectCommand(parameters, this.CurDataStructure.Tables.MasterUsers.ActualTableName);
                base.CurSQLFactory.SQL = base.CurSQLFactory.SQL + " WHERE dt_created >= CAST('" + str + "' AS DATETIME)";
                DataTable table = base.CurDBEngine.SelectQuery(base.CurSQLFactory.SQL);
                if (table != null)
                {
                    users = new ApplicationUserCollection();
                    foreach (DataRow row in table.Rows)
                    {
                        ApplicationUser user = new ApplicationUser(row[this.CurDataStructure.Tables.MasterUsers.InternalID.ActualFieldName].ToString())
                        {
                            FirstName           = row[this.CurDataStructure.Tables.MasterUsers.FirstName.ActualFieldName].ToString(),
                            UserID              = row[this.CurDataStructure.Tables.MasterUsers.UserID.ActualFieldName].ToString(),
                            LastName            = row[this.CurDataStructure.Tables.MasterUsers.LastName.ActualFieldName].ToString(),
                            Password            = row[this.CurDataStructure.Tables.MasterUsers.Password.ActualFieldName].ToString(),
                            DistributionChannel = row[this.CurDataStructure.Tables.MasterUsers.DistributionChannel.ActualFieldName].ToString(),
                            VehicleNumber       = row[this.CurDataStructure.Tables.MasterUsers.VehicleNumber.ActualFieldName].ToString(),
                            Plant = row[this.CurDataStructure.Tables.MasterUsers.Plant.ActualFieldName].ToString()
                        };
                        users.Add(user);
                    }
                    this.DisposeObjects();
                    return(users);
                }
                base.error_occured = true;
                base.ErrMsg        = "[MasterUsers] : GetMasterUsers : " + base.CurDBEngine.ErrorMessage;
                this.DisposeObjects();
                return(users);
            }
            base.error_occured = true;
            base.ErrMsg        = "[MasterUsers] : GetMasterUsers : " + base.ErrMsg;
            this.DisposeObjects();
            return(users);
        }
Пример #9
0
    protected void Page_Load(object sender, EventArgs e)
    {
        this.dbConnection = ConfigurationManager.AppSettings["swordfish_v1_ConnectionString"];

        this.CurSessionConfig = new SessionConfig(this.dbType, this.dbConnection);
        if (!base.IsPostBack)
        {
            int num = 0x7dc;
            for (int i = num; i <= (DateTime.Today.Year + 1); i++)
            {
                string text = i.ToString();
                this.ddl_year.Items.Add(new ListItem(text, i.ToString()));
                if (i == DateTime.Today.Year)
                {
                    this.ddl_year.SelectedIndex = this.ddl_year.Items.Count - 1;
                }
            }
            using (MasterManager manager = new MasterManager(this.CurSessionConfig))
            {
                //string[] plants = manager.GetPlants();
                this.ddl_plant.Items.Add(new ListItem("[All Plants]", ""));
                //foreach (string str in plants)
                //{
                //    this.ddl_plant.Items.Add(new ListItem(str, str));
                //}
                //string[] distChannel = manager.GetDistChannel();
                this.ddl_dchannel.Items.Add(new ListItem("[All Dist. Channel]", ""));
                //foreach (string str2 in distChannel)
                //{
                //    this.ddl_dchannel.Items.Add(new ListItem(str2, str2));
                //}
            }
            using (UserManager manager2 = new UserManager(this.CurSessionConfig))
            {
                this.ddl_Employee.Items.Add(new ListItem("[All Engineer]", "%"));
                ApplicationUserCollection masterUsers = manager2.GetMasterUsers();
                if (masterUsers != null)
                {
                    masterUsers.SortByName();
                    foreach (ApplicationUser user in masterUsers)
                    {
                        this.ddl_Employee.Items.Add(new ListItem(user.FirstName + " (" + user.UserID + ")", user.UserID));
                    }
                }
            }
            using (EquipmentManager manager3 = new EquipmentManager(this.CurSessionConfig))
            {
                this.ddl_EquipmProfile.Items.Add(new ListItem("[All Equipm. Profile]", "%"));
                EquipmentCollection allEquipmentProfiles = manager3.GetAllEquipmentProfiles();
                if (allEquipmentProfiles != null)
                {
                    allEquipmentProfiles.SortByName();
                    foreach (EquipmentObj obj2 in allEquipmentProfiles)
                    {
                        if (obj2.EquipmentProfileID.Length > 0)
                        {
                            this.ddl_EquipmProfile.Items.Add(new ListItem(obj2.EquipmentProfileID, obj2.EquipmentProfileID));
                        }
                    }
                }
            }
        }
    }
Пример #10
0
    public string DownloadMasterDataFromSQL(DateTime dtCreated, string employeeID)
    {
        string json = "";

        this.GeneralLogManager = new LogManager(tmp_config);
        try
        {
            UploadManager CurUploadManager = new UploadManager();

            MasterCauseCollection CausesCollection = CurUploadManager.DownloadMasterCauses(dtCreated);
            if (CausesCollection != null)
            {
                json += "MasterCauses " + JsonConvert.SerializeObject(CausesCollection);
            }

            MasterDamageCollection DamagesCollection = CurUploadManager.DownloadMasterDamages(dtCreated);
            if (DamagesCollection != null)
            {
                json += "MasterDamages" + JsonConvert.SerializeObject(DamagesCollection);
            }

            MasterCustomerCollection customerCollection = CurUploadManager.DownloadMasterCustomers(dtCreated);
            if (customerCollection != null)
            {
                json += "MasterCustomers" + JsonConvert.SerializeObject(customerCollection);
            }

            MasterEquipmentCollection equipmentCollection = CurUploadManager.DownloadMasterEquipment(dtCreated);
            if (equipmentCollection != null)
            {
                json += "MasterEquipment" + JsonConvert.SerializeObject(equipmentCollection);
            }

            MasterLookUpCollection lookUpCollection = CurUploadManager.DownloadMasterLookUp(dtCreated);
            if (lookUpCollection != null)
            {
                json += "MasterLookUp" + JsonConvert.SerializeObject(lookUpCollection);
            }

            ApplicationUserCollection UserCollection = CurUploadManager.DownloadMasterUsersInColl(dtCreated);
            if (UserCollection != null)
            {
                json += "MasterUsers" + JsonConvert.SerializeObject(UserCollection);
            }

            MasterQuickNotesCollection quickNotesCollection = CurUploadManager.DownloadQuickNotes();
            if (quickNotesCollection != null)
            {
                json += "MasterQuickNotes" + JsonConvert.SerializeObject(quickNotesCollection);
            }

            MasterCheckListTypeCollection masterCheckListTypeColleaction = CurUploadManager.DownloadMasterCheckListType();
            if (masterCheckListTypeColleaction != null)
            {
                json += "MasterCheckListType" + JsonConvert.SerializeObject(masterCheckListTypeColleaction);
            }

            MasterCheckListInCollection masterCheckListCollection = CurUploadManager.DownloadMasterCheckList();
            if (masterCheckListCollection != null)
            {
                json += "MasterCheckList" + JsonConvert.SerializeObject(masterCheckListCollection);
            }

            MasterCheckListRelationCollection checkListRelationCollection = CurUploadManager.DownloadMasterCheckListRelation();
            if (checkListRelationCollection != null)
            {
                json += "MasterCheckListRelation" + JsonConvert.SerializeObject(checkListRelationCollection);
            }

            if (json.Equals(""))
            {
                this.GeneralLogManager.LogAction("DownloadMasterDataFromSQL", employeeID, "Result :: null ");
            }
            else
            {
                this.GeneralLogManager.LogAction("DownloadMasterDataFromSQL", employeeID, "Result :: " + json);
            }
        }
        catch (Exception e)
        {
            string ErrorID = SwissArmy.UniqueID();
            this.CurLogManager.LogError(ErrorID, "DownloadMasterDataFromSQL: Error :: " + e.ToString(), employeeID);
            json = "Error: " + e.ToString();
        }

        return(json);
    }
Пример #11
0
    protected void PageComponentSetup()
    {
        int num = 0x7dc;

        for (int i = num; i <= (DateTime.Today.Year + 1); i++)
        {
            string text = i.ToString();
            this.ddl_year.Items.Add(new ListItem(text, i.ToString()));
            if (i == DateTime.Today.Year)
            {
                this.ddl_year.SelectedIndex = this.ddl_year.Items.Count - 1;
            }
        }
        for (int j = 1; j <= 12; j++)
        {
            string introduced26 = j.ToString();
            this.ddl_Month.Items.Add(new ListItem(introduced26, j.ToString()));
            if (j == DateTime.Today.Month)
            {
                this.ddl_Month.SelectedIndex = this.ddl_Month.Items.Count - 1;
            }
        }
        using (MasterManager manager = new MasterManager(this.CurSessionConfig))
        {
            //string[] plants = manager.GetPlants();
            this.ddl_plant.Items.Add(new ListItem("[All Plants]", ""));
            //foreach (string str in plants)
            //{
            //    this.ddl_plant.Items.Add(new ListItem(str, str));
            //}
            //string[] distChannel = manager.GetDistChannel();
            this.ddl_dchannel.Items.Add(new ListItem("[All Dist. Channel]", ""));
            //foreach (string str2 in distChannel)
            //{
            //    this.ddl_dchannel.Items.Add(new ListItem(str2, str2));
            //}
        }
        using (UserManager manager2 = new UserManager(this.CurSessionConfig))
        {
            ApplicationUserCollection masterUsers = manager2.GetMasterUsers();
            if ((masterUsers != null) && (masterUsers.Count > 0))
            {
                this.DropDownList_Engineer.Items.Add(new ListItem("[All Engineer]", "%"));
                foreach (ApplicationUser user in masterUsers)
                {
                    this.DropDownList_Engineer.Items.Add(new ListItem(user.FirstName + " (" + user.UserID + ")", user.UserID));
                }
            }
        }
        using (EquipmentManager manager3 = new EquipmentManager(this.CurSessionConfig))
        {
            this.ddl_EquipmProfile.Items.Add(new ListItem("[All Equipm. Profile]", "%"));
            EquipmentCollection allEquipmentProfiles = manager3.GetAllEquipmentProfiles();
            if (allEquipmentProfiles != null)
            {
                allEquipmentProfiles.SortByName();
                foreach (EquipmentObj obj2 in allEquipmentProfiles)
                {
                    if (obj2.EquipmentProfileID.Length > 0)
                    {
                        this.ddl_EquipmProfile.Items.Add(new ListItem(obj2.EquipmentProfileID, obj2.EquipmentProfileID));
                    }
                }
            }
        }
    }
Пример #12
0
 void PopulateDetails(ApplicationUserCollection appusers)
 {
     foreach(ApplicationUser appUser in appusers)
         this.PopulateDetails(appUser);
 }