Int64 ICMConsultantDataAccess.Add(CMConsultantEntity cMConsultantEntity, DatabaseOperationType option, TransactionRequired reqTran)
        {
            try
            {
                long retValues = -99;

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

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

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

                return(retValues);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        private void PrepareEditView()
        {
            CMConsultantEntity cMConsultantEntity = CurrentCMConsultantEntity;
            HRMemberEntity     hRMemberEntity     = CurrentHRMemberEntity;

            if (!hRMemberEntity.IsNew)
            {
                txtFirstName.Text  = hRMemberEntity.FirstName.ToString();
                txtMiddleName.Text = hRMemberEntity.MiddleName.ToString();
                txtLastName.Text   = hRMemberEntity.LastName.ToString();
            }

            if (!cMConsultantEntity.IsNew)
            {
                txtName.Text            = cMConsultantEntity.Name.ToString();
                txtCurrentPosition.Text = cMConsultantEntity.CurrentPosition.ToString();
                txtInstitueName.Text    = cMConsultantEntity.InstitueName.ToString();
                txtEmailAddress1.Text   = cMConsultantEntity.EmailAddress1.ToString();
                txtEmailAddress2.Text   = cMConsultantEntity.EmailAddress2.ToString();
                txtContactNo1.Text      = cMConsultantEntity.ContactNo1.ToString();
                txtContactNo2.Text      = cMConsultantEntity.ContactNo2.ToString();
                txtPhone.Text           = cMConsultantEntity.Phone.ToString();
                txtRemarks.Text         = cMConsultantEntity.Remarks.ToString();
                chkIsRemoved.Checked    = cMConsultantEntity.IsRemoved;

                btnSubmit.Text    = "Update";
                btnAddNew.Visible = false;
            }
        }
        Int64 ICMConsultantDataAccess.Delete(CMConsultantEntity cMConsultantEntity, String filterExpression, DatabaseOperationType option, TransactionRequired reqTran)
        {
            try
            {
                long retValues = -99;

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

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

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

                return(retValues);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        protected void btnAddNew_Click(object sender, EventArgs e)
        {
            _MemberID       = 0;
            _HRMemberEntity = new HRMemberEntity();

            _ConsultantID       = 0;
            _CMConsultantEntity = new CMConsultantEntity();

            PrepareInitialView();
        }
        private CMConsultantEntity BuildCMConsultantEntity()
        {
            CMConsultantEntity cMConsultantEntity = CurrentCMConsultantEntity;

            cMConsultantEntity.OutsourceCategoryID = MasterDataConstants.MDOutsourceCategory.ARTIST;
            cMConsultantEntity.Name            = txtFirstName.Text.Trim() + " " + txtMiddleName.Text.Trim() + " " + txtLastName.Text.Trim();
            cMConsultantEntity.CurrentPosition = txtCurrentPosition.Text.Trim();
            cMConsultantEntity.InstitueName    = txtInstitueName.Text.Trim();
            cMConsultantEntity.EmailAddress1   = txtEmailAddress1.Text.Trim();
            cMConsultantEntity.EmailAddress2   = txtEmailAddress2.Text.Trim();
            cMConsultantEntity.ContactNo1      = txtContactNo1.Text.Trim();
            cMConsultantEntity.ContactNo2      = txtContactNo2.Text.Trim();
            cMConsultantEntity.Phone           = txtPhone.Text.Trim();
            cMConsultantEntity.Remarks         = txtRemarks.Text.Trim();
            cMConsultantEntity.IsRemoved       = chkIsRemoved.Checked;

            #region Image Url

            String ImageUrlpath;

            if (fuImageUrl.HasFile == true && cMConsultantEntity.ImageUrl.IsNotNullOrEmpty())
            {
                if (File.Exists(Server.MapPath(cMConsultantEntity.ImageUrl)))
                {
                    File.Delete(Server.MapPath(cMConsultantEntity.ImageUrl));
                }
                ImageUrlpath = FileUploadConstants.CONSULTANT.CONSULTANT_IMAGE + Guid.NewGuid() + fuImageUrl.FileName;
                fuImageUrl.SaveAs(Server.MapPath(ImageUrlpath));
                cMConsultantEntity.ImageUrl = ImageUrlpath;
            }

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

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

            if (fuImageUrl.HasFile == true && cMConsultantEntity.ImageUrl.IsNullOrEmpty())
            {
                ImageUrlpath = FileUploadConstants.CONSULTANT.CONSULTANT_IMAGE + Guid.NewGuid() + fuImageUrl.FileName;
                fuImageUrl.SaveAs(Server.MapPath(ImageUrlpath));
                cMConsultantEntity.ImageUrl = ImageUrlpath;
            }

            #endregion

            return(cMConsultantEntity);
        }
        private Int64 Update(CMConsultantEntity cMConsultantEntity, String filterExpression, DatabaseOperationType option)
        {
            long         returnCode = -99;
            const string SP         = "dbo.CMConsultant_SET";

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

                Database.AddInParameter(cmd, "@ConsultantID", DbType.Int64, cMConsultantEntity.ConsultantID);
                Database.AddInParameter(cmd, "@MemberID", DbType.Int64, cMConsultantEntity.MemberID);
                Database.AddInParameter(cmd, "@OutsourceCategoryID", DbType.Int64, cMConsultantEntity.OutsourceCategoryID);
                Database.AddInParameter(cmd, "@Name", DbType.String, cMConsultantEntity.Name);
                Database.AddInParameter(cmd, "@ImageUrl", DbType.String, cMConsultantEntity.ImageUrl);
                Database.AddInParameter(cmd, "@CurrentPosition", DbType.String, cMConsultantEntity.CurrentPosition);
                Database.AddInParameter(cmd, "@InstitueName", DbType.String, cMConsultantEntity.InstitueName);
                Database.AddInParameter(cmd, "@EmailAddress1", DbType.String, cMConsultantEntity.EmailAddress1);
                Database.AddInParameter(cmd, "@EmailAddress2", DbType.String, cMConsultantEntity.EmailAddress2);
                Database.AddInParameter(cmd, "@ContactNo1", DbType.String, cMConsultantEntity.ContactNo1);
                Database.AddInParameter(cmd, "@ContactNo2", DbType.String, cMConsultantEntity.ContactNo2);
                Database.AddInParameter(cmd, "@Phone", DbType.String, cMConsultantEntity.Phone);
                Database.AddInParameter(cmd, "@Remarks", DbType.String, cMConsultantEntity.Remarks);
                Database.AddInParameter(cmd, "@IsRemoved", DbType.Boolean, cMConsultantEntity.IsRemoved);

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

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

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

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

            return(returnCode);
        }
        protected void lvCMConsultant_ItemDataBound(object sender, ListViewItemEventArgs e)
        {
            if (e.Item.ItemType == ListViewItemType.DataItem)
            {
                ListViewDataItem dataItem = (ListViewDataItem)e.Item;

                CMConsultantEntity ent = (CMConsultantEntity)dataItem.DataItem;

                HyperLink hypConsultant = (HyperLink)e.Item.FindControl("hypConsultant");

                hypConsultant.NavigateUrl = UrlHelper.BuildSecureUrl("~/CM/CMConsultantEditor.aspx", string.Empty, UrlConstants.OVERVIEW_CONSULTANT_ID, ent.ConsultantID.ToString()).ToString();
                hypConsultant.Target      = "_blank";
            }
        }
        private Int64 DeleteTran(CMConsultantEntity cMConsultantEntity, String filterExpression, DatabaseOperationType option)
        {
            long         returnCode = -99;
            const string SP         = "dbo.CMConsultant_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);
        }
        private CMConsultantEntity BuildCMConsultantEntity()
        {
            CMConsultantEntity cMConsultantEntity = CurrentCMConsultantEntity;

            cMConsultantEntity.OutsourceCategoryID = MasterDataConstants.MDOutsourceCategory.ARTIST;
            cMConsultantEntity.Name            = txtName.Text.Trim();
            cMConsultantEntity.ImageUrl        = txtImageUrl.Text.Trim();
            cMConsultantEntity.CurrentPosition = txtCurrentPosition.Text.Trim();
            cMConsultantEntity.InstitueName    = txtInstitueName.Text.Trim();
            cMConsultantEntity.EmailAddress1   = txtEmailAddress1.Text.Trim();
            cMConsultantEntity.EmailAddress2   = txtEmailAddress2.Text.Trim();
            cMConsultantEntity.ContactNo1      = txtContactNo1.Text.Trim();
            cMConsultantEntity.ContactNo2      = txtContactNo2.Text.Trim();
            cMConsultantEntity.Phone           = txtPhone.Text.Trim();
            cMConsultantEntity.Remarks         = txtRemarks.Text.Trim();
            cMConsultantEntity.IsRemoved       = chkIsRemoved.Checked;

            return(cMConsultantEntity);
        }
        private Int64 Delete(CMConsultantEntity cMConsultantEntity, String filterExpression, DatabaseOperationType option)
        {
            long         returnCode = -99;
            const string SP         = "dbo.CMConsultant_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("CMConsultantEntity already exists. Please specify another CMConsultantEntity.");
                    }

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

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

            return(returnCode);
        }
        protected void lvCMConsultant_ItemCommand(object sender, ListViewCommandEventArgs e)
        {
            Int64 ConsultantID;

            Int64.TryParse(e.CommandArgument.ToString(), out ConsultantID);

            if (ConsultantID > 0)
            {
                if (string.Equals(e.CommandName, "EditItem"))
                {
                    _ConsultantID = ConsultantID;
                    _MemberID     = CurrentCMConsultantEntity.MemberID.Value;


                    PrepareEditView();

                    cpeEditor.Collapsed   = false;
                    cpeEditor.ClientState = "false";
                }
                else if (string.Equals(e.CommandName, "DeleteItem"))
                {
                    try
                    {
                        CMConsultantEntity tempConsultant = FCCCMConsultant.GetFacadeCreate().GetByID(ConsultantID);

                        #region Resource Delete

                        Int64 resultOne = -1;

                        String fe1_re = SqlExpressionBuilder.PrepareFilterExpression(ResourceEntity.FLD_NAME_ReferenceID, ConsultantID.ToString(), SQLMatchType.Equal);
                        String fe2_re = SqlExpressionBuilder.PrepareFilterExpression(ResourceEntity.FLD_NAME_ResourceCategoryID, MasterDataConstants.ResourceCategory.CONSULTANT.ToString(), SQLMatchType.Equal);
                        String fe_re  = SqlExpressionBuilder.PrepareFilterExpression(fe1_re, SQLJoinType.AND, fe2_re);

                        IList <ResourceEntity> resourceList = FCCResource.GetFacadeCreate().GetIL(null, null, String.Empty, fe_re, DatabaseOperationType.LoadWithFilterExpression);

                        foreach (ResourceEntity ent in resourceList)
                        {
                            String fe_re_delete = SqlExpressionBuilder.PrepareFilterExpression(ResourceEntity.FLD_NAME_ResourceID, ent.ResourceID.ToString(), SQLMatchType.Equal);

                            resultOne = FCCResource.GetFacadeCreate().Delete(ent, fe_re_delete, DatabaseOperationType.Delete, TransactionRequired.No);
                        }

                        #endregion

                        #region Consultant Delete

                        Int64 resultTwo = -1;

                        if (resultOne == 0)
                        {
                            String fe_con_delete = SqlExpressionBuilder.PrepareFilterExpression(CMConsultantEntity.FLD_NAME_ConsultantID, ConsultantID.ToString(), SQLMatchType.Equal);

                            CMConsultantEntity cMConsultantEntity = new CMConsultantEntity();

                            resultTwo = FCCCMConsultant.GetFacadeCreate().Delete(cMConsultantEntity, fe_con_delete, DatabaseOperationType.Delete, TransactionRequired.No);
                        }

                        #endregion

                        #region Member Delete

                        Int64 resultThree = -1;

                        if (resultTwo == 0)
                        {
                            String fe_mem_delete = SqlExpressionBuilder.PrepareFilterExpression(HRMemberEntity.FLD_NAME_MemberID, tempConsultant.MemberID.ToString(), SQLMatchType.Equal);

                            HRMemberEntity hRMemberEntity = new HRMemberEntity();

                            resultThree = FCCHRMember.GetFacadeCreate().Delete(hRMemberEntity, fe_mem_delete, DatabaseOperationType.Delete, TransactionRequired.No);
                        }

                        #endregion

                        if (resultOne == 0 && resultTwo == 0 && resultThree == 0)
                        {
                            _ConsultantID       = 0;
                            _CMConsultantEntity = new CMConsultantEntity();
                            _MemberID           = 0;
                            _HRMemberEntity     = new HRMemberEntity();

                            PrepareInitialView();
                            BindCMConsultantList();

                            MiscUtil.ShowMessage(lblMessage, "Consultant has been successfully deleted.", true);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to delete Consultant.", true);
                        }
                    }
                    catch (Exception ex)
                    {
                        MiscUtil.ShowMessage(lblMessage, ex.Message, true);
                    }
                }
            }
        }
        private void SaveCMConsultantEntity()
        {
            if (IsValid)
            {
                try
                {
                    #region Member

                    HRMemberEntity hRMemberEntity = BuildHRMemberEntity();

                    Int64 result = -1;

                    if (hRMemberEntity.IsNew)
                    {
                        result = FCCHRMember.GetFacadeCreate().Add(hRMemberEntity, DatabaseOperationType.Add, TransactionRequired.No);
                    }
                    else
                    {
                        String filterExpression = SqlExpressionBuilder.PrepareFilterExpression(HRMemberEntity.FLD_NAME_MemberID, hRMemberEntity.MemberID.ToString(), SQLMatchType.Equal);
                        result = FCCHRMember.GetFacadeCreate().Update(hRMemberEntity, filterExpression, DatabaseOperationType.Update, TransactionRequired.No);
                    }

                    #endregion

                    if (result > 0)
                    {
                        _MemberID       = 0;
                        _HRMemberEntity = new HRMemberEntity();
                    }

                    if (result > 0)
                    {
                        CMConsultantEntity cMConsultantEntity = BuildCMConsultantEntity();

                        Int64 resultC = -1;

                        if (cMConsultantEntity.IsNew)
                        {
                            cMConsultantEntity.MemberID = result;
                            resultC = FCCCMConsultant.GetFacadeCreate().Add(cMConsultantEntity, DatabaseOperationType.Add, TransactionRequired.No);
                        }
                        else
                        {
                            String filterExpression = SqlExpressionBuilder.PrepareFilterExpression(CMConsultantEntity.FLD_NAME_ConsultantID, cMConsultantEntity.ConsultantID.ToString(), SQLMatchType.Equal);
                            resultC = FCCCMConsultant.GetFacadeCreate().Update(cMConsultantEntity, filterExpression, DatabaseOperationType.Update, TransactionRequired.No);
                        }

                        if (resultC > 0)
                        {
                            _ConsultantID       = 0;
                            _CMConsultantEntity = new CMConsultantEntity();
                            PrepareInitialView();
                            BindCMConsultantList();

                            if (cMConsultantEntity.IsNew)
                            {
                                ResourceEntity resourceEntity = new ResourceEntity();

                                resourceEntity.ReferenceID        = resultC; // means new contractor id
                                resourceEntity.ResourceCategoryID = MasterDataConstants.ResourceCategory.CONSULTANT;

                                FCCResource.GetFacadeCreate().Add(resourceEntity, DatabaseOperationType.Add, TransactionRequired.No);
                            }

                            if (cMConsultantEntity.IsNew)
                            {
                                MiscUtil.ShowMessage(lblMessage, "Consultant Information has been added successfully.", false);
                            }
                            else
                            {
                                MiscUtil.ShowMessage(lblMessage, "Consultant Information has been updated successfully.", false);
                            }
                        }
                        else
                        {
                            if (cMConsultantEntity.IsNew)
                            {
                                MiscUtil.ShowMessage(lblMessage, "Failed to add Consultant Information.", false);
                            }
                            else
                            {
                                MiscUtil.ShowMessage(lblMessage, "Failed to update Consultant Information.", false);
                            }
                        }
                    }
                    else
                    {
                        if (hRMemberEntity.IsNew)
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to add Member Information.", false);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to update Member Information.", false);
                        }
                    }
                }
                catch (Exception ex)
                {
                    MiscUtil.ShowMessage(lblMessage, ex.Message, true);
                }
            }
        }
        protected void lvACCPrePayableStatementDetail_ItemDataBound(object sender, ListViewItemEventArgs e)
        {
            if (e.Item.ItemType == ListViewItemType.DataItem)
            {
                ListViewDataItem dataItem = (ListViewDataItem)e.Item;

                ACCPostPayableStatementDetailEntity ent = (ACCPostPayableStatementDetailEntity)dataItem.DataItem;

                Label        lblProjectNameLV                            = (Label)e.Item.FindControl("lblProjectNameLV");
                Label        lblVendorCategoryNameLV                     = (Label)e.Item.FindControl("lblVendorCategoryNameLV");
                Label        lblVendorCategoryIDLV                       = (Label)e.Item.FindControl("lblVendorCategoryIDLV");
                Label        lblVendorIDLV                               = (Label)e.Item.FindControl("lblVendorIDLV");
                Label        lblVendorNameLV                             = (Label)e.Item.FindControl("lblVendorNameLV");
                Label        lblProjectIDLV                              = (Label)e.Item.FindControl("lblProjectIDLV");
                DropDownList ddlACCPayableApprovalStatusIDLV             = (DropDownList)e.Item.FindControl("ddlACCPayableApprovalStatusIDLV");
                DropDownList ddlACCPayablePaymentStatusIDLV              = (DropDownList)e.Item.FindControl("ddlACCPayablePaymentStatusIDLV");
                DropDownList ddlPayableClassificationIDLV                = (DropDownList)e.Item.FindControl("ddlPayableClassificationIDLV");
                DropDownList ddlAccountPaybleStatementDetailCategoryIDLV = (DropDownList)e.Item.FindControl("ddlAccountPaybleStatementDetailCategoryIDLV");
                CheckBox     chkPartyReconcileLV                         = (CheckBox)e.Item.FindControl("chkPartyReconcileLV");

                if (lblProjectIDLV != null)
                {
                    BDProjectEntity _bDProjectEntity = FCCBDProject.GetFacadeCreate().GetByID(Int64.Parse(lblProjectIDLV.Text));

                    if (_bDProjectEntity != null)
                    {
                        lblProjectNameLV.Text = _bDProjectEntity.ProjectName + " (" + _bDProjectEntity.ProjectCode + ")";
                    }
                }

                MiscUtil.PopulateMDACCPayablePaymentStatus(ddlACCPayablePaymentStatusIDLV, false);
                MiscUtil.PopulateMDACCPayableApprovalStatus(ddlACCPayableApprovalStatusIDLV, false);
                MiscUtil.PopulateMDPayableClassification(ddlPayableClassificationIDLV, false);
                MiscUtil.PopulateMDAccountPaybleStatementDetailCategory(ddlAccountPaybleStatementDetailCategoryIDLV, false);
                _PostPayableStatementDetailID = ent.PostPayableStatementDetailID;

                if (ent.PartyReconcile == true)
                {
                    chkPartyReconcileLV.Checked = true;
                }
                else
                {
                    chkPartyReconcileLV.Checked = false;
                }

                Int64 vendorID;
                Int64.TryParse(lblVendorIDLV.Text.ToString(), out vendorID);

                switch (lblVendorCategoryIDLV.Text)
                {
                case MasterDataConstants.CM_Bill_VendorCategory.CONSULTANT:
                    CMConsultantEntity _cmConsultantEntity = FCCCMConsultant.GetFacadeCreate().GetByID(vendorID);
                    lblVendorCategoryNameLV.Text = "CONSULTANT";
                    lblVendorNameLV.Text         = _cmConsultantEntity.Name;
                    break;

                case MasterDataConstants.CM_Bill_VendorCategory.CONTRACTOR:
                    CMContractorEntity _cMContractorEntity = FCCCMContractor.GetFacadeCreate().GetByID(vendorID);
                    lblVendorCategoryNameLV.Text = "CONTRACTOR";
                    lblVendorNameLV.Text         = _cMContractorEntity.Name;
                    break;

                case MasterDataConstants.CM_Bill_VendorCategory.VENDOR:
                    PRMSupplierEntity _pRMSupplierEntity = FCCPRMSupplier.GetFacadeCreate().GetByID(vendorID);
                    lblVendorCategoryNameLV.Text = "VENDOR";
                    lblVendorNameLV.Text         = _pRMSupplierEntity.SupplierName;
                    break;
                }

                if (ddlACCPayableApprovalStatusIDLV != null && ddlACCPayableApprovalStatusIDLV.Items.Count > 0)
                {
                    ddlACCPayableApprovalStatusIDLV.SelectedValue = ent.ACCPayableApprovalStatusID.ToString();
                }

                if (ddlACCPayablePaymentStatusIDLV != null && ddlACCPayablePaymentStatusIDLV.Items.Count > 0)
                {
                    ddlACCPayablePaymentStatusIDLV.SelectedValue = ent.ACCPayablePaymentStatusID.ToString();
                }

                if (ddlPayableClassificationIDLV != null && ddlPayableClassificationIDLV.Items.Count > 0)
                {
                    ddlPayableClassificationIDLV.SelectedValue = ent.PayableClassificationID.ToString();
                }

                if (ddlAccountPaybleStatementDetailCategoryIDLV != null && ddlAccountPaybleStatementDetailCategoryIDLV.Items.Count > 0)
                {
                    ddlAccountPaybleStatementDetailCategoryIDLV.SelectedValue = ent.AccountPaybleStatementDetailCategoryID.ToString();
                }

                ddlACCPayableApprovalStatusIDLV.Enabled = false;
            }
        }
Beispiel #14
0
 Int64 ICMConsultantFacade.Delete(CMConsultantEntity cMConsultantEntity, String filterExpression, DatabaseOperationType option, TransactionRequired reqTran)
 {
     return(DataAccessFactory.CreateCMConsultantDataAccess().Delete(cMConsultantEntity, filterExpression, option, reqTran));
 }
Beispiel #15
0
 Int64 ICMConsultantFacade.Add(CMConsultantEntity cMConsultantEntity, DatabaseOperationType option, TransactionRequired reqTran)
 {
     return(DataAccessFactory.CreateCMConsultantDataAccess().Add(cMConsultantEntity, option, reqTran));
 }
        private Int64 UpdateTran(CMConsultantEntity cMConsultantEntity, String filterExpression, DatabaseOperationType option)
        {
            long         returnCode = -99;
            const string SP         = "dbo.CMConsultant_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, "@ConsultantID", DbType.Int64, cMConsultantEntity.ConsultantID);
                db.AddInParameter(cmd, "@MemberID", DbType.Int64, cMConsultantEntity.MemberID);
                db.AddInParameter(cmd, "@OutsourceCategoryID", DbType.Int64, cMConsultantEntity.OutsourceCategoryID);
                db.AddInParameter(cmd, "@Name", DbType.String, cMConsultantEntity.Name);
                db.AddInParameter(cmd, "@ImageUrl", DbType.String, cMConsultantEntity.ImageUrl);
                db.AddInParameter(cmd, "@CurrentPosition", DbType.String, cMConsultantEntity.CurrentPosition);
                db.AddInParameter(cmd, "@InstitueName", DbType.String, cMConsultantEntity.InstitueName);
                db.AddInParameter(cmd, "@EmailAddress1", DbType.String, cMConsultantEntity.EmailAddress1);
                db.AddInParameter(cmd, "@EmailAddress2", DbType.String, cMConsultantEntity.EmailAddress2);
                db.AddInParameter(cmd, "@ContactNo1", DbType.String, cMConsultantEntity.ContactNo1);
                db.AddInParameter(cmd, "@ContactNo2", DbType.String, cMConsultantEntity.ContactNo2);
                db.AddInParameter(cmd, "@Phone", DbType.String, cMConsultantEntity.Phone);
                db.AddInParameter(cmd, "@Remarks", DbType.String, cMConsultantEntity.Remarks);
                db.AddInParameter(cmd, "@IsRemoved", DbType.Boolean, cMConsultantEntity.IsRemoved);

                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);
        }