コード例 #1
0
        public Int64 InsertUpdateKitDetails(bool bIsSaveKit_Asset = true)
        {
            Int64              nKitID       = 0;
            DatabaseAccess     oDBAccess    = null;
            DatabaseParameters oDBParameter = null;
            Object             objValue     = null;
            Object             objStatus    = null;

            try
            {
                oDBAccess    = new DatabaseAccess();
                oDBParameter = new DatabaseParameters();
                oDBParameter.clear();
                oDBParameter.Add("@nKitID", this.nKitID, ParameterDirection.InputOutput, SqlDbType.BigInt);
                oDBParameter.Add("@sKitName", this.sKitName, ParameterDirection.Input, SqlDbType.VarChar);
                oDBParameter.Add("@sKitCode", this.sKitCode, ParameterDirection.Input, SqlDbType.VarChar);
                oDBParameter.Add("@sKitAbbrivation", this.sKitAbbrivation, ParameterDirection.Input, SqlDbType.VarChar);
                oDBParameter.Add("@sKitDescription", this.sKitDescription, ParameterDirection.Input, SqlDbType.VarChar);
                oDBParameter.Add("@kitBarcode", this.kitBarcode, ParameterDirection.Input, SqlDbType.Image);

                oDBAccess.OpenConnection(true);
                oDBAccess.Execute("lgsp_INUP_KitMaster", oDBParameter, out objValue);

                if (objValue != null)
                {
                    nKitID = Convert.ToInt64(objValue);
                }
                if (nKitID == 0)
                {
                    oDBAccess.RollBack();
                    oDBAccess.CloseConnection(true);
                    return(nKitID);
                }
                if (nKitID != 0 && bIsSaveKit_Asset)
                {
                    foreach (KitAsset item in lstKitDetails)
                    {
                        oDBParameter.clear();
                        oDBParameter.Add("@nKitID", nKitID, ParameterDirection.Input, SqlDbType.BigInt);
                        oDBParameter.Add("@nKitAssetID", item.nKitAssetID, ParameterDirection.Input, SqlDbType.BigInt);
                        oDBParameter.Add("@nAssetCodeID", item.nAssetCodeID, ParameterDirection.Input, SqlDbType.BigInt);
                        oDBParameter.Add("@nAssetID", item.nAssetID, ParameterDirection.Input, SqlDbType.BigInt);
                        oDBParameter.Add("@nStatus", 0, ParameterDirection.InputOutput, SqlDbType.Int);

                        oDBAccess.Execute("lgsp_INUP_KitAssetAssociation", oDBParameter, out objStatus);
                        int nStatus = 0;
                        if (objValue != null)
                        {
                            nStatus = Convert.ToInt32(objStatus);
                        }
                        if (nStatus <= 0)
                        {
                            oDBAccess.RollBack();
                            oDBAccess.CloseConnection(true);
                            return(nStatus);
                        }
                        if (nStatus == 2)
                        {
                            oDBAccess.RollBack();
                            oDBAccess.CloseConnection(true);
                            return(nStatus);
                        }
                    }
                }
                oDBAccess.Commit();
            }
            catch (Exception ex)
            {
                oDBAccess.RollBack();
                oDBAccess.CloseConnection(true);
                MessageBox.Show("Error: " + ex.ToString(), clsGlobal.MessageboxCaption, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
                if (oDBAccess != null)
                {
                    oDBAccess.Dispose();
                    oDBAccess = null;
                }
                if (oDBParameter != null)
                {
                    oDBParameter.Dispose();
                    oDBParameter = null;
                }
            }
            return(nKitID);
        }
コード例 #2
0
        public Int64 UpdateAssetCode()
        {
            Int64 nStatus = 0;

            DatabaseAccess     oDBAccess    = null;
            DatabaseParameters oDBParameter = null;
            Object             objStatus    = null;

            try
            {
                oDBAccess    = new DatabaseAccess();
                oDBParameter = new DatabaseParameters();

                oDBParameter.clear();
                oDBParameter.Add("@nAssetID", this.nAssetID, ParameterDirection.Input, SqlDbType.BigInt);
                oDBParameter.Add("@nAssetCodeID", this.nAssetCodeID, ParameterDirection.Input, SqlDbType.BigInt);
                oDBParameter.Add("@sInitialCode", this.sInitialCode, ParameterDirection.Input, SqlDbType.VarChar);
                oDBParameter.Add("@nSequenceNo", this.nSequenceNo, ParameterDirection.Input, SqlDbType.BigInt);
                oDBParameter.Add("@sUniqueCode", this.sUniqueCode, ParameterDirection.Input, SqlDbType.VarChar);
                oDBParameter.Add("@barcode", this.barcode, ParameterDirection.Input, SqlDbType.Image);
                oDBParameter.Add("@dtShelfLife", this.dtShelfLife, ParameterDirection.Input, SqlDbType.DateTime);
                oDBParameter.Add("@sShelfLifeUnit", this.sShelfLifeUnit, ParameterDirection.Input, SqlDbType.VarChar);
                oDBParameter.Add("@dtRetirementDate", this.dtRetirementDate, ParameterDirection.Input, SqlDbType.DateTime);
                oDBParameter.Add("@nStatus", 0, ParameterDirection.InputOutput, SqlDbType.Int);
                oDBAccess.OpenConnection(false);
                oDBAccess.Execute("lgsp_INUP_AssetCode", oDBParameter, out objStatus);
                oDBAccess.CloseConnection(false);
                if (objStatus != null)
                {
                    nStatus = Convert.ToInt32(objStatus);
                }
                if (nStatus <= 0)
                {
                    oDBAccess.RollBack();
                    oDBAccess.CloseConnection(true);
                    return(nStatus);
                }
                if (nStatus == 2)
                {
                    oDBAccess.RollBack();
                    oDBAccess.CloseConnection(true);
                    return(nStatus);
                }
                oDBAccess.Commit();
                //oDBAccess.CloseConnection(true);
            }
            catch (Exception ex)
            {
                oDBAccess.RollBack();
                MessageBox.Show("Error: " + ex.ToString(), clsGlobal._sMessageboxCaption, MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            finally
            {
                if (oDBAccess != null)
                {
                    oDBAccess.Dispose();
                    oDBAccess = null;
                }
                if (oDBParameter != null)
                {
                    oDBParameter.Dispose();
                    oDBParameter = null;
                }
            }

            return(nStatus);
        }
コード例 #3
0
        public Int64 UpdateAssetCode()
        {
            Int64 nStatus = 0;

            DatabaseAccess     oDBAccess    = null;
            DatabaseParameters oDBParameter = null;
            Object             objStatus    = null;

            try
            {
                oDBAccess    = new DatabaseAccess();
                oDBParameter = new DatabaseParameters();

                oDBParameter.clear();
                oDBParameter.Add("@nKitID", this.nKitID, ParameterDirection.Input, SqlDbType.BigInt);
                oDBParameter.Add("@nKitAssetID", this.nKitAssetID, ParameterDirection.Input, SqlDbType.BigInt);
                oDBParameter.Add("@nAssetID", this.nAssetID, ParameterDirection.Input, SqlDbType.BigInt);
                oDBParameter.Add("@nAssetCodeID", this.nAssetCodeID, ParameterDirection.Input, SqlDbType.BigInt);
                oDBParameter.Add("@nStatus", 0, ParameterDirection.InputOutput, SqlDbType.Int);
                oDBAccess.OpenConnection(false);
                oDBAccess.Execute("lgsp_INUP_KitAssetAssociation", oDBParameter, out objStatus);
                oDBAccess.CloseConnection(false);
                if (objStatus != null)
                {
                    nStatus = Convert.ToInt32(objStatus);
                }
                if (nStatus <= 0)
                {
                    oDBAccess.RollBack();
                    oDBAccess.CloseConnection(true);
                    return(nStatus);
                }
                if (nStatus == 2)
                {
                    oDBAccess.RollBack();
                    oDBAccess.CloseConnection(true);
                    return(nStatus);
                }
                oDBAccess.Commit();
                oDBAccess.CloseConnection(true);
            }
            catch (Exception ex)
            {
                oDBAccess.RollBack();
                oDBAccess.CloseConnection(true);
                MessageBox.Show("Error: " + ex.ToString(), clsGlobal.MessageboxCaption, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
                if (oDBAccess != null)
                {
                    oDBAccess.Dispose();
                    oDBAccess = null;
                }
                if (oDBParameter != null)
                {
                    oDBParameter.Dispose();
                    oDBParameter = null;
                }
            }
            return(nStatus);
        }
コード例 #4
0
        public Int64 InsertUpdateAsset(bool bIsSaveAsset_Code = true)
        {
            Int64              nAssetID     = 0;
            DatabaseAccess     oDBAccess    = null;
            DatabaseParameters oDBParameter = null;
            Object             objValue     = null;
            Object             objStatus    = null;

            try
            {
                oDBAccess    = new DatabaseAccess();
                oDBParameter = new DatabaseParameters();
                oDBParameter.clear();
                oDBParameter.Add("@nAssetID", this.nAssetID, ParameterDirection.InputOutput, SqlDbType.BigInt);
                oDBParameter.Add("@nCompanyID", this.nCompanyID, ParameterDirection.Input, SqlDbType.BigInt);
                oDBParameter.Add("@nAssetMainTypeID", this.nAssetMainTypeID, ParameterDirection.Input, SqlDbType.BigInt);
                oDBParameter.Add("@nAssetTypeID", this.nAssetTypeID, ParameterDirection.Input, SqlDbType.BigInt);
                oDBParameter.Add("@nAssetTypeOneID", this.nAssetTypeOneID, ParameterDirection.Input, SqlDbType.BigInt);
                oDBParameter.Add("@nAssetMaterialID", this.nAssetMaterialID, ParameterDirection.Input, SqlDbType.BigInt);
                oDBParameter.Add("@nAssetVendorID", this.nAssetVendorID, ParameterDirection.Input, SqlDbType.BigInt);
                oDBParameter.Add("@nDensityID", this.nDensityID, ParameterDirection.Input, SqlDbType.BigInt);
                oDBParameter.Add("@nColorID", this.nColorID, ParameterDirection.Input, SqlDbType.BigInt);
                oDBParameter.Add("@sHSNCode", this.sHSNCode, ParameterDirection.Input, SqlDbType.VarChar);
                oDBParameter.Add("@sAssetName", this.sAssetName, ParameterDirection.Input, SqlDbType.VarChar);
                oDBParameter.Add("@sAssetAbbrivation", this.sAssetAbbrivation, ParameterDirection.Input, SqlDbType.VarChar);
                oDBParameter.Add("@sDescription", this.sAssetDescription, ParameterDirection.Input, SqlDbType.VarChar);
                oDBParameter.Add("@dtIntroductionDate", this.dtIntroductionDate, ParameterDirection.Input, SqlDbType.DateTime);
                oDBParameter.Add("@dtReorderDate", this.dtReorderDate, ParameterDirection.Input, SqlDbType.DateTime);
                oDBParameter.Add("@sReorderDays", this.sReorderDays, ParameterDirection.Input, SqlDbType.VarChar);
                oDBParameter.Add("@sReorderQuntity", this.sReorderQuntity, ParameterDirection.Input, SqlDbType.VarChar);
                oDBParameter.Add("@sRate", this.sAssetRate, ParameterDirection.Input, SqlDbType.VarChar);
                oDBParameter.Add("@sMake", this.sAssetMake, ParameterDirection.Input, SqlDbType.VarChar);
                oDBParameter.Add("@sSizeOrCapacity", this.sAssetSizeOrCapacity, ParameterDirection.Input, SqlDbType.VarChar);
                oDBParameter.Add("@sQuality", this.sAssetQuality, ParameterDirection.Input, SqlDbType.VarChar);
                oDBParameter.Add("@sDimention", this.sAssetDimention, ParameterDirection.Input, SqlDbType.VarChar);
                oDBParameter.Add("@sWeight", this.sAssetWeight, ParameterDirection.Input, SqlDbType.VarChar);
                oDBParameter.Add("@sWattage", this.sWattage, ParameterDirection.Input, SqlDbType.VarChar);
                oDBParameter.Add("@sSpan", this.sSpan, ParameterDirection.Input, SqlDbType.VarChar);
                oDBParameter.Add("@sAttachment", this.sAttachment, ParameterDirection.Input, SqlDbType.VarChar);
                oDBParameter.Add("@sAttachmentName", this.sAttachmentName, ParameterDirection.Input, SqlDbType.VarChar);
                oDBParameter.Add("@sLength", this.sLength, ParameterDirection.Input, SqlDbType.VarChar);
                oDBParameter.Add("@sCoreOrPole", this.sCoreOrPole, ParameterDirection.Input, SqlDbType.VarChar);
                oDBParameter.Add("@sAmps", this.sAmps, ParameterDirection.Input, SqlDbType.VarChar);
                oDBParameter.Add("@sPlug", this.sPlug, ParameterDirection.Input, SqlDbType.VarChar);
                oDBParameter.Add("@sPower", this.sPower, ParameterDirection.Input, SqlDbType.VarChar);

                oDBAccess.OpenConnection(true);
                oDBAccess.Execute("lgsp_INUP_AssetMaster", oDBParameter, out objValue);

                if (objValue != null)
                {
                    nAssetID = Convert.ToInt64(objValue);
                }
                if (nAssetID == 0)
                {
                    oDBAccess.RollBack();
                    oDBAccess.CloseConnection(true);
                    return(nAssetID);
                }
                if (nAssetID != 0)
                {
                    foreach (AssetCode item in lstAssetCode)
                    {
                        oDBParameter.clear();
                        oDBParameter.Add("@nAssetID", nAssetID, ParameterDirection.Input, SqlDbType.BigInt);
                        oDBParameter.Add("@nAssetCodeID", item.nAssetCodeID, ParameterDirection.Input, SqlDbType.BigInt);
                        oDBParameter.Add("@sInitialCode", item.sInitialCode, ParameterDirection.Input, SqlDbType.VarChar);
                        oDBParameter.Add("@nSequenceNo", item.nSequenceNo, ParameterDirection.Input, SqlDbType.BigInt);
                        oDBParameter.Add("@sUniqueCode", item.sUniqueCode, ParameterDirection.Input, SqlDbType.VarChar);
                        oDBParameter.Add("@barcode", item.barcode, ParameterDirection.Input, SqlDbType.Image);
                        oDBParameter.Add("@dtShelfLife", item.dtShelfLife, ParameterDirection.Input, SqlDbType.DateTime);
                        oDBParameter.Add("@sShelfLifeUnit", item.sShelfLifeUnit, ParameterDirection.Input, SqlDbType.VarChar);
                        oDBParameter.Add("@dtRetirementDate", item.dtRetirementDate, ParameterDirection.Input, SqlDbType.DateTime);
                        oDBParameter.Add("@nStatus", 0, ParameterDirection.InputOutput, SqlDbType.Int);

                        oDBAccess.Execute("lgsp_INUP_AssetCode", oDBParameter, out objStatus);
                        int nStatus = 0;
                        if (objValue != null)
                        {
                            nStatus = Convert.ToInt32(objStatus);
                        }
                        if (nStatus <= 0)
                        {
                            oDBAccess.RollBack();
                            oDBAccess.CloseConnection(true);
                            return(nStatus);
                        }
                        if (nStatus == 2)
                        {
                            oDBAccess.RollBack();
                            oDBAccess.CloseConnection(true);
                            return(nStatus);
                        }
                    }
                }
                oDBAccess.Commit();
                //oDBAccess.CloseConnection(true);
            }
            catch (Exception ex)
            {
                oDBAccess.RollBack();
                MessageBox.Show("Error: " + ex.ToString(), clsGlobal._sMessageboxCaption, MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            finally
            {
                if (oDBAccess != null)
                {
                    oDBAccess.Dispose();
                    oDBAccess = null;
                }
                if (oDBParameter != null)
                {
                    oDBParameter.Dispose();
                    oDBParameter = null;
                }
            }
            return(nAssetID);
        }