Esempio n. 1
0
        private void PrepareEditView()
        {
            String fe = SqlExpressionBuilder.PrepareFilterExpression(PRMPreBOQTemplateItemMapEntity.FLD_NAME_PreBOQTemplateID, PreBOQTemplateID.ToString(), SQLMatchType.Equal);

            currentMappedItems = FCCPRMPreBOQTemplateItemMap.GetFacadeCreate().GetIL(null, null, String.Empty, fe, DatabaseOperationType.LoadWithFilterExpression);

            if (currentMappedItems == null)
            {
                currentMappedItems = new List <PRMPreBOQTemplateItemMapEntity>();
            }
        }
        protected void lvPRMPreBOQTemplate_ItemCommand(object sender, ListViewCommandEventArgs e)
        {
            Int64 PreBOQTemplateID;

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

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

                    PrepareEditView();

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

                        String fe = SqlExpressionBuilder.PrepareFilterExpression(PRMPreBOQTemplateEntity.FLD_NAME_PreBOQTemplateID, PreBOQTemplateID.ToString(), SQLMatchType.Equal);

                        PRMPreBOQTemplateEntity pRMPreBOQTemplateEntity = new PRMPreBOQTemplateEntity();


                        result = FCCPRMPreBOQTemplate.GetFacadeCreate().Delete(pRMPreBOQTemplateEntity, fe, DatabaseOperationType.Delete, TransactionRequired.No);

                        if (result == 0)
                        {
                            _PreBOQTemplateID        = 0;
                            _PRMPreBOQTemplateEntity = new PRMPreBOQTemplateEntity();
                            PrepareInitialView();
                            BindPRMPreBOQTemplateList();

                            MiscUtil.ShowMessage(lblMessage, "BOQ Template has been successfully deleted.", true);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to delete BOQ Template.", true);
                        }
                    }
                    catch (Exception ex)
                    {
                        MiscUtil.ShowMessage(lblMessage, ex.Message, true);
                    }
                }
            }
        }