Пример #1
0
        public static CommonKey GetCommonKeyByID(int commonKeyID)
        {
            DataRow   TheCommonKeyRow = CommonKeyDataAccess.GetInstance.GetCommonKeyByID(commonKeyID);
            CommonKey TheCommonKey    = DataRowToObject(TheCommonKeyRow);

            return(TheCommonKey);
        }
        private void PopulatePageFields(int commonKeyID)
        {
            CommonKey theCommonkey = CommonKeyManagement.GetInstance.GetCommonKeyByID(commonKeyID);

            ddl_CommonKeyName.Text = theCommonkey.CommonKeyName;
            txt_AddNew.Text        = theCommonkey.CommonKeyValue;
        }
        public int InsertRecord()
        {
            int       ProcReturnValue = 0;
            CommonKey theCommonKey    = new CommonKey();

            theCommonKey.CommonKeyValue = txt_AddNew.Text;
            theCommonKey.CommonKeyName  = ddl_CommonKeyName.SelectedValue;
            ProcReturnValue             = CommonKeyManagement.GetInstance.InsertCommonKey(theCommonKey);

            return(ProcReturnValue);
        }
Пример #4
0
        public static List <CommonKey> GetCommonKeyByName(string commonKeyName)
        {
            List <CommonKey> TheCommonKeyList  = new List <CommonKey>();
            DataTable        TheCommonKeyTable = CommonKeyDataAccess.GetInstance.GetCommonKeyByName(commonKeyName);

            foreach (DataRow dr in TheCommonKeyTable.Rows)
            {
                CommonKey TheCommonKey = DataRowToObject(dr);

                TheCommonKeyList.Add(TheCommonKey);
            }

            return(TheCommonKeyList);
        }
Пример #5
0
        public static CommonKey ConvertDataRowToObject(DataRow dr)
        {
            CommonKey TheCommonKey;

            if (dr != null)
            {
                TheCommonKey = new CommonKey
                {
                    CommonKeyName = dr["CommonKeyName"].ToString()
                };
            }
            else
            {
                TheCommonKey = new CommonKey();
            }

            return(TheCommonKey);
        }
        public int DeleteCommonKey(CommonKey theCommonKey)
        {
            int ReturnValue = 0;

            using (SqlCommand DeleteCommand = new SqlCommand())
            {
                DeleteCommand.CommandType = CommandType.StoredProcedure;
                DeleteCommand.Parameters.Add(GetParameter("@ReturnValue", SqlDbType.Int, ReturnValue)).Direction = ParameterDirection.Output;
                DeleteCommand.Parameters.Add(GetParameter("@CommonKeyID", SqlDbType.Int, theCommonKey.CommonKeyID));
                DeleteCommand.Parameters.Add(GetParameter("@ModifiedBy", SqlDbType.Int, Micro.Commons.Connection.LoggedOnUser.UserID));
                DeleteCommand.CommandText = "pADM_CommonKeys_Delete";

                ExecuteStoredProcedure(DeleteCommand);

                ReturnValue = int.Parse(DeleteCommand.Parameters[0].Value.ToString());

                return(ReturnValue);
            }
        }
        public int InsertCommonKey(CommonKey theCommonKey)
        {
            int ReturnValue = 0;

            using (SqlCommand InsertCommand = new SqlCommand())
            {
                InsertCommand.CommandType = CommandType.StoredProcedure;
                InsertCommand.Parameters.Add(GetParameter("@ReturnValue", SqlDbType.Int, ReturnValue)).Direction = ParameterDirection.Output;
                InsertCommand.Parameters.Add(GetParameter("@CommonKeyName", SqlDbType.VarChar, theCommonKey.CommonKeyName));
                InsertCommand.Parameters.Add(GetParameter("@CommonKeyValue", SqlDbType.VarChar, theCommonKey.CommonKeyValue));
                InsertCommand.Parameters.Add(GetParameter("@AddedBy", SqlDbType.Int, Micro.Commons.Connection.LoggedOnUser.UserID));

                InsertCommand.CommandText = "pADM_CommonKeys_Insert";

                ExecuteStoredProcedure(InsertCommand);

                ReturnValue = int.Parse(InsertCommand.Parameters[0].Value.ToString());

                return(ReturnValue);
            }
        }
Пример #8
0
        public static CommonKey DataRowToObject(DataRow dr)
        {
            CommonKey TheCommonKey;

            if (dr != null)
            {
                TheCommonKey = new CommonKey
                {
                    CommonKeyID    = (dr["CommonKeyID"] == null? 0 : int.Parse(dr["CommonKeyID"].ToString())),
                    CommonKeyName  = dr["CommonKeyName"].ToString(),
                    CommonKeyValue = (dr["CommonKeyValue"] == null? string.Empty : dr["CommonKeyValue"].ToString()),
                    IsActive       = (dr["IsActive"] == null? false :Boolean.Parse(dr["IsActive"].ToString())),
                    IsDeleted      = (dr["IsActive"] == null? false :Boolean.Parse(dr["IsDeleted"].ToString()))
                };
            }
            else
            {
                TheCommonKey = new CommonKey();
            }

            return(TheCommonKey);
        }
Пример #9
0
 public int DeleteCommonKey(CommonKey theCommonKey)
 {
     return(CommonKeyIntegration.DeleteCommonKey(theCommonKey));
 }
Пример #10
0
 public int UpdateCommonKey(CommonKey theCommonKey)
 {
     return(CommonKeyIntegration.UpdateCommonKey(theCommonKey));
 }
Пример #11
0
 public int InsertCommonKey(CommonKey theCommonKey)
 {
     return(CommonKeyIntegration.InsertCommonKey(theCommonKey));
 }
Пример #12
0
 public static int DeleteCommonKey(CommonKey theCommonKey)
 {
     return(CommonKeyDataAccess.GetInstance.DeleteCommonKey(theCommonKey));
 }
Пример #13
0
 public static int InsertCommonKey(CommonKey theCommonKey)
 {
     return(CommonKeyDataAccess.GetInstance.InsertCommonKey(theCommonKey));
 }
 private void PopulatePageFields(CommonKey theCommonkey)
 {
     ddl_CommonKeyName.Text = theCommonkey.CommonKeyName;
     txt_AddNew.Text        = theCommonkey.CommonKeyValue;
 }