public static List <EquipmentObject> GetAssignedMachine(int groupID)
        {
            try
            {
                string    query = "Select a.EquipID as ID, b.EquipID as EquipID from MachineGroupRelationTable a left join EquipmentTable b on a.EquipID=b.ID where a.GroupID=" + groupID.ToString() + " order by a.EquipID asc";
                DataTable dt    = new DataTable();
                dt = DBModel.CustomSelectQuery(query);
                List <EquipmentObject> obj = new List <EquipmentObject>();

                if (dt.Rows.Count > 0)
                {
                    foreach (DataRow dr in dt.Rows)
                    {
                        EquipmentObject temp = new EquipmentObject();
                        temp.ID      = Convert.ToInt32(dr["ID"].ToString());
                        temp.EquipID = dr["EquipID"].ToString();

                        obj.Add(temp);
                    }

                    return(obj);
                }
                else
                {
                    return(null);
                }
            }
            catch
            {
                return(null);
            }
        }
예제 #2
0
        public static void ValidateSECSGEMQty(string EquipID, int Multiplier)
        {
            string query  = "select EquipID from tblSECSGEM_Qty where EquipID='" + EquipID + "'";
            string query2 = "insert into tblSECSGEM_Qty(EquipID,Qty,Qty2,Multiplier) values ('" + EquipID + "',NULL,NULL," + Multiplier.ToString() + ")";

            try
            {
                DataTable dt = new DataTable();
                dt = DBModel.CustomSelectQuery(query);
                if (dt == null)
                {
                    DBModel.ExecuteCustomQuery(query2);
                }
                else
                {
                    if (dt.Rows.Count == 0)
                    {
                        DBModel.ExecuteCustomQuery(query2);
                    }
                    else
                    {
                        query2 = "Update tblSECSGEM_Qty set Multiplier=" + Multiplier.ToString() + " where EquipID='" + EquipID + "'";
                        DBModel.ExecuteCustomQuery(query2);
                    }
                }
            }
            catch { }
        }
예제 #3
0
        //function for getting module id and parent id
        public static ModuleObject getModule(string ModuleName)
        {
            ModuleObject obj = new ModuleObject();

            try
            {
                string    query = "Select Name, Id, ParentId from tblModules where Name='" + ModuleName + "'";
                DataTable dt    = new DataTable();
                dt = DBModel.CustomSelectQuery(query);
                foreach (DataRow dr in dt.Rows)
                {
                    obj.Id       = Convert.ToInt32(dr["Id"].ToString());
                    obj.ParentId = Convert.ToInt32(dr["ParentId"].ToString());
                    obj.Name     = dr["Name"].ToString();

                    string    query2 = "Select Name from tblModules where Id=" + obj.ParentId.ToString();
                    DataTable dt2    = new DataTable();
                    obj.ParentName = null;
                    dt2            = DBModel.CustomSelectQuery(query2);

                    foreach (DataRow dr2 in dt2.Rows)
                    {
                        obj.ParentName = dr2["Name"].ToString();
                    }
                }
            }
            catch
            {
                obj = null;
            }

            return(obj);
        }
예제 #4
0
        public static List <TCPAlarm> getAllAlarmsTCP(string equipment)
        {
            string          query = "Select EquipmentId,MessageId,MessageText,ReadNotification,MessageType,Date from TCPNotificationsTable where EquipmentId='" + equipment + "' order by Date desc";
            List <TCPAlarm> alarm = new List <TCPAlarm>();

            try
            {
                DataTable dt = new DataTable();
                dt = DBModel.CustomSelectQuery(query);
                foreach (DataRow dr in dt.Rows)
                {
                    TCPAlarm temp = new TCPAlarm();
                    temp.EquipmentId      = dr["EquipmentId"].ToString();
                    temp.MessageId        = dr["MessageId"].ToString();
                    temp.MessageText      = dr["MessageText"].ToString();
                    temp.ReadNotification = Convert.ToInt32(dr["ReadNotification"].ToString());
                    temp.MessageType      = dr["MessageType"].ToString();
                    temp.Date             = Convert.ToDateTime(dr["Date"]);
                    temp.DateStr          = Convert.ToDateTime(dr["Date"]).ToString();
                    alarm.Add(temp);
                }
                return(alarm);
            }
            catch
            {
                return(null);
            }
        }
예제 #5
0
        //function for getting ID of equipment
        public static int GetEquipmentID(string EquipmentName)
        {
            string query = "select ID from EquipmentTable where EquipID='" + EquipmentName + "'";

            DataTable dt = new DataTable();

            try
            {
                dt = DBModel.CustomSelectQuery(query);
                int ID = 0;

                if (dt != null)
                {
                    foreach (DataRow dr in dt.Rows)
                    {
                        ID = Convert.ToInt32(dr["ID"].ToString());
                    }
                }

                return(ID);
            }
            catch
            {
                return(0);
            }
        }
예제 #6
0
        public static bool hasChildGroup(string groupID)
        {
            bool result = false;

            try
            {
                string    query = "Select a.EquipID from MachineGroupRelationTable a left join EquipmentTable b on a.EquipID=b.ID left join tblEquipmentType c on b.EquipType=c.ID where c.IsEnabled=1 and a.GroupID=" + groupID.ToString();
                DataTable dt    = new DataTable();
                dt = DBModel.CustomSelectQuery(query);

                if (dt != null)
                {
                    if (dt.Rows.Count > 0)
                    {
                        result = true;
                    }
                    else
                    {
                        result = false;
                    }
                }
                else
                {
                    result = false;
                }
            }
            catch
            {
                result = false;
            }

            return(result);
        }
예제 #7
0
        public static bool validateWarningTracker(string equipment)
        {
            bool val = false;

            try
            {
                string    query = "Select EquipID from tblWarningTracker where EquipID='" + equipment + "'";
                DataTable dt    = new DataTable();
                dt = DBModel.CustomSelectQuery(query);

                if (dt != null)
                {
                    string query2 = "";
                    if (dt.Rows.Count == 0)
                    {
                        query2 = "Insert into tblWarningTracker(EquipID,Tier) values ('" + equipment + "',NULL)";
                        try
                        {
                            val = DBModel.ExecuteCustomQuery(query2);
                        }
                        catch
                        {
                            val = false;
                        }
                    }
                }
            }
            catch
            {
                val = false;
            }

            return(val);
        }
예제 #8
0
        public static List <EquipmentGroupObject> GetAllGroup()
        {
            try
            {
                string query = "Select ID,GroupName from tblEquipmentGroup order by GroupName";
                List <EquipmentGroupObject> obj = new List <EquipmentGroupObject>();
                DataTable dt = new DataTable();
                dt = DBModel.CustomSelectQuery(query);

                if (dt != null)
                {
                    if (dt.Rows.Count > 0)
                    {
                        foreach (DataRow dr in dt.Rows)
                        {
                            EquipmentGroupObject temp = new EquipmentGroupObject();
                            temp.ID        = Convert.ToInt32(dr["ID"].ToString());
                            temp.GroupName = dr["GroupName"].ToString();

                            obj.Add(temp);
                        }
                    }
                }

                return(obj);
            }
            catch
            {
                return(null);
            }
        }
예제 #9
0
        public static bool isProcessing(string equipment)
        {
            bool result = false;

            string    query = "Select Process from EquipmentTable where EquipID='" + equipment + "'";
            DataTable dt    = new DataTable();

            dt = DBModel.CustomSelectQuery(query);

            string proc = "";

            foreach (DataRow dr in dt.Rows)
            {
                proc = dr["Process"].ToString();
            }

            if (proc.ToUpper() == "1" || proc.ToUpper() == "TRUE")
            {
                result = true;
            }
            else
            {
                result = false;
            }

            return(result);
        }
        public static bool isMachineInGroup(int groupID, int equipID)
        {
            bool result = true;

            try
            {
                string    query = "Select ID from MachineGroupRelationTable where GroupID<>" + groupID.ToString() + " and EquipID=" + equipID.ToString();
                DataTable dt    = new DataTable();
                dt = DBModel.CustomSelectQuery(query);

                if (dt.Rows.Count > 0)
                {
                    result = true;
                }
                else
                {
                    result = false;
                }
            }
            catch
            {
                result = true;
            }

            return(result);
        }
예제 #11
0
        public static string EquipmentType(string EquipID)
        {
            string query = "select b.Type as 'Type' from EquipmentTable a left join tblEquipmentType b on a.EquipType=b.ID where a.EquipID='" + EquipID + "'";

            DataTable dt = new DataTable();

            try
            {
                dt = DBModel.CustomSelectQuery(query);
                string type = null;

                if (dt != null)
                {
                    foreach (DataRow dr in dt.Rows)
                    {
                        type = dr["Type"].ToString();
                    }
                }

                return(type);
            }
            catch
            {
                return(null);
            }
        }
        //for deleting equipment group from table
        public static bool DeleteMachineGroup(string id)
        {
            bool result = false;

            try
            {
                string query = "";

                query = "select a.ID from EquipmentTable a left join tblEquipmentGroup b on a.EquipID=b.GroupName where b.ID=" + id;
                DataTable dt_temp = new DataTable();
                dt_temp = DBModel.CustomSelectQuery(query);
                string tempID = "";
                if (dt_temp != null)
                {
                    if (dt_temp.Rows.Count > 0)
                    {
                        foreach (DataRow dr_temp in dt_temp.Rows)
                        {
                            tempID = dr_temp["ID"].ToString();
                        }

                        query  = "delete EquipmentTable where ID=" + tempID;
                        result = DBModel.ExecuteCustomQuery(query);

                        if (result == true)
                        {
                            query  = "delete tblEquipmentGroup where ID=" + id;
                            result = DBModel.ExecuteCustomQuery(query);

                            if (result == true)
                            {
                                result = DeleteMachineGroupRelation(id);

                                if (result == true)
                                {
                                    query  = "delete tblGroupEnrollment where GroupID=" + id;
                                    result = DBModel.ExecuteCustomQuery(query);

                                    if (result == true)
                                    {
                                        string[] computer_name = Dns.GetHostEntry(HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"]).HostName.Split(new Char[] { '.' });
                                        string   HostName      = computer_name[0].ToString().ToUpper();
                                        string   IP            = HttpHandler.GetIPAddress();
                                        AuditModel.AddLog("Group Settings", "Deleted Equipment Group - ID: " + id, HostName, IP, HttpContext.Current.Session["Username"].ToString());
                                    }
                                }
                            }
                        }
                    }
                }
            }
            catch
            {
                result = false;
            }

            return(result);
        }
예제 #13
0
        public static bool markAsBrand(string equipment, string isBranded)
        {
            string checkQuery = "select EquipmentID from EquipmentQty where EquipmentID='" + equipment + "'";

            DataTable dt = new DataTable();

            try
            {
                dt = DBModel.CustomSelectQuery(checkQuery);

                if (dt != null)
                {
                    if (dt.Rows.Count > 0)
                    {
                        string query  = "update EquipmentQty set isBranded=" + isBranded + " where EquipmentID='" + equipment + "'";
                        bool   result = false;

                        try
                        {
                            result = DBModel.ExecuteCustomQuery(query);
                        }
                        catch
                        {
                            result = false;
                        }

                        return(result);
                    }
                    else
                    {
                        string query = "Insert into EquipmentQty(EquipmentID,isBranded) values ('" + equipment + "'," + isBranded + ")";

                        bool result = false;

                        try
                        {
                            result = DBModel.ExecuteCustomQuery(query);
                        }
                        catch
                        {
                            result = false;
                        }

                        return(result);
                    }
                }
                else
                {
                    return(false);
                }
            }
            catch
            {
                return(false);
            }
        }
예제 #14
0
        public static bool UpdatePrintReelTable(string EquipID, int ReelQty, int CurrentQty, int CurrentReel, int TotalReel, int RemainingReel, int AllowedReel, int InReel)
        {
            bool result = false;

            string query = "Select EquipID from PrintTable where EquipID='" + EquipID + "'";

            DataTable dt = new DataTable();

            try
            {
                dt = DBModel.CustomSelectQuery(query);

                if (dt != null)
                {
                    if (dt.Rows.Count > 0)
                    {
                        result = true;
                    }
                    else
                    {
                        result = false;
                    }
                }
                else
                {
                    result = false;
                }
            }
            catch
            {
                result = false;
            }

            if (result == false)
            {
                query = "Insert into PrintTable(EquipID,ReelQty,CurrentReel,TotalReel,RemainingReel,CurrentQty,AllowedReel,InReel) values('" + EquipID + "'," + ReelQty.ToString() + "," + CurrentReel.ToString() + "," + TotalReel.ToString() + "," + RemainingReel.ToString() + "," + CurrentQty.ToString() + "," + AllowedReel.ToString() + "," + InReel.ToString() + ")";
            }
            else
            {
                query = "Update PrintTable set ReelQty=" + ReelQty.ToString() + "," + "CurrentQty=" + CurrentQty.ToString() + "," + "AllowedReel=" + AllowedReel.ToString() + "," + "InReel=" + InReel.ToString() + "," + "CurrentReel=" + CurrentReel.ToString() + "," + "TotalReel=" + TotalReel.ToString() + "," + "RemainingReel=" + RemainingReel.ToString() + " where EquipID='" + EquipID + "'";
            }

            bool output = false;

            try
            {
                output = DBModel.ExecuteCustomQuery(query);
            }
            catch
            {
                output = false;
            }

            return(output);
        }
        //for deleting equipment group relation from table
        public static bool DeleteMachineGroupRelation(string id)
        {
            bool result = false;

            try
            {
                List <string> lstEquipID = new List <string>();

                string query = "";
                query = "select EquipID from MachineGroupRelationTable where groupID=" + id;
                DataTable dt = new DataTable();
                dt = DBModel.CustomSelectQuery(query);

                if (dt != null)
                {
                    if (dt.Rows.Count > 0)
                    {
                        foreach (DataRow dr in dt.Rows)
                        {
                            lstEquipID.Add(dr["EquipID"].ToString());
                        }
                    }
                }

                query  = "delete MachineGroupRelationTable where groupID=" + id;
                result = DBModel.ExecuteCustomQuery(query);

                if (result == true)
                {
                    if (lstEquipID != null)
                    {
                        if (lstEquipID.Count > 0)
                        {
                            foreach (string temp in lstEquipID)
                            {
                                MarkEquipmentAsUngrouped(temp);
                            }
                        }
                    }

                    string[] computer_name = Dns.GetHostEntry(HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"]).HostName.Split(new Char[] { '.' });
                    string   HostName      = computer_name[0].ToString().ToUpper();
                    string   IP            = HttpHandler.GetIPAddress();
                    AuditModel.AddLog("Group Settings", "Updated Equipment Group Assignment - ID: " + id, HostName, IP, HttpContext.Current.Session["Username"].ToString());
                }
            }
            catch
            {
                result = false;
            }

            return(result);
        }
        //for inserting equipment group table
        public static bool AddMachineGroupRelation(int groupID, int equipID)
        {
            bool result = false;

            try
            {
                string query = "";
                query  = "insert into MachineGroupRelationTable(GroupID,EquipID) values(" + groupID.ToString() + "," + equipID.ToString() + ")";
                result = DBModel.ExecuteCustomQuery(query);

                if (result == true)
                {
                    query = "select isEnabled from tblEquipmentGroup where ID=" + groupID.ToString();
                    DataTable dt = new DataTable();
                    dt = DBModel.CustomSelectQuery(query);

                    bool isEnabled = false;

                    if (dt != null)
                    {
                        if (dt.Rows.Count > 0)
                        {
                            foreach (DataRow dr in dt.Rows)
                            {
                                isEnabled = Convert.ToBoolean(dr["isEnabled"]);
                            }
                        }
                    }

                    if (isEnabled == true)
                    {
                        result = MarkEquipmentAsGrouped(equipID.ToString());
                    }
                    else
                    {
                        result = MarkEquipmentAsUngrouped(equipID.ToString());
                    }

                    string[] computer_name = Dns.GetHostEntry(HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"]).HostName.Split(new Char[] { '.' });
                    string   HostName      = computer_name[0].ToString().ToUpper();
                    string   IP            = HttpHandler.GetIPAddress();
                    AuditModel.AddLog("Group Settings", "Updated Equipment Group Assignment - ID: " + groupID, HostName, IP, HttpContext.Current.Session["Username"].ToString());
                }
            }
            catch
            {
                result = false;
            }

            return(result);
        }
예제 #17
0
        //function for getting user access rights
        public static List <string> getUserRights(string username)
        {
            string query = "select a.username,b.UserModeDesc,d.Name,d.Id,d.ParentId from users a left join UserModeTable b on a.UserModeCode=b.UserModeCode left join tblPermissions c on b.UserModeCode=c.UserModeCode left join tblModules d on c.ModuleId=d.Id where d.IsActive=1 and a.UserName='******'";

            List <string> result = new List <string>();

            try
            {
                DataTable dt = new DataTable();
                dt = DBModel.CustomSelectQuery(query);

                foreach (DataRow dr in dt.Rows)
                {
                    if (Convert.ToInt32(dr["ParentId"].ToString()) == 0)
                    {
                        var count = getChildCount(Convert.ToInt32(dr["Id"].ToString()));
                        if (count == 0)
                        {
                            result.Add(dr["Name"].ToString());
                        }
                    }
                    else
                    {
                        var parentID = getParentID(Convert.ToInt32(dr["Id"].ToString()));
                        query = "Select IsActive from tblModules where Id=" + parentID;
                        DataTable dt_temp = new DataTable();
                        try
                        {
                            dt_temp = DBModel.CustomSelectQuery(query);
                            foreach (DataRow dr2 in dt_temp.Rows)
                            {
                                var isActive = Convert.ToBoolean(dr2["IsActive"]);
                                if (isActive == true)
                                {
                                    result.Add(dr["Name"].ToString());
                                }
                            }
                        }
                        catch
                        { }
                    }
                }
            }
            catch
            {
                result = null;
            }

            return(result);
        }
예제 #18
0
        public static int getSECSGEMProcessedQTY(string equipment)
        {
            int qty        = 0;
            int qty2       = 0;
            int multiplier = 1;

            try
            {
                string    query = "Select Qty,Qty2,Multiplier from tblSECSGEM_Qty where EquipID='" + equipment + "'";
                DataTable dt    = new DataTable();
                dt = DBModel.CustomSelectQuery(query);

                foreach (DataRow dr in dt.Rows)
                {
                    try
                    {
                        qty = Convert.ToInt32(dr["Qty"].ToString());
                    }
                    catch
                    {
                        qty = 0;
                    }

                    try
                    {
                        qty2 = Convert.ToInt32(dr["Qty2"].ToString());
                    }
                    catch
                    {
                        qty2 = 0;
                    }

                    try
                    {
                        multiplier = Convert.ToInt32(dr["Multiplier"].ToString());
                    }
                    catch
                    {
                        multiplier = 1;
                    }
                }
            }
            catch { }

            int total = (qty + qty2) * multiplier;

            return(total);
        }
예제 #19
0
        //function for getting user profile
        public static DataTable GetUserProfile(string username)
        {
            string    query = "Select a.Username,b.UserModeDesc,a.Password,a.Email,a.FirstName,a.LastName,a.MiddleName from Users a left join UserModeTable b on a.UserModeCode=b.UserModeCode where a.Username='******'";
            DataTable dt    = new DataTable();

            try
            {
                dt = DBModel.CustomSelectQuery(query);
            }
            catch
            {
                dt = null;
            }

            return(dt);
        }
예제 #20
0
        //function for getting equipment by type
        public static DataTable GetEquipmentByType(string typeCode)
        {
            string query = "select ID from EquipmentTable where EquipType=" + typeCode.ToString();

            DataTable dt = new DataTable();

            try
            {
                dt = DBModel.CustomSelectQuery(query);
            }
            catch
            {
                dt = null;
            }

            return(dt);
        }
예제 #21
0
        public static ReelObject SelectReel(string EquipID)
        {
            string query = "Select ReelQty,CurrentQty,CurrentReel,TotalReel,RemainingReel,AllowedReel,InReel from PrintTable where EquipID='" + EquipID + "'";

            ReelObject obj = new ReelObject();

            DataTable dt = new DataTable();

            try
            {
                dt = DBModel.CustomSelectQuery(query);

                if (dt != null)
                {
                    if (dt.Rows.Count > 0)
                    {
                        foreach (DataRow dr in dt.Rows)
                        {
                            obj.EquipID       = EquipID;
                            obj.ReelQty       = Convert.ToInt32(dr["ReelQty"].ToString());
                            obj.CurrentQty    = Convert.ToInt32(dr["CurrentQty"].ToString());
                            obj.CurrentReel   = Convert.ToInt32(dr["CurrentReel"].ToString());
                            obj.TotalReel     = Convert.ToInt32(dr["TotalReel"].ToString());
                            obj.RemainingReel = Convert.ToInt32(dr["RemainingReel"].ToString());
                            obj.AllowedReel   = Convert.ToInt32(dr["AllowedReel"].ToString());
                            obj.InReel        = Convert.ToInt32(dr["InReel"].ToString());
                        }
                    }
                    else
                    {
                        obj = null;
                    }
                }
                else
                {
                    obj = null;
                }
            }
            catch
            {
                obj = null;
            }

            return(obj);
        }
예제 #22
0
        public static List <string> GetGroupIDConnection()
        {
            bool isHost = SettingModels.isHostEnabled();

            string query = "";

            string IP = HttpHandler.GetIPAddress();

            string[] computer_name = Dns.GetHostEntry(HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"]).HostName.Split(new Char[] { '.' });
            string   HostName      = computer_name[0].ToString().ToUpper();

            if (isHost == true)
            {
                query = "Select a.GroupID,b.GroupName from tblGroupEnrollment a left join tblEquipmentGroup b on a.GroupID=b.ID where a.UserID='" + HttpContext.Current.Session["Username"].ToString() + "' and (a.HostID='" + HostName + "' or a.HostID='" + IP + "') and b.isEnabled=1";
            }
            else
            {
                query = "Select a.GroupID,b.GroupName from tblGroupEnrollment a left join tblEquipmentGroup b on a.GroupID=b.ID where a.UserID='" + HttpContext.Current.Session["Username"].ToString() + "' and b.isEnabled=1";
            }

            DataTable dt = new DataTable();

            dt = DBModel.CustomSelectQuery(query);

            List <string> result = new List <string>();

            foreach (DataRow dr in dt.Rows)
            {
                string Name = dr["GroupName"].ToString();
                query = "Select ID,EquipID from EquipmentTable where EquipID='" + Name + "'";
                DataTable dt2 = new DataTable();
                dt2 = DBModel.CustomSelectQuery(query);
                foreach (DataRow dr2 in dt2.Rows)
                {
                    string ID      = "";
                    string EquipID = "";
                    ID      = dr2["ID"].ToString();
                    EquipID = dr2["EquipID"].ToString();
                    string temp = ID + ":" + EquipID;
                    result.Add(temp);
                }
            }

            return(result);
        }
예제 #23
0
        public static List <EnrolledEquipment> GetChildEquipment(string groupID, string userID)
        {
            try
            {
                string query = "Select a.ID as 'ID', a.EquipID as 'Equipment', a.EquipType as 'TypeCode', c.Type as 'Type', c.IsSECSGEM as 'IsSECSGEM', a.EquipPort as 'Port', d.HostID as 'HostID' from EquipmentTable a left join MachineGroupRelationTable b on a.ID=b.EquipID left join tblEquipmentType c on a.EquipType=c.ID left join tblGroupEnrollment d on b.GroupID=d.GroupID where b.GroupID=" + groupID.ToString() + " and d.UserID='" + userID + "' order by a.EquipID asc";
                List <EnrolledEquipment> obj = new List <EnrolledEquipment>();

                DataTable dt = new DataTable();
                dt = DBModel.CustomSelectQuery(query);

                if (dt != null)
                {
                    if (dt.Rows.Count > 0)
                    {
                        foreach (DataRow dr in dt.Rows)
                        {
                            EnrolledEquipment temp = new EnrolledEquipment();
                            temp.ID        = Convert.ToInt32(dr["ID"].ToString());
                            temp.Equipment = dr["Equipment"].ToString();
                            temp.TypeCode  = Convert.ToInt32(dr["TypeCode"].ToString());
                            temp.Type      = dr["Type"].ToString();
                            temp.isSECSGEM = Convert.ToBoolean(dr["isSECSGEM"]);
                            temp.Port      = dr["Port"].ToString();
                            temp.HostID    = dr["HostID"].ToString();

                            obj.Add(temp);
                        }

                        return(obj);
                    }
                    else
                    {
                        return(null);
                    }
                }
                else
                {
                    return(null);
                }
            }
            catch
            {
                return(null);
            }
        }
예제 #24
0
        public static string getParentEquipment(string equipment)
        {
            string result = "";

            string query = "select c.GroupName as 'GroupName' from EquipmentTable a left join MachineGroupRelationTable b on a.ID=b.EquipID left join tblEquipmentGroup c on b.GroupID=c.ID where a.EquipID='" + equipment + "'";

            try
            {
                DataTable dt = new DataTable();
                dt = DBModel.CustomSelectQuery(query);
                if (dt != null)
                {
                    if (dt.Rows.Count > 0)
                    {
                        foreach (DataRow dr in dt.Rows)
                        {
                            try
                            {
                                result = dr["GroupName"].ToString();
                            }
                            catch
                            {
                                result = "";
                            }
                        }
                    }
                    else
                    {
                        result = "";
                    }
                }
                else
                {
                    result = "";
                }
            }
            catch
            {
                result = "";
            }

            return(result);
        }
예제 #25
0
        public static bool IsChildEquipment(string equipment)
        {
            bool result = false;

            string query = "select IsGrouped from EquipmentTable where EquipID='" + equipment + "'";

            try
            {
                DataTable dt = new DataTable();
                dt = DBModel.CustomSelectQuery(query);
                if (dt != null)
                {
                    if (dt.Rows.Count > 0)
                    {
                        foreach (DataRow dr in dt.Rows)
                        {
                            try
                            {
                                result = Convert.ToBoolean(dr["IsGrouped"].ToString());
                            }
                            catch
                            {
                                result = false;
                            }
                        }
                    }
                    else
                    {
                        result = false;
                    }
                }
                else
                {
                    result = false;
                }
            }
            catch
            {
                result = false;
            }

            return(result);
        }
예제 #26
0
        public static string getLotInProcess(string equipment)
        {
            string LotNo = null;

            try
            {
                string    query = "Select LotInProcess from EquipmentTable where EquipID='" + equipment + "'";
                DataTable dt    = new DataTable();
                dt = DBModel.CustomSelectQuery(query);
                foreach (DataRow dr in dt.Rows)
                {
                    LotNo = dr["LotInProcess"].ToString();
                }

                return(LotNo);
            }
            catch
            {
                return(null);
            }
        }
예제 #27
0
        //get the port of the equipment
        public static string GetPort(string Equipment)
        {
            string port = "";

            try
            {
                DataTable dt    = new DataTable();
                string    query = "Select EquipPort from EquipmentTable where EquipID='" + Equipment + "'";
                dt = DBModel.CustomSelectQuery(query);
                foreach (DataRow dr in dt.Rows)
                {
                    port = dr["EquipPort"].ToString();
                }
            }
            catch
            {
                port = "";
            }

            return(port);
        }
예제 #28
0
        public static int getNewAlarmCountTCP(string equipment)
        {
            int count = 0;

            try
            {
                string    query = "Select EquipmentId,MessageId,MessageText,ReadNotification,MessageType,Date from TCPNotificationsTable where EquipmentId='" + equipment + "' and ReadNotification=0";
                DataTable dt    = new DataTable();
                dt = DBModel.CustomSelectQuery(query);

                if (dt != null)
                {
                    count = dt.Rows.Count;
                }
            }
            catch
            {
                count = 0;
            }

            return(count);
        }
예제 #29
0
        public static string getTrackInUser(string equipment)
        {
            string user = "";

            try
            {
                string    query = "Select UserInProcess from EquipmentTable where EquipID='" + equipment + "'";
                DataTable dt    = new DataTable();
                dt = DBModel.CustomSelectQuery(query);

                foreach (DataRow dr in dt.Rows)
                {
                    user = dr["UserInProcess"].ToString();
                }
            }
            catch
            {
                user = "";
            }

            return(user);
        }
예제 #30
0
        public static int getUnbrandedQty(string equipment)
        {
            int qty = 0;

            try
            {
                string    query = "Select UnbrandedQty from EquipmentQty where EquipmentID='" + equipment + "'";
                DataTable dt    = new DataTable();
                dt = DBModel.CustomSelectQuery(query);

                foreach (DataRow dr in dt.Rows)
                {
                    qty = Convert.ToInt32(dr["UnbrandedQty"].ToString());
                }
            }
            catch
            {
                qty = 0;
            }

            return(qty);
        }