コード例 #1
0
ファイル: Extensions.cs プロジェクト: gbariluncc/AuditLib
        public static void CopyFromDMS <T>(this IDMSObject <T> source, string sqlStatement) where T : class
        {
            ADODB.Recordset rs = DMSConnection.GetInstance().Recordset(sqlStatement);
            if (rs == null)
            {
                return;
            }
            if (rs.BOF && rs.EOF)
            {
                return;
            }

            PropertyInfo[] properties = typeof(T).GetProperties();

            for (int i = 0; i < rs.Fields.Count; i++)
            {
                foreach (PropertyInfo property in properties)
                {
                    if (property.Name == rs.Fields[i].Name)
                    {
                        object value = rs.Fields[i].Value;
                        if (value is DBNull)
                        {
                            value = -1;
                        }
                        property.SetValue(source, Convert.ChangeType(value, property.PropertyType));
                    }
                }
            }
        }
コード例 #2
0
ファイル: Extensions.cs プロジェクト: gbariluncc/AuditLib
        public static ICollection <T> GetDMSObjects <T>(this IDMSObject <T> source, string sqlstatement) where T : class, new()
        {
            ICollection <T> retVal = GetDataCollection <T>(sqlstatement, "", DMSConnection.GetInstance());

            // DMSConnection.GetInstance().Connection.Close();
            return(retVal);
        }
コード例 #3
0
        public void GetDMSInfo(long value)
        {
            ADODB.Recordset rs = DMSConnection.GetInstance().Recordset("SELECT * FROM [dbo.itemloc] WHERE [itm_num]=" + value.ToString());

            rs.Each(r =>
            {
                DCLocation temp      = new DCLocation(r.Fields["location"].Value.ToString());
                temp.QtyOH           = (int)r.Fields["qty_on_hand"].Value;
                temp.PickZone        = (short)r.Fields["pic_zone"].Value;
                temp.StorageFunction = (byte)r.Fields["stg_fnc_code"].Value;


                if (temp.LocationType == "Forward")
                {
                    _forward = temp;
                    _totOH  += _forward.QtyOH;
                }
                else
                {
                    if (temp.PickZone < 900)
                    {
                        _reserves.Add(temp);
                        _totOH += temp.QtyOH;
                    }
                }
            });
            rs.Close();
            rs = null;
        }
コード例 #4
0
ファイル: DMSItem.cs プロジェクト: gbariluncc/AuditLib
        private void GetOH(long value)
        {
            string sql = "SELECT fwd_on_hand, res_on_hand FROM dbo.item WHERE itm_num =" + value;

            ADODB.Recordset rs = DMSConnection.GetInstance().Recordset(sql);

            if (!(rs.BOF && rs.EOF))
            {
                _oh = (int)rs.Fields[0].Value + (int)rs.Fields[1].Value;
            }
            rs.Close();
            rs = null;
        }
コード例 #5
0
ファイル: POWithStatus.cs プロジェクト: gbariluncc/AuditLib
        public void RefreshStatus()
        {
            if (DMSConnection.GetInstance().Connection == null)
            {
                return;
            }

            POWithStatus temp = new POWithStatus(this);

            if (temp.LocationStatusCode != this.LocationStatusCode || temp.RcvQty != this.RcvQty)
            {
                this.Copy(temp);
            }
        }
コード例 #6
0
        private string GetDescription()
        {
            string sql = string.Empty;

            ADODB.Recordset rs;

            switch (ItemTypeID)
            {
            case 1:
                if (DMSConnection.GetInstance().Connection != null)
                {
                    sql = "SELECT itm_desc FROM dbo.item WHERE itm_num=" + Value;
                }
                else if (HostConnection.GetInstance().Connection != null)
                {
                    sql = "SELECT ITM_DES_TXT FROM Lowes.T024_ITM WHERE T024_ITM_NBR=" + Value;
                }
                break;

            case 2:
                if (DMSConnection.GetInstance().Connection != null)
                {
                    sql = "SELECT vnd_nme FROM dbo.e537a_rcv_hdr WHERE e058_po_nbr =" + Value;
                }
                else if (HostConnection.GetInstance().Connection != null)
                {
                    sql = "SELECT VND_NME FROM Lowes.W001_PO_DAL_HDR WHERE E058_PO_NBR=" + Value;
                }
                break;

            case 3:
                Facility fac = new Facility().Where("fac_num=" + Value).SingleOrDefault();
                return(fac == null ? string.Empty : fac.Name);

            case 4:
                string retVal = "Unknown vendor.";

                if (HostConnection.GetInstance().Connection != null)
                {
                    sql = "SELECT VBU_NME FROM LOWES.T616_VBU WHERE T616_VBU_NBR=" + Value + " AND T617_FNC_TYP_CD=1";
                    try
                    {
                        retVal = HostConnection.GetInstance().Recordset(sql).Fields[0].Value.ToString();
                    }
                    catch (Exception) { retVal = "Unknown Vendor."; }
                }
                return(retVal);

            default:
                return("Unknown.");
            }

            if (DMSConnection.GetInstance().Connection != null)
            {
                rs = DMSConnection.GetInstance().Recordset(sql);
            }
            else
            {
                rs = HostConnection.GetInstance().Recordset(sql);
            }

            string output;

            try
            {
                if (!(rs.BOF && rs.EOF))
                {
                    output = rs.Fields[0].Value.ToString();
                }
                else
                {
                    output = "Unknown.";
                }
            }
            catch (Exception) { output = "Unknown error occured."; }
            rs.Close();
            rs = null;
            //string output = "Not implimented yet.";
            return(output);
        }