Int64 IMDItemDefaultDataAccess.Add(MDItemDefaultEntity mDItemDefaultEntity, DatabaseOperationType option, TransactionRequired reqTran)
        {
            try
            {
                long retValues = -99;

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

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

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

                return(retValues);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        Int64 IMDItemDefaultDataAccess.Delete(MDItemDefaultEntity mDItemDefaultEntity, String filterExpression, DatabaseOperationType option, TransactionRequired reqTran)
        {
            try
            {
                long retValues = -99;

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

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

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

                return(retValues);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        private Int64 UpdateTran(MDItemDefaultEntity mDItemDefaultEntity, String filterExpression, DatabaseOperationType option)
        {
            long         returnCode = -99;
            const string SP         = "dbo.MDItemDefault_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, "@ItemDefaultID", DbType.Int64, mDItemDefaultEntity.ItemDefaultID);
                db.AddInParameter(cmd, "@ItemID", DbType.Int64, mDItemDefaultEntity.ItemID);
                db.AddInParameter(cmd, "@BrandID", DbType.Int64, mDItemDefaultEntity.BrandID);
                db.AddInParameter(cmd, "@SupplierID", DbType.Int64, mDItemDefaultEntity.SupplierID);
                db.AddInParameter(cmd, "@RegionID", DbType.Int64, mDItemDefaultEntity.RegionID);
                db.AddInParameter(cmd, "@CountryID", DbType.Int64, mDItemDefaultEntity.CountryID);

                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);
        }
Exemplo n.º 4
0
        private void SaveMDItemDefaultEntity()
        {
            if (IsValid)
            {
                try
                {
                    MDItemDefaultEntity mDItemDefaultEntity = BuildMDItemDefaultEntity();

                    Int64 result = -1;

                    if (mDItemDefaultEntity.IsNew)
                    {
                        result = FCCMDItemDefault.GetFacadeCreate().Add(mDItemDefaultEntity, DatabaseOperationType.Add, TransactionRequired.No);
                    }
                    else
                    {
                        String filterExpression = SqlExpressionBuilder.PrepareFilterExpression(MDItemDefaultEntity.FLD_NAME_ItemDefaultID, mDItemDefaultEntity.ItemDefaultID.ToString(), SQLMatchType.Equal);
                        result = FCCMDItemDefault.GetFacadeCreate().Update(mDItemDefaultEntity, filterExpression, DatabaseOperationType.Update, TransactionRequired.No);
                    }

                    if (result > 0)
                    {
                        _ItemDefaultID       = 0;
                        _MDItemDefaultEntity = new MDItemDefaultEntity();
                        PrepareInitialView();
                        BindMDItemDefaultList();

                        if (mDItemDefaultEntity.IsNew)
                        {
                            MiscUtil.ShowMessage(lblMessage, "Item Default Information has been added successfully.", false);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Item Default Information has been updated successfully.", false);
                        }
                    }
                    else
                    {
                        if (mDItemDefaultEntity.IsNew)
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to add Item Default Information.", false);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to update Item Default Information.", false);
                        }
                    }
                }
                catch (Exception ex)
                {
                    MiscUtil.ShowMessage(lblMessage, ex.Message, true);
                }
            }
        }
Exemplo n.º 5
0
        private MDItemDefaultEntity BuildMDItemDefaultEntity()
        {
            MDItemDefaultEntity mDItemDefaultEntity = CurrentMDItemDefaultEntity;

            if (ddlBrandID.Items.Count > 0)
            {
                if (ddlBrandID.SelectedValue == "0")
                {
                }
                else
                {
                    mDItemDefaultEntity.BrandID = Int64.Parse(ddlBrandID.SelectedValue);
                }
            }

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

            if (ddlRegionID.Items.Count > 0)
            {
                if (ddlRegionID.SelectedValue == "0")
                {
                }
                else
                {
                    mDItemDefaultEntity.RegionID = Int64.Parse(ddlRegionID.SelectedValue);
                }
            }

            if (ddlCountryID.Items.Count > 0)
            {
                if (ddlCountryID.SelectedValue == "0")
                {
                }
                else
                {
                    mDItemDefaultEntity.CountryID = Int64.Parse(ddlCountryID.SelectedValue);
                }
            }


            return(mDItemDefaultEntity);
        }
Exemplo n.º 6
0
        protected void lvMDItemDefault_ItemCommand(object sender, ListViewCommandEventArgs e)
        {
            Int64 ItemDefaultID;

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

            if (ItemDefaultID > 0)
            {
                if (string.Equals(e.CommandName, "EditItem"))
                {
                    _ItemDefaultID = ItemDefaultID;

                    PrepareEditView();

                    cpeEditor.Collapsed   = false;
                    cpeEditor.ClientState = "false";
                }
                else if (string.Equals(e.CommandName, "DeleteItem"))
                {
                    try
                    {
                        Int64 result = -1;

                        String fe = SqlExpressionBuilder.PrepareFilterExpression(MDItemDefaultEntity.FLD_NAME_ItemDefaultID, ItemDefaultID.ToString(), SQLMatchType.Equal);

                        MDItemDefaultEntity mDItemDefaultEntity = new MDItemDefaultEntity();


                        result = FCCMDItemDefault.GetFacadeCreate().Delete(mDItemDefaultEntity, fe, DatabaseOperationType.Delete, TransactionRequired.No);

                        if (result == 0)
                        {
                            _ItemDefaultID       = 0;
                            _MDItemDefaultEntity = new MDItemDefaultEntity();
                            PrepareInitialView();
                            BindMDItemDefaultList();

                            MiscUtil.ShowMessage(lblMessage, "Item Default has been successfully deleted.", true);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to delete Item Default.", true);
                        }
                    }
                    catch (Exception ex)
                    {
                        MiscUtil.ShowMessage(lblMessage, ex.Message, true);
                    }
                }
            }
        }
        private Int64 Update(MDItemDefaultEntity mDItemDefaultEntity, String filterExpression, DatabaseOperationType option)
        {
            long         returnCode = -99;
            const string SP         = "dbo.MDItemDefault_SET";

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

                Database.AddInParameter(cmd, "@ItemDefaultID", DbType.Int64, mDItemDefaultEntity.ItemDefaultID);
                Database.AddInParameter(cmd, "@ItemID", DbType.Int64, mDItemDefaultEntity.ItemID);
                Database.AddInParameter(cmd, "@BrandID", DbType.Int64, mDItemDefaultEntity.BrandID);
                Database.AddInParameter(cmd, "@SupplierID", DbType.Int64, mDItemDefaultEntity.SupplierID);
                Database.AddInParameter(cmd, "@RegionID", DbType.Int64, mDItemDefaultEntity.RegionID);
                Database.AddInParameter(cmd, "@CountryID", DbType.Int64, mDItemDefaultEntity.CountryID);

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

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

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

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

            return(returnCode);
        }
Exemplo n.º 8
0
        private void PrepareEditView()
        {
            MDItemDefaultEntity mDItemDefaultEntity = CurrentMDItemDefaultEntity;


            if (!mDItemDefaultEntity.IsNew)
            {
                if (ddlItemID.Items.Count > 0 && mDItemDefaultEntity.ItemID != null)
                {
                    ddlItemID.SelectedValue = mDItemDefaultEntity.ItemID.ToString();
                }

                if (ddlBrandID.Items.Count > 0 && mDItemDefaultEntity.BrandID != null)
                {
                    ddlBrandID.SelectedValue = mDItemDefaultEntity.BrandID.ToString();
                }

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

                if (ddlRegionID.Items.Count > 0 && mDItemDefaultEntity.RegionID != null)
                {
                    ddlRegionID.SelectedValue = mDItemDefaultEntity.RegionID.ToString();
                }

                if (ddlCountryID.Items.Count > 0 && mDItemDefaultEntity.CountryID != null)
                {
                    ddlCountryID.SelectedValue = mDItemDefaultEntity.CountryID.ToString();
                }


                btnSubmit.Text    = "Update";
                btnAddNew.Visible = true;
            }
        }
Exemplo n.º 9
0
        private void DeleteItem()
        {
            Int64 ItemID;

            Int64.TryParse(treeItem.SelectedValue, out ItemID);

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

                    String fe = SqlExpressionBuilder.PrepareFilterExpression(MDItemEntity.FLD_NAME_ItemID, ItemID.ToString(), SQLMatchType.Equal);

                    MDItemEntity mDItemEntity = new MDItemEntity();

                    #region Item Brand Map

                    String fe1 = SqlExpressionBuilder.PrepareFilterExpression(PRMItemBrandMapEntity.FLD_NAME_ItemID, ItemID.ToString(), SQLMatchType.Equal);
                    PRMItemBrandMapEntity prmItemBrandMap = new PRMItemBrandMapEntity();
                    FCCPRMItemBrandMap.GetFacadeCreate().Delete(prmItemBrandMap, fe, DatabaseOperationType.Delete, TransactionRequired.No);

                    #endregion

                    #region Item Default

                    String fe2 = SqlExpressionBuilder.PrepareFilterExpression(MDItemDefaultEntity.FLD_NAME_ItemID, ItemID.ToString(), SQLMatchType.Equal);
                    MDItemDefaultEntity mDItemDefaultEntity = new MDItemDefaultEntity();
                    FCCMDItemDefault.GetFacadeCreate().Delete(mDItemDefaultEntity, fe2, DatabaseOperationType.Delete, TransactionRequired.No);

                    #endregion

                    #region Item Thumb Rule

                    String fe3 = SqlExpressionBuilder.PrepareFilterExpression(MDItemThumbRuleEntity.FLD_NAME_ItemID, ItemID.ToString(), SQLMatchType.Equal);
                    MDItemThumbRuleEntity mDItemThumbRuleEntity = new MDItemThumbRuleEntity();
                    result = FCCMDItemThumbRule.GetFacadeCreate().Delete(mDItemThumbRuleEntity, fe3, DatabaseOperationType.Delete, TransactionRequired.No);

                    #endregion

                    result = FCCMDItem.GetFacadeCreate().Delete(mDItemEntity, fe, DatabaseOperationType.Delete, TransactionRequired.No);

                    if (result == 0)
                    {
                        _ItemID       = 0;
                        _MDItemEntity = new MDItemEntity();

                        // clearing cache
                        FCCMDItem.GetFacadeCreate().RemoveCache();

                        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);
                }
            }
        }
Exemplo n.º 10
0
        private void SaveMDItemEntity()
        {
            if (IsValid)
            {
                try
                {
                    Boolean addInputValidation = true;

                    MDItemEntity mDItemEntity = BuildMDItemEntity();

                    Int64 result = -1;

                    if (mDItemEntity.IsNew)
                    {
                        if (ValidateInput())
                        {
                            if (treeItem.SelectedNode != null)
                            {
                                mDItemEntity.ItemCategoryID = Int64.Parse(treeItem.SelectedValue);
                            }

                            result = FCCMDItem.GetFacadeCreate().Add(mDItemEntity, DatabaseOperationType.Add, TransactionRequired.No);
                        }
                        else
                        {
                            addInputValidation = false;
                        }
                    }
                    else
                    {
                        String filterExpression = SqlExpressionBuilder.PrepareFilterExpression(MDItemEntity.FLD_NAME_ItemID, mDItemEntity.ItemID.ToString(), SQLMatchType.Equal);
                        result = FCCMDItem.GetFacadeCreate().Update(mDItemEntity, filterExpression, DatabaseOperationType.Update, TransactionRequired.No);
                    }

                    if (addInputValidation == true)
                    {
                        if (result > 0)
                        {
                            #region Item Brand Map

                            ViewState["LastUpdatedItemID"] = result;

                            try
                            {
                                IList <PRMItemBrandMapEntity> newMappedItems = new List <PRMItemBrandMapEntity>();

                                foreach (ListItem chbxItem in chbxItemBrand.Items)
                                {
                                    if (chbxItem.Selected)
                                    {
                                        PRMItemBrandMapEntity mDItemBrandMapEntity = new PRMItemBrandMapEntity();
                                        mDItemBrandMapEntity.ItemID  = result;
                                        mDItemBrandMapEntity.BrandID = Int64.Parse(chbxItem.Value.ToString());
                                        newMappedItems.Add(mDItemBrandMapEntity);
                                    }
                                }

                                IList <PRMItemBrandMapEntity> deleteList = _CurrentItemBrandMapList.Except(newMappedItems, new CustomerComparer()).ToList();
                                IList <PRMItemBrandMapEntity> addNewList = newMappedItems.Except(_CurrentItemBrandMapList, new CustomerComparer()).ToList();

                                if (deleteList != null && deleteList.Count > 0)
                                {
                                    foreach (PRMItemBrandMapEntity ent in deleteList)
                                    {
                                        String fe1 = SqlExpressionBuilder.PrepareFilterExpression(PRMItemBrandMapEntity.FLD_NAME_ItemID, ent.ItemID.ToString(), SQLMatchType.Equal);
                                        String fe2 = SqlExpressionBuilder.PrepareFilterExpression(PRMItemBrandMapEntity.FLD_NAME_BrandID, ent.BrandID.ToString(), SQLMatchType.Equal);
                                        String fe  = SqlExpressionBuilder.PrepareFilterExpression(fe1, SQLJoinType.AND, fe2);

                                        FCCPRMItemBrandMap.GetFacadeCreate().Delete(ent, fe, DatabaseOperationType.Delete, TransactionRequired.No);
                                    }
                                }

                                if (addNewList != null && addNewList.Count > 0)
                                {
                                    foreach (PRMItemBrandMapEntity ent in addNewList)
                                    {
                                        FCCPRMItemBrandMap.GetFacadeCreate().Add(ent, DatabaseOperationType.Add, TransactionRequired.No);
                                    }
                                }

                                String feCurrent = SqlExpressionBuilder.PrepareFilterExpression(PRMItemBrandMapEntity.FLD_NAME_ItemID, result.ToString(), SQLMatchType.Equal);
                                IList <PRMItemBrandMapEntity> ItemBrandList = FCCPRMItemBrandMap.GetFacadeCreate().GetIL(null, null, String.Empty, feCurrent, DatabaseOperationType.LoadWithFilterExpression);
                                _CurrentItemBrandMapList = ItemBrandList;

                                if (ddlBrandID.Items.Count > 0 && ddlBrandID.SelectedValue != MasterDataConstants.ItemDefaults.DEFAULT_BRAD.ToString())
                                {
                                    Boolean isNeedToInsert = false;

                                    if (ItemBrandList != null && ItemBrandList.Count > 0)
                                    {
                                        PRMItemBrandMapEntity itemBrandInfo = (from s in ItemBrandList
                                                                               where s.BrandID.ToString() == ddlBrandID.SelectedValue
                                                                               select s).FirstOrDefault();
                                        if (itemBrandInfo == null)
                                        {
                                            isNeedToInsert = true;
                                        }
                                    }
                                    else
                                    {
                                        isNeedToInsert = true;
                                    }

                                    if (isNeedToInsert)
                                    {
                                        PRMItemBrandMapEntity pRMItemBrandMapEntity = new PRMItemBrandMapEntity();
                                        pRMItemBrandMapEntity.BrandID = Int64.Parse(ddlBrandID.SelectedValue);
                                        pRMItemBrandMapEntity.ItemID  = result;

                                        FCCPRMItemBrandMap.GetFacadeCreate().Add(pRMItemBrandMapEntity, DatabaseOperationType.Add, TransactionRequired.No);
                                    }
                                }
                            }
                            catch (Exception ex)
                            {
                                MiscUtil.ShowMessage(lblMessage, ex.Message, true);
                            }


                            #endregion

                            #region Item Defaults

                            MDItemDefaultEntity mDItemDefaultEntity = BuildMDItemDefaultEntity();

                            mDItemDefaultEntity.ItemID = result;

                            if (mDItemDefaultEntity.IsNew)
                            {
                                FCCMDItemDefault.GetFacadeCreate().Add(mDItemDefaultEntity, DatabaseOperationType.Add, TransactionRequired.No);
                            }
                            else
                            {
                                String filterExpression = SqlExpressionBuilder.PrepareFilterExpression(MDItemDefaultEntity.FLD_NAME_ItemDefaultID, mDItemDefaultEntity.ItemDefaultID.ToString(), SQLMatchType.Equal);
                                FCCMDItemDefault.GetFacadeCreate().Update(mDItemDefaultEntity, filterExpression, DatabaseOperationType.Update, TransactionRequired.No);
                            }

                            #endregion

                            //#region Item Thumb Rule

                            //MDItemThumbRuleEntity mDItemThumbRuleEntity = BuildMDItemThumbRuleEntity();

                            //mDItemThumbRuleEntity.ItemID = result;

                            //if (mDItemThumbRuleEntity.IsNew)
                            //{
                            //    result = FCCMDItemThumbRule.GetFacadeCreate().Add(mDItemThumbRuleEntity, DatabaseOperationType.Add, TransactionRequired.No);
                            //}
                            //else
                            //{
                            //    String filterExpression = SqlExpressionBuilder.PrepareFilterExpression(MDItemThumbRuleEntity.FLD_NAME_MDItemThumbRuleID, mDItemThumbRuleEntity.MDItemThumbRuleID.ToString(), SQLMatchType.Equal);
                            //    result = FCCMDItemThumbRule.GetFacadeCreate().Update(mDItemThumbRuleEntity, filterExpression, DatabaseOperationType.Update, TransactionRequired.No);
                            //}

                            //#endregion

                            //if (mDItemEntity.IsNew)
                            //{
                            //    if (Roles.IsUserInRole(this.Page.User.Identity.Name, "Admin") == true || Roles.IsUserInRole(this.Page.User.Identity.Name, "Engineer") || Roles.IsUserInRole(this.Page.User.Identity.Name, "MIS") == true)
                            //    {
                            //        lblItemName.Text = mDItemEntity.ItemName.ToString();
                            //        this.Panel2_ModalPopupExtender.Show();
                            //    }
                            //}

                            _ItemID       = 0;
                            _MDItemEntity = new MDItemEntity();

                            // clearing cache
                            FCCMDItem.GetFacadeCreate().RemoveCache();

                            PrepareInitialView();

                            LoadTreeView();

                            if (mDItemEntity.IsNew)
                            {
                                MiscUtil.ShowMessage(lblMessage, "Item Information has been added successfully.", false);
                            }
                            else
                            {
                                MiscUtil.ShowMessage(lblMessage, "Item Information has been updated successfully.", false);
                            }
                        }
                        else
                        {
                            if (mDItemEntity.IsNew)
                            {
                                MiscUtil.ShowMessage(lblMessage, "Failed to add Item Information.", false);
                            }
                            else
                            {
                                MiscUtil.ShowMessage(lblMessage, "Failed to update Item Information.", false);
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                    MiscUtil.ShowMessage(lblMessage, ex.Message, true);
                }
            }
        }
Exemplo n.º 11
0
        private void PrepareEditView()
        {
            MDItemEntity mDItemEntity = CurrentMDItemEntity;


            if (!mDItemEntity.IsNew)
            {
                #region Item

                txtItemName.Text = mDItemEntity.ItemName.ToString();

                if (ddlUnitID.Items.Count > 0 && mDItemEntity.UnitID != null)
                {
                    ddlUnitID.SelectedValue = mDItemEntity.UnitID.ToString();
                }

                txtDescription.Text  = mDItemEntity.Description.ToString();
                chkIsRemoved.Checked = mDItemEntity.IsRemoved;

                btnSubmit.Text    = "Update";
                btnAddNew.Visible = true;

                #endregion

                #region Item Default

                MDItemDefaultEntity mDItemDefaultEntity = CurrentMDItemDefaultEntity;

                if (!mDItemDefaultEntity.IsNew)
                {
                    if (ddlBrandID.Items.Count > 0 && mDItemDefaultEntity.BrandID != null)
                    {
                        ddlBrandID.SelectedValue = mDItemDefaultEntity.BrandID.ToString();
                    }

                    BuildSupplierByBrand();

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

                    if (ddlRegionID.Items.Count > 0 && mDItemDefaultEntity.RegionID != null)
                    {
                        ddlRegionID.SelectedValue = mDItemDefaultEntity.RegionID.ToString();
                    }

                    BuildCountryDropdownByRegion();

                    if (ddlCountryID.Items.Count > 0 && mDItemDefaultEntity.CountryID != null)
                    {
                        ddlCountryID.SelectedValue = mDItemDefaultEntity.CountryID.ToString();
                    }
                }
                else
                {
                    PrepareInitialViewItemDefault();
                }

                #endregion

                #region Item Brand Map

                if (treeItem.SelectedNode.Depth == 2)
                {
                    String fe = SqlExpressionBuilder.PrepareFilterExpression(PRMItemBrandMapEntity.FLD_NAME_ItemID, treeItem.SelectedValue.ToString(), SQLMatchType.Equal);
                    IList <PRMItemBrandMapEntity> ItemBrandList = FCCPRMItemBrandMap.GetFacadeCreate().GetIL(null, null, String.Empty, fe, DatabaseOperationType.LoadWithFilterExpression);
                    _CurrentItemBrandMapList = ItemBrandList;

                    if (ItemBrandList != null && ItemBrandList.Count > 0)
                    {
                        foreach (PRMItemBrandMapEntity ent in ItemBrandList)
                        {
                            foreach (ListItem chbxItem in chbxItemBrand.Items)
                            {
                                if (ent.BrandID.ToString() == chbxItem.Value.ToString())
                                {
                                    chbxItem.Selected = true;
                                    break;
                                }
                            }
                        }
                        IList <PRMItemBrandMapEntity> TempitemBrandList = new List <PRMItemBrandMapEntity>();
                        if (_CurrentItemBrandMapList != null && _CurrentItemBrandMapList.Count > 0)
                        {
                            foreach (MDBrandEntity ent in _CurrentItemBrandList)
                            {
                                PRMItemBrandMapEntity mDItemBrandEntity = new PRMItemBrandMapEntity();
                                mDItemBrandEntity.BrandID = ent.BrandID;
                                TempitemBrandList.Add(mDItemBrandEntity);
                            }

                            IList <PRMItemBrandMapEntity> uncheckedList = TempitemBrandList.Except(_CurrentItemBrandMapList, new CustomerComparerAnother()).ToList();

                            if (uncheckedList != null && uncheckedList.Count > 0)
                            {
                                foreach (PRMItemBrandMapEntity ent in uncheckedList)
                                {
                                    foreach (ListItem chbxItem in chbxItemBrand.Items)
                                    {
                                        if (ent.BrandID.ToString() == chbxItem.Value.ToString())
                                        {
                                            chbxItem.Selected = false;
                                        }
                                    }
                                }
                            }
                        }
                    }
                    else
                    {
                        foreach (ListItem chbxItem in chbxItemBrand.Items)
                        {
                            chbxItem.Selected = false;
                        }
                    }
                }

                #endregion

                #region Item Thumb Rule

                MDItemThumbRuleEntity mDItemThumbRuleEntity = CurrentMDItemThumbRuleEntity;

                if (!mDItemThumbRuleEntity.IsNew)
                {
                    txtFloorRuleVariable.Text    = mDItemThumbRuleEntity.FloorRuleVariable.ToString();
                    txtFloorQuantity.Text        = mDItemThumbRuleEntity.FloorQuantity.ToString();
                    txtBasementRuleVariable.Text = mDItemThumbRuleEntity.BasementRuleVariable.ToString();
                    txtBasementQuantity.Text     = mDItemThumbRuleEntity.BasementQuantity.ToString();
                    txtOverallRuleVariable.Text  = mDItemThumbRuleEntity.OverallRuleVariable.ToString();
                    txtOverallQuantity.Text      = mDItemThumbRuleEntity.OverallQuantity.ToString();
                }
                else
                {
                    PrepareInitialViewItemThumbRule();
                }
                #endregion
            }
        }
Exemplo n.º 12
0
 Int64 IMDItemDefaultFacade.Delete(MDItemDefaultEntity mDItemDefaultEntity, String filterExpression, DatabaseOperationType option, TransactionRequired reqTran)
 {
     return(DataAccessFactory.CreateMDItemDefaultDataAccess().Delete(mDItemDefaultEntity, filterExpression, option, reqTran));
 }
Exemplo n.º 13
0
 Int64 IMDItemDefaultFacade.Add(MDItemDefaultEntity mDItemDefaultEntity, DatabaseOperationType option, TransactionRequired reqTran)
 {
     return(DataAccessFactory.CreateMDItemDefaultDataAccess().Add(mDItemDefaultEntity, option, reqTran));
 }
Exemplo n.º 14
0
 protected void btnAddNew_Click(object sender, EventArgs e)
 {
     _ItemDefaultID       = 0;
     _MDItemDefaultEntity = new MDItemDefaultEntity();
     PrepareInitialView();
 }