Ejemplo n.º 1
0
        Int64 IMDAssetDataAccess.Add(MDAssetEntity mDAssetEntity, DatabaseOperationType option, TransactionRequired reqTran)
        {
            try
            {
                long retValues = -99;

                switch (reqTran)
                {
                case TransactionRequired.No:
                {
                    retValues = Add(mDAssetEntity, option);
                    break;
                }

                case TransactionRequired.Yes:
                {
                    retValues = AddTran(mDAssetEntity, option);
                    break;
                }

                default:
                {
                    retValues = -99;
                    break;
                }
                }

                return(retValues);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Ejemplo n.º 2
0
        Int64 IMDAssetDataAccess.Delete(MDAssetEntity mDAssetEntity, String filterExpression, DatabaseOperationType option, TransactionRequired reqTran)
        {
            try
            {
                long retValues = -99;

                switch (reqTran)
                {
                case TransactionRequired.No:
                {
                    retValues = Delete(mDAssetEntity, filterExpression, option);
                    break;
                }

                case TransactionRequired.Yes:
                {
                    retValues = DeleteTran(mDAssetEntity, filterExpression, option);
                    break;
                }

                default:
                {
                    retValues = -99;
                    break;
                }
                }

                return(retValues);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Ejemplo n.º 3
0
        private Int64 DeleteTran(MDAssetEntity mDAssetEntity, String filterExpression, DatabaseOperationType option)
        {
            long         returnCode = -99;
            const string SP         = "dbo.MDAsset_SET";

            Database db = DatabaseFactory.CreateDatabase();


            using (DbCommand cmd = db.GetStoredProcCommand(SP))
            {
                AddOptionParameter(cmd, option);
                AddOutputParameter(cmd, db);
                AddFilterExpressionParameter(cmd, filterExpression, db);


                DbConnection connection = db.CreateConnection();
                connection.Open();
                DbTransaction transaction = connection.BeginTransaction();

                try
                {
                    using (IDataReader reader = db.ExecuteReader(cmd, transaction))
                    {
                        returnCode = GetReturnCodeFromParameter(cmd);
                    }

                    if (returnCode >= 0)
                    {
                        transaction.Commit();
                    }
                    else
                    {
                        throw new ArgumentException("Error Code." + returnCode.ToString());
                    }
                }
                catch (Exception ex)
                {
                    transaction.Rollback();
                    throw ex;
                }
                finally
                {
                    transaction.Dispose();
                    connection.Close();
                    connection = null;
                }
            }

            return(returnCode);
        }
Ejemplo n.º 4
0
        private void DeleteItem()
        {
            Int64 AssetID;

            Int64.TryParse(treeAsset.SelectedValue, out AssetID);

            if (AssetID > 0)
            {
                try
                {
                    Int64 result = -1;

                    String fe = SqlExpressionBuilder.PrepareFilterExpression(MDAssetEntity.FLD_NAME_AssetID, AssetID.ToString(), SQLMatchType.Equal);

                    MDAssetEntity mDAssetEntity = new MDAssetEntity();

                    result = FCCMDAsset.GetFacadeCreate().Delete(mDAssetEntity, fe, DatabaseOperationType.Delete, TransactionRequired.No);

                    if (result == 0)
                    {
                        _AssetID       = 0;
                        _MDAssetEntity = new MDAssetEntity();

                        PrepareInitialView();

                        LoadTreeView();

                        MiscUtil.ShowMessage(lblMessage, "Item has been successfully deleted.", true);
                    }
                    else
                    {
                        MiscUtil.ShowMessage(lblMessage, "Failed to delete Item.", true);
                    }
                }
                catch (Exception ex)
                {
                    MiscUtil.ShowMessage(lblMessage, ex.Message, true);
                }
            }
        }
Ejemplo n.º 5
0
        private Int64 Delete(MDAssetEntity mDAssetEntity, String filterExpression, DatabaseOperationType option)
        {
            long         returnCode = -99;
            const string SP         = "dbo.MDAsset_SET";

            using (DbCommand cmd = Database.GetStoredProcCommand(SP))
            {
                AddOptionParameter(cmd, option);
                AddOutputParameter(cmd);
                AddFilterExpressionParameter(cmd, filterExpression);


                using (IDataReader reader = Database.ExecuteReader(cmd))
                {
                    returnCode = GetReturnCodeFromParameter(cmd);

                    switch (returnCode)
                    {
                    case SqlConstants.DB_STATUS_CODE_DATAALREADYEXIST:
                    {
                        throw new ArgumentException("MDAssetEntity already exists. Please specify another MDAssetEntity.");
                    }

                    case SqlConstants.DB_STATUS_CODE_DATAUPDATEDFROMOTHERSESSION:
                    {
                        throw new ArgumentException("MDAssetEntity data already updated from different session.");
                    }

                    case SqlConstants.DB_STATUS_CODE_FAIL_OPERATION:
                    {
                        throw new ArgumentException("MDAssetEntity already exists. Please specify another MDAssetEntity.");
                    }
                    }
                }
            }

            return(returnCode);
        }
Ejemplo n.º 6
0
 protected void btnAddNew_Click(object sender, EventArgs e)
 {
     _AssetID       = 0;
     _MDAssetEntity = new MDAssetEntity();
     PrepareInitialView();
 }
Ejemplo n.º 7
0
        private void SaveMDAssetEntity()
        {
            if (IsValid)
            {
                try
                {
                    MDAssetEntity mDAssetEntity = BuildMDAssetEntity();

                    Boolean addInputValidation = true;

                    Int64 result = -1;

                    if (mDAssetEntity.IsNew)
                    {
                        if (ValidateInput())
                        {
                            if (treeAsset.SelectedNode != null)
                            {
                                mDAssetEntity.AssetCateogryID = Int64.Parse(treeAsset.SelectedValue);
                            }

                            result = FCCMDAsset.GetFacadeCreate().Add(mDAssetEntity, DatabaseOperationType.Add, TransactionRequired.No);

                            if (ViewState["PushToStore"] != null)
                            {
                                //INVManager.AddItemsToStoreUnit(result, brandID, regionID, countryID, "", receiveQty, MiscUtil.GetLocalIP(), _employeeID, _rate, lstprmMaterialReceive[0].RequisitionNo.ToString(), lstprmMaterialReceive[0].WorkOrderNo.ToString(), lstprmMaterialReceive[0].MaterialReceiveID.ToString(), "", lstprmMaterialReceive[0].ProjectID, storeID, storeUnitID);
                            }
                        }
                        else
                        {
                            addInputValidation = false;
                        }
                    }
                    else
                    {
                        String filterExpression = SqlExpressionBuilder.PrepareFilterExpression(MDAssetEntity.FLD_NAME_AssetID, mDAssetEntity.AssetID.ToString(), SQLMatchType.Equal);
                        result = FCCMDAsset.GetFacadeCreate().Update(mDAssetEntity, filterExpression, DatabaseOperationType.Update, TransactionRequired.No);
                    }

                    if (result > 0)
                    {
                        _AssetID       = 0;
                        _MDAssetEntity = new MDAssetEntity();
                        PrepareInitialView();
                        LoadTreeView();

                        if (mDAssetEntity.IsNew)
                        {
                            MiscUtil.ShowMessage(lblMessage, "Asset Information has been added successfully.", false);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Asset Information has been updated successfully.", false);
                        }
                    }
                    else
                    {
                        if (mDAssetEntity.IsNew)
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to add Asset Information.", false);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to update Asset Information.", false);
                        }
                    }
                }
                catch (Exception ex)
                {
                    MiscUtil.ShowMessage(lblMessage, ex.Message, true);
                }
            }
        }
Ejemplo n.º 8
0
        private MDAssetEntity BuildMDAssetEntity()
        {
            MDAssetEntity mDAssetEntity = CurrentMDAssetEntity;

            mDAssetEntity.AssetCode = txtAssetCode.Text.Trim();
            mDAssetEntity.AssetName = txtAssetName.Text.Trim();
            if (ddlUnitID.Items.Count > 0)
            {
                if (ddlUnitID.SelectedValue == "0")
                {
                    mDAssetEntity.UnitID = null;
                }
                else
                {
                    mDAssetEntity.UnitID = Int64.Parse(ddlUnitID.SelectedValue);
                }
            }

            mDAssetEntity.Description = txtDescription.Text.Trim();
            if (ddlBrandID.Items.Count > 0)
            {
                if (ddlBrandID.SelectedValue == "0")
                {
                    mDAssetEntity.BrandID = null;
                }
                else
                {
                    mDAssetEntity.BrandID = Int64.Parse(ddlBrandID.SelectedValue);
                }
            }

            if (ddlSupplierID.Items.Count > 0)
            {
                if (ddlSupplierID.SelectedValue == "0")
                {
                    mDAssetEntity.SupplierID = null;
                }
                else
                {
                    mDAssetEntity.SupplierID = Int64.Parse(ddlSupplierID.SelectedValue);
                }
            }

            if (txtNextMaintananceDate.Text.Trim().IsNotNullOrEmpty())
            {
                mDAssetEntity.NextMaintananceDate = MiscUtil.ParseToDateTime(txtNextMaintananceDate.Text);
            }
            else
            {
                mDAssetEntity.NextMaintananceDate = null;
            }

            if (ddlProjectFloorUnitID.Items.Count > 0)
            {
                if (ddlProjectFloorUnitID.SelectedValue == "0")
                {
                    mDAssetEntity.ProjectFloorUnitID = null;
                }
                else
                {
                    mDAssetEntity.ProjectFloorUnitID = Int64.Parse(ddlProjectFloorUnitID.SelectedValue);
                }
            }

            if (ddlProjectUnitLocationID.Items.Count > 0)
            {
                if (ddlProjectUnitLocationID.SelectedValue == "0")
                {
                    mDAssetEntity.ProjectUnitLocationID = null;
                }
                else
                {
                    mDAssetEntity.ProjectUnitLocationID = Int64.Parse(ddlProjectUnitLocationID.SelectedValue);
                }
            }

            mDAssetEntity.UsedOrHandeledBy = txtUsedOrHandeledBy.Text.Trim();
            if (ddlAssetOwnerTypeID.Items.Count > 0)
            {
                if (ddlAssetOwnerTypeID.SelectedValue == "0")
                {
                }
                else
                {
                    mDAssetEntity.AssetOwnerTypeID = Int64.Parse(ddlAssetOwnerTypeID.SelectedValue);
                }
            }

            if (ddlOwnerReferenceID.Items.Count > 0 && ddlOwnerReferenceID.SelectedValue != "0")
            {
                mDAssetEntity.OwnerReferenceID = Int64.Parse(ddlOwnerReferenceID.Text.Trim());
            }
            else
            {
                mDAssetEntity.OwnerReferenceID = null;
            }

            if (ddlCurrentLocationProjectID.Items.Count > 0)
            {
                if (ddlCurrentLocationProjectID.SelectedValue == "0")
                {
                    mDAssetEntity.CurrentLocationProjectID = null;
                }
                else
                {
                    mDAssetEntity.CurrentLocationProjectID = Int64.Parse(ddlCurrentLocationProjectID.SelectedValue);
                }
            }

            mDAssetEntity.InsuranceInformation       = txtInsuranceInformation.Text.Trim();
            mDAssetEntity.ServiceContractInformation = txtServiceContractInformation.Text.Trim();
            if (!txtPrice.Text.Trim().IsNullOrEmpty())
            {
                mDAssetEntity.Price = Decimal.Parse(txtPrice.Text.Trim());
            }

            if (ddlWorkOrderID.Items.Count > 0)
            {
                if (ddlWorkOrderID.SelectedValue == "0")
                {
                    mDAssetEntity.WorkOrderID = null;
                }
                else
                {
                    mDAssetEntity.WorkOrderID = Int64.Parse(ddlWorkOrderID.SelectedValue);
                }
            }

            if (ddlAssetConditionID.Items.Count > 0)
            {
                if (ddlAssetConditionID.SelectedValue == "0")
                {
                }
                else
                {
                    mDAssetEntity.AssetConditionID = Int64.Parse(ddlAssetConditionID.SelectedValue);
                }
            }

            String imageUrlpath;

            if (fuImageUrl.HasFile == true && mDAssetEntity.ImageUrl.IsNotNullOrEmpty())
            {
                if (File.Exists(Server.MapPath(mDAssetEntity.ImageUrl)))
                {
                    File.Delete(Server.MapPath(mDAssetEntity.ImageUrl));
                }
                imageUrlpath = FileUploadConstants.Asset.AssetImageUrl + Guid.NewGuid() + fuImageUrl.FileName;
                fuImageUrl.SaveAs(Server.MapPath(imageUrlpath));
                mDAssetEntity.ImageUrl = imageUrlpath;
            }

            if (mDAssetEntity.ImageUrl.IsNotNullOrEmpty() && fuImageUrl.HasFile == false)
            {
                mDAssetEntity.ImageUrl = mDAssetEntity.ImageUrl;
            }

            if (fuImageUrl.HasFile == false && mDAssetEntity.ImageUrl.IsNullOrEmpty())
            {
                mDAssetEntity.ImageUrl = null;
            }

            if (fuImageUrl.HasFile == true && mDAssetEntity.ImageUrl.IsNullOrEmpty())
            {
                imageUrlpath = FileUploadConstants.Asset.AssetImageUrl + Guid.NewGuid() + fuImageUrl.FileName;
                fuImageUrl.SaveAs(Server.MapPath(imageUrlpath));
                mDAssetEntity.ImageUrl = imageUrlpath;
            }

            mDAssetEntity.Remarks = txtRemarks.Text.Trim();

            mDAssetEntity.IsRemoved = chkIsRemoved.Checked;

            if (txtMedium.Text.Trim().IsNotNullOrEmpty())
            {
                mDAssetEntity.Medium = txtMedium.Text.ToString().Trim();
            }
            else
            {
                mDAssetEntity.Medium = null;
            }

            if (txtWidth.Text.Trim().IsNotNullOrEmpty())
            {
                mDAssetEntity.Width = Decimal.Parse(txtWidth.Text);
            }
            else
            {
                mDAssetEntity.Width = null;
            }

            if (txtHeight.Text.Trim().IsNotNullOrEmpty())
            {
                mDAssetEntity.Height = Decimal.Parse(txtHeight.Text);
            }
            else
            {
                mDAssetEntity.Height = null;
            }

            if (txtPresentBookValue.Text.Trim().IsNotNullOrEmpty())
            {
                mDAssetEntity.PresentBookValue = Decimal.Parse(txtPresentBookValue.Text);
            }
            else
            {
                mDAssetEntity.PresentBookValue = null;
            }


            return(mDAssetEntity);
        }
Ejemplo n.º 9
0
        private void PrepareEditView()
        {
            MDAssetEntity mDAssetEntity = CurrentMDAssetEntity;


            if (!mDAssetEntity.IsNew)
            {
                txtAssetCode.Text = mDAssetEntity.AssetCode.ToString();
                txtAssetName.Text = mDAssetEntity.AssetName.ToString();
                if (ddlUnitID.Items.Count > 0 && mDAssetEntity.UnitID != null)
                {
                    ddlUnitID.SelectedValue = mDAssetEntity.UnitID.ToString();
                }

                txtDescription.Text = mDAssetEntity.Description.ToString();
                if (ddlBrandID.Items.Count > 0 && mDAssetEntity.BrandID != null)
                {
                    ddlBrandID.SelectedValue = mDAssetEntity.BrandID.ToString();
                }

                if (ddlSupplierID.Items.Count > 0 && mDAssetEntity.SupplierID != null)
                {
                    ddlSupplierID.SelectedValue = mDAssetEntity.SupplierID.ToString();
                }

                txtNextMaintananceDate.Text = mDAssetEntity.NextMaintananceDate.ToStringDefault();
                txtUsedOrHandeledBy.Text    = mDAssetEntity.UsedOrHandeledBy.ToString();

                if (ddlProjectFloorUnitID.Items.Count > 0 && mDAssetEntity.ProjectFloorUnitID != null)
                {
                    ddlProjectFloorUnitID.SelectedValue = mDAssetEntity.ProjectFloorUnitID.ToString();
                }

                if (ddlProjectUnitLocationID.Items.Count > 0 && mDAssetEntity.ProjectUnitLocationID != null)
                {
                    ddlProjectUnitLocationID.SelectedValue = mDAssetEntity.ProjectUnitLocationID.ToString();
                }
                if (ddlAssetOwnerTypeID.Items.Count > 0 && mDAssetEntity.AssetOwnerTypeID != null)
                {
                    ddlAssetOwnerTypeID.SelectedValue = mDAssetEntity.AssetOwnerTypeID.ToString();
                }
                if (ddlOwnerReferenceID.Items.Count > 0 && mDAssetEntity.OwnerReferenceID != null)
                {
                    ddlOwnerReferenceID.SelectedValue = mDAssetEntity.OwnerReferenceID.ToString();
                }

                if (ddlCurrentLocationProjectID.Items.Count > 0 && mDAssetEntity.CurrentLocationProjectID != null)
                {
                    ddlCurrentLocationProjectID.SelectedValue = mDAssetEntity.CurrentLocationProjectID.ToString();
                }

                txtInsuranceInformation.Text       = mDAssetEntity.InsuranceInformation.ToString();
                txtServiceContractInformation.Text = mDAssetEntity.ServiceContractInformation.ToString();
                txtPrice.Text = mDAssetEntity.Price.ToString();
                if (ddlWorkOrderID.Items.Count > 0 && mDAssetEntity.WorkOrderID != null)
                {
                    ddlWorkOrderID.SelectedValue = mDAssetEntity.WorkOrderID.ToString();
                }

                if (ddlAssetConditionID.Items.Count > 0 && mDAssetEntity.AssetConditionID != null)
                {
                    ddlAssetConditionID.SelectedValue = mDAssetEntity.AssetConditionID.ToString();
                }

                txtRemarks.Text      = mDAssetEntity.Remarks.ToString();
                chkIsRemoved.Checked = mDAssetEntity.IsRemoved;

                if (mDAssetEntity.Medium.IsNotNullOrEmpty())
                {
                    txtMedium.Text = mDAssetEntity.Medium.ToString();
                }
                else
                {
                    txtMedium.Text = null;
                }


                txtWidth.Text            = mDAssetEntity.Width.ToString();
                txtHeight.Text           = mDAssetEntity.Height.ToString();
                txtPresentBookValue.Text = mDAssetEntity.PresentBookValue.ToString();

                btnSubmit.Text    = "Update";
                btnAddNew.Visible = true;
            }
        }
Ejemplo n.º 10
0
        private Int64 Add(MDAssetEntity mDAssetEntity, DatabaseOperationType option)
        {
            long         returnCode = -99;
            const string SP         = "dbo.MDAsset_SET";

            using (DbCommand cmd = Database.GetStoredProcCommand(SP))
            {
                AddOptionParameter(cmd, option);
                AddOutputParameter(cmd);
                AddNullPrimaryKeyParameter(cmd, "AssetID");

                Database.AddInParameter(cmd, "@AssetCateogryID", DbType.Int64, mDAssetEntity.AssetCateogryID);
                Database.AddInParameter(cmd, "@AssetCode", DbType.String, mDAssetEntity.AssetCode);
                Database.AddInParameter(cmd, "@AssetName", DbType.String, mDAssetEntity.AssetName);
                Database.AddInParameter(cmd, "@ImageUrl", DbType.String, mDAssetEntity.ImageUrl);
                Database.AddInParameter(cmd, "@UnitID", DbType.Int64, mDAssetEntity.UnitID);
                Database.AddInParameter(cmd, "@Description", DbType.String, mDAssetEntity.Description);
                Database.AddInParameter(cmd, "@BrandID", DbType.Int64, mDAssetEntity.BrandID);
                Database.AddInParameter(cmd, "@SupplierID", DbType.Int64, mDAssetEntity.SupplierID);
                Database.AddInParameter(cmd, "@NextMaintananceDate", DbType.DateTime, mDAssetEntity.NextMaintananceDate);
                Database.AddInParameter(cmd, "@UsedOrHandeledBy", DbType.String, mDAssetEntity.UsedOrHandeledBy);
                Database.AddInParameter(cmd, "@ProjectFloorUnitID", DbType.Int64, mDAssetEntity.ProjectFloorUnitID);
                Database.AddInParameter(cmd, "@ProjectUnitLocationID", DbType.Int64, mDAssetEntity.ProjectUnitLocationID);
                Database.AddInParameter(cmd, "@AssetOwnerTypeID", DbType.Int64, mDAssetEntity.AssetOwnerTypeID);
                Database.AddInParameter(cmd, "@OwnerReferenceID", DbType.Int64, mDAssetEntity.OwnerReferenceID);
                Database.AddInParameter(cmd, "@CurrentLocationProjectID", DbType.Int64, mDAssetEntity.CurrentLocationProjectID);
                Database.AddInParameter(cmd, "@InsuranceInformation", DbType.String, mDAssetEntity.InsuranceInformation);
                Database.AddInParameter(cmd, "@ServiceContractInformation", DbType.String, mDAssetEntity.ServiceContractInformation);
                Database.AddInParameter(cmd, "@Price", DbType.Decimal, mDAssetEntity.Price);
                Database.AddInParameter(cmd, "@WorkOrderID", DbType.Int64, mDAssetEntity.WorkOrderID);
                Database.AddInParameter(cmd, "@Remarks", DbType.String, mDAssetEntity.Remarks);
                Database.AddInParameter(cmd, "@AssetConditionID", DbType.Int64, mDAssetEntity.AssetConditionID);
                Database.AddInParameter(cmd, "@IsRemoved", DbType.Boolean, mDAssetEntity.IsRemoved);
                Database.AddInParameter(cmd, "@Medium", DbType.String, mDAssetEntity.Medium);
                Database.AddInParameter(cmd, "@Width", DbType.Decimal, mDAssetEntity.Width);
                Database.AddInParameter(cmd, "@Height", DbType.Decimal, mDAssetEntity.Height);
                Database.AddInParameter(cmd, "@PresentBookValue", DbType.Decimal, mDAssetEntity.PresentBookValue);

                using (IDataReader reader = Database.ExecuteReader(cmd))
                {
                    returnCode = GetReturnCodeFromParameter(cmd);

                    switch (returnCode)
                    {
                    case SqlConstants.DB_STATUS_CODE_DATAALREADYEXIST:
                    {
                        throw new ArgumentException("MDAssetEntity already exists. Please specify another MDAssetEntity.");
                    }

                    case SqlConstants.DB_STATUS_CODE_DATAUPDATEDFROMOTHERSESSION:
                    {
                        throw new ArgumentException("MDAssetEntity data already updated from different session.");
                    }

                    case SqlConstants.DB_STATUS_CODE_FAIL_OPERATION:
                    {
                        throw new ArgumentException("MDAssetEntity already exists. Please specify another MDAssetEntity.");
                    }
                    }
                }
            }

            return(returnCode);
        }
Ejemplo n.º 11
0
        private Int64 UpdateTran(MDAssetEntity mDAssetEntity, String filterExpression, DatabaseOperationType option)
        {
            long         returnCode = -99;
            const string SP         = "dbo.MDAsset_SET";

            Database db = DatabaseFactory.CreateDatabase();

            using (DbCommand cmd = db.GetStoredProcCommand(SP))
            {
                AddOptionParameter(cmd, option, db);
                AddOutputParameter(cmd, db);
                AddFilterExpressionParameter(cmd, filterExpression, db);

                db.AddInParameter(cmd, "@AssetID", DbType.Int64, mDAssetEntity.AssetID);
                db.AddInParameter(cmd, "@AssetCateogryID", DbType.Int64, mDAssetEntity.AssetCateogryID);
                db.AddInParameter(cmd, "@AssetCode", DbType.String, mDAssetEntity.AssetCode);
                db.AddInParameter(cmd, "@AssetName", DbType.String, mDAssetEntity.AssetName);
                db.AddInParameter(cmd, "@ImageUrl", DbType.String, mDAssetEntity.ImageUrl);
                db.AddInParameter(cmd, "@UnitID", DbType.Int64, mDAssetEntity.UnitID);
                db.AddInParameter(cmd, "@Description", DbType.String, mDAssetEntity.Description);
                db.AddInParameter(cmd, "@BrandID", DbType.Int64, mDAssetEntity.BrandID);
                db.AddInParameter(cmd, "@SupplierID", DbType.Int64, mDAssetEntity.SupplierID);
                db.AddInParameter(cmd, "@NextMaintananceDate", DbType.DateTime, mDAssetEntity.NextMaintananceDate);
                db.AddInParameter(cmd, "@UsedOrHandeledBy", DbType.String, mDAssetEntity.UsedOrHandeledBy);
                db.AddInParameter(cmd, "@ProjectFloorUnitID", DbType.Int64, mDAssetEntity.ProjectFloorUnitID);
                db.AddInParameter(cmd, "@ProjectUnitLocationID", DbType.Int64, mDAssetEntity.ProjectUnitLocationID);
                db.AddInParameter(cmd, "@AssetOwnerTypeID", DbType.Int64, mDAssetEntity.AssetOwnerTypeID);
                db.AddInParameter(cmd, "@OwnerReferenceID", DbType.Int64, mDAssetEntity.OwnerReferenceID);
                db.AddInParameter(cmd, "@CurrentLocationProjectID", DbType.Int64, mDAssetEntity.CurrentLocationProjectID);
                db.AddInParameter(cmd, "@InsuranceInformation", DbType.String, mDAssetEntity.InsuranceInformation);
                db.AddInParameter(cmd, "@ServiceContractInformation", DbType.String, mDAssetEntity.ServiceContractInformation);
                db.AddInParameter(cmd, "@Price", DbType.Decimal, mDAssetEntity.Price);
                db.AddInParameter(cmd, "@WorkOrderID", DbType.Int64, mDAssetEntity.WorkOrderID);
                db.AddInParameter(cmd, "@Remarks", DbType.String, mDAssetEntity.Remarks);
                db.AddInParameter(cmd, "@AssetConditionID", DbType.Int64, mDAssetEntity.AssetConditionID);
                db.AddInParameter(cmd, "@IsRemoved", DbType.Boolean, mDAssetEntity.IsRemoved);
                db.AddInParameter(cmd, "@Medium", DbType.String, mDAssetEntity.Medium);
                db.AddInParameter(cmd, "@Width", DbType.Decimal, mDAssetEntity.Width);
                db.AddInParameter(cmd, "@Height", DbType.Decimal, mDAssetEntity.Height);
                db.AddInParameter(cmd, "@PresentBookValue", DbType.Decimal, mDAssetEntity.PresentBookValue);

                DbConnection connection = db.CreateConnection();
                connection.Open();
                DbTransaction transaction = connection.BeginTransaction();

                try
                {
                    using (IDataReader reader = db.ExecuteReader(cmd, transaction))
                    {
                        returnCode = GetReturnCodeFromParameter(cmd);
                    }

                    if (returnCode > 0)
                    {
                        transaction.Commit();
                    }
                    else
                    {
                        throw new ArgumentException("Error Code." + returnCode.ToString());
                    }
                }
                catch (Exception ex)
                {
                    transaction.Rollback();
                    throw ex;
                }
                finally
                {
                    transaction.Dispose();
                    connection.Close();
                    connection = null;
                }
            }

            return(returnCode);
        }
Ejemplo n.º 12
0
 Int64 IMDAssetFacade.Delete(MDAssetEntity mDAssetEntity, String filterExpression, DatabaseOperationType option, TransactionRequired reqTran)
 {
     return(DataAccessFactory.CreateMDAssetDataAccess().Delete(mDAssetEntity, filterExpression, option, reqTran));
 }
Ejemplo n.º 13
0
 Int64 IMDAssetFacade.Add(MDAssetEntity mDAssetEntity, DatabaseOperationType option, TransactionRequired reqTran)
 {
     return(DataAccessFactory.CreateMDAssetDataAccess().Add(mDAssetEntity, option, reqTran));
 }
Ejemplo n.º 14
0
 private void PrepareEditView()
 {
     MDAssetEntity mDAssetEntity = CurrentMDAssetEntity;
 }