Exemplo n.º 1
0
        Int64 IKBUserTreeModifiedHistoryDataAccess.Add(KBUserTreeModifiedHistoryEntity kBUserTreeModifiedHistoryEntity, DatabaseOperationType option, TransactionRequired reqTran)
        {
            try
            {
                long retValues = -99;

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

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

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

                return(retValues);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemplo n.º 2
0
        private Int64 Update(KBUserTreeModifiedHistoryEntity kBUserTreeModifiedHistoryEntity, String filterExpression, DatabaseOperationType option)
        {
            long         returnCode = -99;
            const string SP         = "dbo.KBUserTreeModifiedHistory_SET";

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

                Database.AddInParameter(cmd, "@UserTreeHistoryID", DbType.Int64, kBUserTreeModifiedHistoryEntity.UserTreeHistoryID);
                Database.AddInParameter(cmd, "@UserTreeID", DbType.Int64, kBUserTreeModifiedHistoryEntity.UserTreeID);
                Database.AddInParameter(cmd, "@IsDocumentNodeType", DbType.Boolean, kBUserTreeModifiedHistoryEntity.IsDocumentNodeType);
                Database.AddInParameter(cmd, "@Title", DbType.String, kBUserTreeModifiedHistoryEntity.Title);
                Database.AddInParameter(cmd, "@Description", DbType.String, kBUserTreeModifiedHistoryEntity.Description);
                Database.AddInParameter(cmd, "@ReferenceID", DbType.Int64, kBUserTreeModifiedHistoryEntity.ReferenceID);
                Database.AddInParameter(cmd, "@TagKeyword", DbType.String, kBUserTreeModifiedHistoryEntity.TagKeyword);
                Database.AddInParameter(cmd, "@IsStarred", DbType.Boolean, kBUserTreeModifiedHistoryEntity.IsStarred);
                Database.AddInParameter(cmd, "@CreatedByEmployeeID", DbType.Int64, kBUserTreeModifiedHistoryEntity.CreatedByEmployeeID);
                Database.AddInParameter(cmd, "@CreateDate", DbType.DateTime, kBUserTreeModifiedHistoryEntity.CreateDate);
                Database.AddInParameter(cmd, "@OwnerEmployeeID", DbType.Int64, kBUserTreeModifiedHistoryEntity.OwnerEmployeeID);
                Database.AddInParameter(cmd, "@DocumentSize", DbType.Decimal, kBUserTreeModifiedHistoryEntity.DocumentSize);
                Database.AddInParameter(cmd, "@LastModifiedDate", DbType.DateTime, kBUserTreeModifiedHistoryEntity.LastModifiedDate);
                Database.AddInParameter(cmd, "@UserTreeStatusID", DbType.Int64, kBUserTreeModifiedHistoryEntity.UserTreeStatusID);
                Database.AddInParameter(cmd, "@CountViewState", DbType.Int64, kBUserTreeModifiedHistoryEntity.CountViewState);
                Database.AddInParameter(cmd, "@ModifiedDate", DbType.DateTime, kBUserTreeModifiedHistoryEntity.ModifiedDate);
                Database.AddInParameter(cmd, "@ModifiedEmployeeID", DbType.Int64, kBUserTreeModifiedHistoryEntity.ModifiedEmployeeID);
                Database.AddInParameter(cmd, "@IP", DbType.String, kBUserTreeModifiedHistoryEntity.IP);

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

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

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

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

            return(returnCode);
        }
        private void SaveKBUserTreeModifiedHistoryEntity()
        {
            if (IsValid)
            {
                try
                {
                    KBUserTreeModifiedHistoryEntity kBUserTreeModifiedHistoryEntity = BuildKBUserTreeModifiedHistoryEntity();

                    Int64 result = -1;

                    if (kBUserTreeModifiedHistoryEntity.IsNew)
                    {
                        result = FCCKBUserTreeModifiedHistory.GetFacadeCreate().Add(kBUserTreeModifiedHistoryEntity, DatabaseOperationType.Add, TransactionRequired.No);
                    }
                    else
                    {
                        String filterExpression = SqlExpressionBuilder.PrepareFilterExpression(KBUserTreeModifiedHistoryEntity.FLD_NAME_UserTreeHistoryID, kBUserTreeModifiedHistoryEntity.UserTreeHistoryID.ToString(), SQLMatchType.Equal);
                        result = FCCKBUserTreeModifiedHistory.GetFacadeCreate().Update(kBUserTreeModifiedHistoryEntity, filterExpression, DatabaseOperationType.Update, TransactionRequired.No);
                    }

                    if (result > 0)
                    {
                        _UserTreeHistoryID = 0;
                        _KBUserTreeModifiedHistoryEntity = new KBUserTreeModifiedHistoryEntity();
                        PrepareInitialView();
                        BindKBUserTreeModifiedHistoryList();

                        if (kBUserTreeModifiedHistoryEntity.IsNew)
                        {
                            MiscUtil.ShowMessage(lblMessage, "K BUser Tree Modified History Information has been added successfully.", false);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "K BUser Tree Modified History Information has been updated successfully.", false);
                        }
                    }
                    else
                    {
                        if (kBUserTreeModifiedHistoryEntity.IsNew)
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to add K BUser Tree Modified History Information.", false);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to update K BUser Tree Modified History Information.", false);
                        }
                    }
                }
                catch (Exception ex)
                {
                    MiscUtil.ShowMessage(lblMessage, ex.Message, true);
                }
            }
        }
        protected void lvKBUserTreeModifiedHistory_ItemCommand(object sender, ListViewCommandEventArgs e)
        {
            Int64 UserTreeHistoryID;

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

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

                    PrepareEditView();

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

                        String fe = SqlExpressionBuilder.PrepareFilterExpression(KBUserTreeModifiedHistoryEntity.FLD_NAME_UserTreeHistoryID, UserTreeHistoryID.ToString(), SQLMatchType.Equal);

                        KBUserTreeModifiedHistoryEntity kBUserTreeModifiedHistoryEntity = new KBUserTreeModifiedHistoryEntity();


                        result = FCCKBUserTreeModifiedHistory.GetFacadeCreate().Delete(kBUserTreeModifiedHistoryEntity, fe, DatabaseOperationType.Delete, TransactionRequired.No);

                        if (result == 0)
                        {
                            _UserTreeHistoryID = 0;
                            _KBUserTreeModifiedHistoryEntity = new KBUserTreeModifiedHistoryEntity();
                            PrepareInitialView();
                            BindKBUserTreeModifiedHistoryList();

                            MiscUtil.ShowMessage(lblMessage, "K BUser Tree Modified History has been successfully deleted.", true);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to delete K BUser Tree Modified History.", true);
                        }
                    }
                    catch (Exception ex)
                    {
                        MiscUtil.ShowMessage(lblMessage, ex.Message, true);
                    }
                }
            }
        }
Exemplo n.º 5
0
        private Int64 DeleteTran(KBUserTreeModifiedHistoryEntity kBUserTreeModifiedHistoryEntity, String filterExpression, DatabaseOperationType option)
        {
            long         returnCode = -99;
            const string SP         = "dbo.KBUserTreeModifiedHistory_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 void PrepareEditView()
        {
            KBUserTreeModifiedHistoryEntity kBUserTreeModifiedHistoryEntity = CurrentKBUserTreeModifiedHistoryEntity;


            if (!kBUserTreeModifiedHistoryEntity.IsNew)
            {
                if (ddlUserTreeID.Items.Count > 0 && kBUserTreeModifiedHistoryEntity.UserTreeID != null)
                {
                    ddlUserTreeID.SelectedValue = kBUserTreeModifiedHistoryEntity.UserTreeID.ToString();
                }

                chkIsDocumentNodeType.Checked = kBUserTreeModifiedHistoryEntity.IsDocumentNodeType;
                txtTitle.Text        = kBUserTreeModifiedHistoryEntity.Title.ToString();
                txtDescription.Text  = kBUserTreeModifiedHistoryEntity.Description.ToString();
                txtReferenceID.Text  = kBUserTreeModifiedHistoryEntity.ReferenceID.ToString();
                txtTagKeyword.Text   = kBUserTreeModifiedHistoryEntity.TagKeyword.ToString();
                chkIsStarred.Checked = kBUserTreeModifiedHistoryEntity.IsStarred;
                if (ddlCreatedByEmployeeID.Items.Count > 0 && kBUserTreeModifiedHistoryEntity.CreatedByEmployeeID != null)
                {
                    ddlCreatedByEmployeeID.SelectedValue = kBUserTreeModifiedHistoryEntity.CreatedByEmployeeID.ToString();
                }

                txtCreateDate.Text = kBUserTreeModifiedHistoryEntity.CreateDate.ToStringDefault();
                if (ddlOwnerEmployeeID.Items.Count > 0 && kBUserTreeModifiedHistoryEntity.OwnerEmployeeID != null)
                {
                    ddlOwnerEmployeeID.SelectedValue = kBUserTreeModifiedHistoryEntity.OwnerEmployeeID.ToString();
                }

                txtDocumentSize.Text     = kBUserTreeModifiedHistoryEntity.DocumentSize.ToString();
                txtLastModifiedDate.Text = kBUserTreeModifiedHistoryEntity.LastModifiedDate.ToStringDefault();
                if (ddlUserTreeStatusID.Items.Count > 0 && kBUserTreeModifiedHistoryEntity.UserTreeStatusID != null)
                {
                    ddlUserTreeStatusID.SelectedValue = kBUserTreeModifiedHistoryEntity.UserTreeStatusID.ToString();
                }

                txtCountViewState.Text     = kBUserTreeModifiedHistoryEntity.CountViewState.ToString();
                txtModifiedDate.Text       = kBUserTreeModifiedHistoryEntity.ModifiedDate.ToStringDefault();
                txtModifiedEmployeeID.Text = kBUserTreeModifiedHistoryEntity.ModifiedEmployeeID.ToString();
                txtIP.Text = kBUserTreeModifiedHistoryEntity.IP.ToString();

                btnSubmit.Text    = "Update";
                btnAddNew.Visible = true;
            }
        }
Exemplo n.º 7
0
        private Int64 Delete(KBUserTreeModifiedHistoryEntity kBUserTreeModifiedHistoryEntity, String filterExpression, DatabaseOperationType option)
        {
            long         returnCode = -99;
            const string SP         = "dbo.KBUserTreeModifiedHistory_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("KBUserTreeModifiedHistoryEntity already exists. Please specify another KBUserTreeModifiedHistoryEntity.");
                    }

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

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

            return(returnCode);
        }
Exemplo n.º 8
0
        private Int64 UpdateTran(KBUserTreeModifiedHistoryEntity kBUserTreeModifiedHistoryEntity, String filterExpression, DatabaseOperationType option)
        {
            long         returnCode = -99;
            const string SP         = "dbo.KBUserTreeModifiedHistory_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, "@UserTreeHistoryID", DbType.Int64, kBUserTreeModifiedHistoryEntity.UserTreeHistoryID);
                db.AddInParameter(cmd, "@UserTreeID", DbType.Int64, kBUserTreeModifiedHistoryEntity.UserTreeID);
                db.AddInParameter(cmd, "@IsDocumentNodeType", DbType.Boolean, kBUserTreeModifiedHistoryEntity.IsDocumentNodeType);
                db.AddInParameter(cmd, "@Title", DbType.String, kBUserTreeModifiedHistoryEntity.Title);
                db.AddInParameter(cmd, "@Description", DbType.String, kBUserTreeModifiedHistoryEntity.Description);
                db.AddInParameter(cmd, "@ReferenceID", DbType.Int64, kBUserTreeModifiedHistoryEntity.ReferenceID);
                db.AddInParameter(cmd, "@TagKeyword", DbType.String, kBUserTreeModifiedHistoryEntity.TagKeyword);
                db.AddInParameter(cmd, "@IsStarred", DbType.Boolean, kBUserTreeModifiedHistoryEntity.IsStarred);
                db.AddInParameter(cmd, "@CreatedByEmployeeID", DbType.Int64, kBUserTreeModifiedHistoryEntity.CreatedByEmployeeID);
                db.AddInParameter(cmd, "@CreateDate", DbType.DateTime, kBUserTreeModifiedHistoryEntity.CreateDate);
                db.AddInParameter(cmd, "@OwnerEmployeeID", DbType.Int64, kBUserTreeModifiedHistoryEntity.OwnerEmployeeID);
                db.AddInParameter(cmd, "@DocumentSize", DbType.Decimal, kBUserTreeModifiedHistoryEntity.DocumentSize);
                db.AddInParameter(cmd, "@LastModifiedDate", DbType.DateTime, kBUserTreeModifiedHistoryEntity.LastModifiedDate);
                db.AddInParameter(cmd, "@UserTreeStatusID", DbType.Int64, kBUserTreeModifiedHistoryEntity.UserTreeStatusID);
                db.AddInParameter(cmd, "@CountViewState", DbType.Int64, kBUserTreeModifiedHistoryEntity.CountViewState);
                db.AddInParameter(cmd, "@ModifiedDate", DbType.DateTime, kBUserTreeModifiedHistoryEntity.ModifiedDate);
                db.AddInParameter(cmd, "@ModifiedEmployeeID", DbType.Int64, kBUserTreeModifiedHistoryEntity.ModifiedEmployeeID);
                db.AddInParameter(cmd, "@IP", DbType.String, kBUserTreeModifiedHistoryEntity.IP);

                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);
        }
 protected void btnAddNew_Click(object sender, EventArgs e)
 {
     _UserTreeHistoryID = 0;
     _KBUserTreeModifiedHistoryEntity = new KBUserTreeModifiedHistoryEntity();
     PrepareInitialView();
 }
        private KBUserTreeModifiedHistoryEntity BuildKBUserTreeModifiedHistoryEntity()
        {
            KBUserTreeModifiedHistoryEntity kBUserTreeModifiedHistoryEntity = CurrentKBUserTreeModifiedHistoryEntity;

            if (ddlUserTreeID.Items.Count > 0)
            {
                if (ddlUserTreeID.SelectedValue == "0")
                {
                }
                else
                {
                    kBUserTreeModifiedHistoryEntity.UserTreeID = Int64.Parse(ddlUserTreeID.SelectedValue);
                }
            }

            kBUserTreeModifiedHistoryEntity.IsDocumentNodeType = chkIsDocumentNodeType.Checked;

            kBUserTreeModifiedHistoryEntity.Title       = txtTitle.Text.Trim();
            kBUserTreeModifiedHistoryEntity.Description = txtDescription.Text.Trim();
            if (!txtReferenceID.Text.Trim().IsNullOrEmpty())
            {
                kBUserTreeModifiedHistoryEntity.ReferenceID = Int64.Parse(txtReferenceID.Text.Trim());
            }
            else
            {
                kBUserTreeModifiedHistoryEntity.ReferenceID = null;
            }

            kBUserTreeModifiedHistoryEntity.TagKeyword = txtTagKeyword.Text.Trim();
            kBUserTreeModifiedHistoryEntity.IsStarred  = chkIsStarred.Checked;

            if (ddlCreatedByEmployeeID.Items.Count > 0)
            {
                if (ddlCreatedByEmployeeID.SelectedValue == "0")
                {
                    kBUserTreeModifiedHistoryEntity.CreatedByEmployeeID = null;
                }
                else
                {
                    kBUserTreeModifiedHistoryEntity.CreatedByEmployeeID = Int64.Parse(ddlCreatedByEmployeeID.SelectedValue);
                }
            }

            if (txtCreateDate.Text.Trim().IsNotNullOrEmpty())
            {
                kBUserTreeModifiedHistoryEntity.CreateDate = MiscUtil.ParseToDateTime(txtCreateDate.Text);
            }
            else
            {
                kBUserTreeModifiedHistoryEntity.CreateDate = null;
            }

            if (ddlOwnerEmployeeID.Items.Count > 0)
            {
                if (ddlOwnerEmployeeID.SelectedValue == "0")
                {
                    kBUserTreeModifiedHistoryEntity.OwnerEmployeeID = null;
                }
                else
                {
                    kBUserTreeModifiedHistoryEntity.OwnerEmployeeID = Int64.Parse(ddlOwnerEmployeeID.SelectedValue);
                }
            }

            if (!txtDocumentSize.Text.Trim().IsNullOrEmpty())
            {
                kBUserTreeModifiedHistoryEntity.DocumentSize = Decimal.Parse(txtDocumentSize.Text.Trim());
            }
            else
            {
                kBUserTreeModifiedHistoryEntity.DocumentSize = null;
            }

            if (txtLastModifiedDate.Text.Trim().IsNotNullOrEmpty())
            {
                kBUserTreeModifiedHistoryEntity.LastModifiedDate = MiscUtil.ParseToDateTime(txtLastModifiedDate.Text);
            }
            else
            {
                kBUserTreeModifiedHistoryEntity.LastModifiedDate = null;
            }

            if (ddlUserTreeStatusID.Items.Count > 0)
            {
                if (ddlUserTreeStatusID.SelectedValue == "0")
                {
                }
                else
                {
                    kBUserTreeModifiedHistoryEntity.UserTreeStatusID = Int64.Parse(ddlUserTreeStatusID.SelectedValue);
                }
            }

            if (!txtCountViewState.Text.Trim().IsNullOrEmpty())
            {
                kBUserTreeModifiedHistoryEntity.CountViewState = Int64.Parse(txtCountViewState.Text.Trim());
            }

            if (txtModifiedDate.Text.Trim().IsNotNullOrEmpty())
            {
                kBUserTreeModifiedHistoryEntity.ModifiedDate = MiscUtil.ParseToDateTime(txtModifiedDate.Text);
            }

            if (!txtModifiedEmployeeID.Text.Trim().IsNullOrEmpty())
            {
                kBUserTreeModifiedHistoryEntity.ModifiedEmployeeID = Int64.Parse(txtModifiedEmployeeID.Text.Trim());
            }

            kBUserTreeModifiedHistoryEntity.IP = txtIP.Text.Trim();

            return(kBUserTreeModifiedHistoryEntity);
        }
Exemplo n.º 11
0
 Int64 IKBUserTreeModifiedHistoryFacade.Delete(KBUserTreeModifiedHistoryEntity kBUserTreeModifiedHistoryEntity, String filterExpression, DatabaseOperationType option, TransactionRequired reqTran)
 {
     return(DataAccessFactory.CreateKBUserTreeModifiedHistoryDataAccess().Delete(kBUserTreeModifiedHistoryEntity, filterExpression, option, reqTran));
 }
Exemplo n.º 12
0
 Int64 IKBUserTreeModifiedHistoryFacade.Add(KBUserTreeModifiedHistoryEntity kBUserTreeModifiedHistoryEntity, DatabaseOperationType option, TransactionRequired reqTran)
 {
     return(DataAccessFactory.CreateKBUserTreeModifiedHistoryDataAccess().Add(kBUserTreeModifiedHistoryEntity, option, reqTran));
 }