Beispiel #1
0
        public IList <CMMeasurementBookDetailEntity> GetPagedData(Int32 startRowIndex, Int32 pageSize, String sortExpression)
        {
            IList <CMMeasurementBookDetailEntity> cMMeasurementBookDetailEntityList = new List <CMMeasurementBookDetailEntity>();

            try
            {
                if (pageSize == -1)
                {
                    pageSize = 1000000000;
                }

                if (String.IsNullOrEmpty(sortExpression))
                {
                    sortExpression = CMMeasurementBookDetailEntity.FLD_NAME_MeasurementBookDetailID + " " + SQLConstants.SORT_ORDER_DESCENDING;
                }

                startRowIndex = Convert.ToInt32(startRowIndex / pageSize) + 1;

                cMMeasurementBookDetailEntityList = FCCCMMeasurementBookDetail.GetFacadeCreate().GetIL(startRowIndex, pageSize, sortExpression, null, DatabaseOperationType.LoadPagedWithSortExpression);

                if (cMMeasurementBookDetailEntityList != null && cMMeasurementBookDetailEntityList.Count > 0)
                {
                    totalRowCount = cMMeasurementBookDetailEntityList[0].TotalRowCount;
                }
            }
            catch (Exception ex)
            {
            }

            return(cMMeasurementBookDetailEntityList ?? new List <CMMeasurementBookDetailEntity>());
        }
Beispiel #2
0
        private void SaveCMMeasurementBookDetailEntity()
        {
            if (IsValid)
            {
                try
                {
                    CMMeasurementBookDetailEntity cMMeasurementBookDetailEntity = BuildCMMeasurementBookDetailEntity();

                    Int64 result = -1;

                    if (cMMeasurementBookDetailEntity.IsNew)
                    {
                        result = FCCCMMeasurementBookDetail.GetFacadeCreate().Add(cMMeasurementBookDetailEntity, DatabaseOperationType.Add, TransactionRequired.No);
                    }
                    else
                    {
                        String filterExpression = SqlExpressionBuilder.PrepareFilterExpression(CMMeasurementBookDetailEntity.FLD_NAME_MeasurementBookDetailID, cMMeasurementBookDetailEntity.MeasurementBookDetailID.ToString(), SQLMatchType.Equal);
                        result = FCCCMMeasurementBookDetail.GetFacadeCreate().Update(cMMeasurementBookDetailEntity, filterExpression, DatabaseOperationType.Update, TransactionRequired.No);
                    }

                    if (result > 0)
                    {
                        _MeasurementBookDetailID       = 0;
                        _CMMeasurementBookDetailEntity = new CMMeasurementBookDetailEntity();
                        PrepareInitialView();
                        BindCMMeasurementBookDetailList();

                        if (cMMeasurementBookDetailEntity.IsNew)
                        {
                            MiscUtil.ShowMessage(lblMessage, "Measurement Book Detail Information has been added successfully.", false);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Measurement Book Detail Information has been updated successfully.", false);
                        }
                    }
                    else
                    {
                        if (cMMeasurementBookDetailEntity.IsNew)
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to add Measurement Book Detail Information.", false);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to update Measurement Book Detail Information.", false);
                        }
                    }
                }
                catch (Exception ex)
                {
                    MiscUtil.ShowMessage(lblMessage, ex.Message, true);
                }
            }
        }
Beispiel #3
0
        protected void lvCMMeasurementBookDetail_ItemCommand(object sender, ListViewCommandEventArgs e)
        {
            Int64 MeasurementBookDetailID;

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

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

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

                        String fe = SqlExpressionBuilder.PrepareFilterExpression(CMMeasurementBookDetailEntity.FLD_NAME_MeasurementBookDetailID, MeasurementBookDetailID.ToString(), SQLMatchType.Equal);

                        CMMeasurementBookDetailEntity cMMeasurementBookDetailEntity = new CMMeasurementBookDetailEntity();


                        result = FCCCMMeasurementBookDetail.GetFacadeCreate().Delete(cMMeasurementBookDetailEntity, fe, DatabaseOperationType.Delete, TransactionRequired.No);

                        if (result == 0)
                        {
                            _MeasurementBookDetailID       = 0;
                            _CMMeasurementBookDetailEntity = new CMMeasurementBookDetailEntity();
                            PrepareInitialView();
                            BindCMMeasurementBookDetailList();

                            MiscUtil.ShowMessage(lblMessage, "Measurement Book Detail has been successfully deleted.", true);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to delete Measurement Book Detail.", true);
                        }
                    }
                    catch (Exception ex)
                    {
                        MiscUtil.ShowMessage(lblMessage, ex.Message, true);
                    }
                }
            }
        }
Beispiel #4
0
        public IList <CMMeasurementBookDetailEntity> GetData()
        {
            IList <CMMeasurementBookDetailEntity> cMMeasurementBookDetailEntityList = new List <CMMeasurementBookDetailEntity>();

            try
            {
                cMMeasurementBookDetailEntityList = FCCCMMeasurementBookDetail.GetFacadeCreate().GetIL(null, null, null, null, DatabaseOperationType.Load);

                if (cMMeasurementBookDetailEntityList != null && cMMeasurementBookDetailEntityList.Count > 0)
                {
                    totalRowCount = cMMeasurementBookDetailEntityList[0].TotalRowCount;
                }
            }
            catch (Exception ex)
            {
            }

            return(cMMeasurementBookDetailEntityList ?? new List <CMMeasurementBookDetailEntity>());
        }
        protected void lvCMMeasurementBookDetail_ItemCommand(object sender, ListViewCommandEventArgs e)
        {
            Int64 MeasurementBookDetailID;

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

            if (MeasurementBookDetailID > 0)
            {
                LinkButton   lnkBtnEdit        = (LinkButton)e.Item.FindControl("lnkBtnEdit");
                TextBox      txtlstDescription = (TextBox)e.Item.FindControl("txtlstDescription");
                TextBox      txtlstLengthft    = (TextBox)e.Item.FindControl("txtlstLengthft");
                TextBox      txtlstWidthft     = (TextBox)e.Item.FindControl("txtlstWidthft");
                TextBox      txtlstLengthin    = (TextBox)e.Item.FindControl("txtlstLengthin");
                TextBox      txtlstWidthin     = (TextBox)e.Item.FindControl("txtlstWidthin");
                TextBox      txtlstHeightft    = (TextBox)e.Item.FindControl("txtlstHeightft");
                TextBox      txtlstHeightin    = (TextBox)e.Item.FindControl("txtlstHeightin");
                TextBox      txtlstNos         = (TextBox)e.Item.FindControl("txtlstNos");
                TextBox      txtlstQty         = (TextBox)e.Item.FindControl("txtlstQty");
                DropDownList ddlUnitIDLV       = (DropDownList)e.Item.FindControl("ddlUnitIDLV");

                if (string.Equals(e.CommandName, "EditItem") && lnkBtnEdit.Text == "Cancel")
                {
                    txtlstDescription.Enabled = false;
                    txtlstLengthft.Enabled    = false;
                    txtlstWidthft.Enabled     = false;
                    txtlstLengthin.Enabled    = false;
                    txtlstWidthin.Enabled     = false;
                    txtlstHeightft.Enabled    = false;
                    txtlstHeightin.Enabled    = false;
                    txtlstNos.Enabled         = false;
                    ddlUnitIDLV.Enabled       = false;

                    lnkBtnEdit.Text = "Edit";
                }

                else if (string.Equals(e.CommandName, "EditItem") && lnkBtnEdit.Text == "Edit")
                {
                    _MeasurementBookDetailID = MeasurementBookDetailID;

                    txtlstDescription.Enabled = true;
                    txtlstLengthft.Enabled    = true;
                    txtlstWidthft.Enabled     = true;
                    txtlstLengthin.Enabled    = true;
                    txtlstWidthin.Enabled     = true;
                    txtlstHeightft.Enabled    = true;
                    txtlstHeightin.Enabled    = true;
                    txtlstNos.Enabled         = true;
                    ddlUnitIDLV.Enabled       = true;

                    lnkBtnEdit.Text = "Cancel";
                }

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

                        String fe = SqlExpressionBuilder.PrepareFilterExpression(CMMeasurementBookDetailEntity.FLD_NAME_MeasurementBookDetailID, MeasurementBookDetailID.ToString(), SQLMatchType.Equal);

                        CMMeasurementBookDetailEntity cMMeasurementBookDetailEntity = new CMMeasurementBookDetailEntity();


                        result = FCCCMMeasurementBookDetail.GetFacadeCreate().Delete(cMMeasurementBookDetailEntity, fe, DatabaseOperationType.Delete, TransactionRequired.No);

                        if (result == 0)
                        {
                            _MeasurementBookDetailID       = 0;
                            _CMMeasurementBookDetailEntity = new CMMeasurementBookDetailEntity();
                            PrepareInitialView();
                            BindCMMeasurementBookDetailList();

                            MiscUtil.ShowMessage(lblMessage, "Measurement Book Detail has been successfully deleted.", true);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to delete Measurement Book Detail.", true);
                        }
                    }
                    catch (Exception ex)
                    {
                        MiscUtil.ShowMessage(lblMessage, ex.Message, true);
                    }
                }
            }
            if (string.Equals(e.CommandName, "InsertItem"))
            {
                SaveCMMeasurementBookDetailEntityLV();
            }
        }
        private void SaveAllCMMeasurementBookDetailListView()
        {
            UpdateMeasurementBookFloorInfo();

            try
            {
                IList <ListViewDataItem> list = lvCMMeasurementBookDetail.Items;

                if (list != null && list.Count > 0)
                {
                    foreach (ListViewDataItem lvdi in list)
                    {
                        TextBox txtlstDescription = (TextBox)lvdi.FindControl("txtlstDescription");
                        if (txtlstDescription.Enabled)
                        {
                            Label lbllstMeasurementBookID = (Label)lvdi.FindControl("lbllstMeasurementBookID");

                            TextBox      txtlstLengthft = (TextBox)lvdi.FindControl("txtlstLengthft");
                            TextBox      txtlstLengthin = (TextBox)lvdi.FindControl("txtlstLengthin");
                            TextBox      txtlstWidthft  = (TextBox)lvdi.FindControl("txtlstWidthft");
                            TextBox      txtlstWidthin  = (TextBox)lvdi.FindControl("txtlstWidthin");
                            TextBox      txtlstHeightft = (TextBox)lvdi.FindControl("txtlstHeightft");
                            TextBox      txtlstHeightin = (TextBox)lvdi.FindControl("txtlstHeightin");
                            TextBox      txtlstNos      = (TextBox)lvdi.FindControl("txtlstNos");
                            TextBox      txtlstQty      = (TextBox)lvdi.FindControl("txtlstQty");
                            DropDownList ddlUnitIDLV    = (DropDownList)lvdi.FindControl("ddlUnitIDLV");

                            Decimal LengthftLV, LengthinLV, WidthftLV, WidthinLV, HeightftLV, HeightinLV, NosLV;

                            Decimal.TryParse(txtlstLengthft.Text.Trim(), out LengthftLV);
                            Decimal.TryParse(txtlstLengthin.Text.Trim(), out LengthinLV);
                            Decimal.TryParse(txtlstWidthft.Text.Trim(), out WidthftLV);
                            Decimal.TryParse(txtlstWidthin.Text.Trim(), out WidthinLV);
                            Decimal.TryParse(txtlstHeightft.Text.Trim(), out HeightftLV);
                            Decimal.TryParse(txtlstHeightin.Text.Trim(), out HeightinLV);
                            Decimal.TryParse(txtlstNos.Text.Trim(), out NosLV);

                            CMMeasurementBookDetailEntity cMMeasurementBookDetailEntity = new CMMeasurementBookDetailEntity();

                            cMMeasurementBookDetailEntity.Description       = txtlstDescription.Text.ToString();
                            cMMeasurementBookDetailEntity.Lengthft          = LengthftLV;
                            cMMeasurementBookDetailEntity.Lenghtin          = LengthinLV;
                            cMMeasurementBookDetailEntity.Widthft           = WidthftLV;
                            cMMeasurementBookDetailEntity.Widthin           = WidthinLV;
                            cMMeasurementBookDetailEntity.Heightft          = HeightftLV;
                            cMMeasurementBookDetailEntity.Heightin          = HeightinLV;
                            cMMeasurementBookDetailEntity.MeasurementBookID = CMMeasurementBookID;

                            LengthinLV = Math.Round(LengthinLV / 12, 2);
                            WidthinLV  = Math.Round(WidthinLV / 12, 2);
                            HeightinLV = Math.Round(HeightinLV / 12, 2);
                            Decimal QtyLV;

                            QtyLV = (LengthftLV + LengthinLV) * (WidthftLV + WidthinLV) * NosLV;
                            QtyLV = Math.Round(QtyLV, 4);

                            if (ddlUnitIDLV != null && ddlUnitIDLV.SelectedValue != "0")
                            {
                                cMMeasurementBookDetailEntity.UnitID = Int64.Parse(ddlUnitIDLV.SelectedValue.ToString());
                            }
                            cMMeasurementBookDetailEntity.Nos = NosLV;
                            cMMeasurementBookDetailEntity.Qty = QtyLV;

                            String fe = SqlExpressionBuilder.PrepareFilterExpression(CMMeasurementBookDetailEntity.FLD_NAME_MeasurementBookDetailID, lbllstMeasurementBookID.Text.ToString(), SQLMatchType.Equal);
                            FCCCMMeasurementBookDetail.GetFacadeCreate().Update(cMMeasurementBookDetailEntity, fe, DatabaseOperationType.Update, TransactionRequired.No);
                        }
                    }
                }
                BindCMMeasurementBookDetailList();
                MiscUtil.ShowMessage(lblMessage, "Measurement Book Detail Information has been saved successfully.", false);
            }

            catch (Exception ex)
            {
                MiscUtil.ShowMessage(lblMessage, "Failed to save Measurment Book Detail Information.", true);
            }
        }
        private void SaveCMMeasurementBookDetailEntityLV()
        {
            try
            {
                UpdateMeasurementBookFloorInfo();

                ListViewItem list = lvCMMeasurementBookDetail.InsertItem;

                TextBox      txtDescriptionLV = (TextBox)list.FindControl("txtDescriptionLV");
                TextBox      txtLengthftLV    = (TextBox)list.FindControl("txtLengthftLV");
                TextBox      txtLenghtinLV    = (TextBox)list.FindControl("txtLenghtinLV");
                TextBox      txtWidthinLV     = (TextBox)list.FindControl("txtWidthinLV");
                TextBox      txtWidthftLV     = (TextBox)list.FindControl("txtWidthftLV");
                TextBox      txtHeightftLV    = (TextBox)list.FindControl("txtHeightftLV");
                TextBox      txtHeightinLV    = (TextBox)list.FindControl("txtHeightinLV");
                TextBox      txtNosLV         = (TextBox)list.FindControl("txtNosLV");
                DropDownList ddlUnitIDInsert  = (DropDownList)list.FindControl("ddlUnitIDInsert");

                Decimal LengthftLV, LengthinLV, WidthftLV, WidthinLV, HeightftLV, HeightinLV, NosLV;

                Decimal.TryParse(txtLengthftLV.Text.Trim(), out LengthftLV);
                Decimal.TryParse(txtLenghtinLV.Text.Trim(), out LengthinLV);
                Decimal.TryParse(txtWidthinLV.Text.Trim(), out WidthftLV);
                Decimal.TryParse(txtWidthftLV.Text.Trim(), out WidthinLV);
                Decimal.TryParse(txtHeightftLV.Text.Trim(), out HeightftLV);
                Decimal.TryParse(txtHeightinLV.Text.Trim(), out HeightinLV);
                Decimal.TryParse(txtNosLV.Text.Trim(), out NosLV);

                CMMeasurementBookDetailEntity cMMeasurementBookDetailEntity = new CMMeasurementBookDetailEntity();

                cMMeasurementBookDetailEntity.Description = txtDescriptionLV.Text.ToString();

                if (!txtLengthftLV.Text.Trim().IsNullOrEmpty())
                {
                    cMMeasurementBookDetailEntity.Lengthft = LengthftLV;
                }
                else
                {
                    cMMeasurementBookDetailEntity.Lengthft = null;
                }

                if (!txtLenghtinLV.Text.Trim().IsNullOrEmpty())
                {
                    cMMeasurementBookDetailEntity.Lenghtin = LengthinLV;
                }
                else
                {
                    cMMeasurementBookDetailEntity.Lenghtin = null;
                }

                if (!txtWidthftLV.Text.Trim().IsNullOrEmpty())
                {
                    cMMeasurementBookDetailEntity.Widthft = WidthftLV;
                }
                else
                {
                    cMMeasurementBookDetailEntity.Widthft = null;
                }

                if (!txtWidthinLV.Text.Trim().IsNullOrEmpty())
                {
                    cMMeasurementBookDetailEntity.Widthin = WidthinLV;
                }
                else
                {
                    cMMeasurementBookDetailEntity.Widthin = null;
                }

                if (!txtHeightftLV.Text.Trim().IsNullOrEmpty())
                {
                    cMMeasurementBookDetailEntity.Heightft = HeightftLV;
                }
                else
                {
                    cMMeasurementBookDetailEntity.Heightft = null;
                }

                if (!txtHeightinLV.Text.Trim().IsNullOrEmpty())
                {
                    cMMeasurementBookDetailEntity.Heightin = HeightinLV;
                }
                else
                {
                    cMMeasurementBookDetailEntity.Heightin = null;
                }

                cMMeasurementBookDetailEntity.MeasurementBookID = CMMeasurementBookID;

                LengthinLV = Math.Round(LengthinLV / 12, 2);
                WidthinLV  = Math.Round(WidthinLV / 12, 2);
                HeightinLV = Math.Round(HeightinLV / 12, 2);
                Decimal QtyLV;

                QtyLV = (LengthftLV + LengthinLV) * (WidthftLV + WidthinLV) * NosLV;
                QtyLV = Math.Round(QtyLV, 4);

                cMMeasurementBookDetailEntity.UnitID = Int64.Parse(ddlUnitIDInsert.SelectedValue.ToString());
                cMMeasurementBookDetailEntity.Nos    = NosLV;
                cMMeasurementBookDetailEntity.Qty    = QtyLV;

                Int64 result = -1;

                result = FCCCMMeasurementBookDetail.GetFacadeCreate().Add(cMMeasurementBookDetailEntity, DatabaseOperationType.Add, TransactionRequired.No);

                MiscUtil.ShowMessage(lblMessage, "Measurement Book Detail Information has been saved successfully.", false);
                BindCMMeasurementBookDetailList();
            }
            catch (Exception ex)
            {
                MiscUtil.ShowMessage(lblMessage, "Failed to save Measurement Book Detail Information.", true);
            }
        }