示例#1
0
        public CResult GetButtonColor(RMS.Common.ObjectModel.CButtonColor p_buttonColor)
        {
            CResult oResult = new CResult();

            try
            {
                this.OpenConnection();
                string      sqlCommand = string.Format(SqlQueries.GetQuery(Query.GetButtonColor), p_buttonColor.ButtonID);
                IDataReader oReader    = this.ExecuteReader(sqlCommand);
                if (oReader != null)
                {
                    if (oReader.Read())
                    {
                        p_buttonColor = ReaderToButtonColor(oReader);

                        oResult.Data = p_buttonColor;

                        oResult.IsSuccess = true;
                    }
                }
            }
            catch (Exception ex)
            {
                Logger.Write("Exception : " + ex + " in ItemGetById()", LogLevel.Error, "Database");

                oResult.IsException = true;
            }
            finally
            {
                this.CloseConnection();
            }
            return(oResult);
        }
示例#2
0
        public CResult AddButtonColor(CButtonColor inUser)
        {
            CResult oResult = new CResult();

            try
            {
                this.OpenConnection();
                string sSql = String.Format(SqlQueries.GetQuery(Query.AddButtonColor), inUser.ButtonName,inUser.ButtonColor);

                this.ExecuteNonQuery(sSql);

                oResult.IsSuccess = true;
            }
            catch (Exception ex)
            {
                Logger.Write("Exception : " + ex + " in ItemInsert() in CUserInfoDAO class", LogLevel.Error, "Database");

                //throw new Exception("Exception occure at ItemInsert()", ex);
            }
            finally
            {
                this.CloseConnection();
            }
            return oResult;
        }
示例#3
0
        public CResult AddButtonColor(RMS.Common.ObjectModel.CButtonColor p_buttonColor)
        {
            CResult objResult = new CResult();

            p_buttonColor.ButtonName = p_buttonColor.ButtonName.Replace("''", "'");
            p_buttonColor.ButtonName = p_buttonColor.ButtonName.Replace("'", "''");
            try
            {
                this.OpenConnection();
                string sqlCommand = String.Format(SqlQueries.GetQuery(Query.AddButtonColor), p_buttonColor.ButtonName, p_buttonColor.ButtonColor, RMSGlobal.LogInUserName, DateTime.Now.Ticks);

                this.ExecuteNonQuery(sqlCommand);

                objResult.IsSuccess = true;
            }
            catch (Exception ex)
            {
                Logger.Write("Exception : " + ex + " in ItemInsert() in CUserInfoDAO class", LogLevel.Error, "Database");
            }
            finally
            {
                this.CloseConnection();
            }
            return(objResult);
        }
示例#4
0
        public CResult UpdateButtonColor(RMS.Common.ObjectModel.CButtonColor inUser)
        {
            CResult oResult = new CResult();

            try
            {
                this.OpenConnection();
                string sSql = String.Format(SqlQueries.GetQuery(Query.UpdateButtonColor), inUser.ButtonColor, inUser.ButtonID, inUser.CurrentUserId, inUser.LoginDateTime);

                this.ExecuteNonQuery(sSql);

                oResult.IsSuccess = true;
            }
            catch (Exception ex)
            {
                Logger.Write("Exception : " + ex + " in ItemInsert() in CUserInfoDAO class", LogLevel.Error, "Database");

                //throw new Exception("Exception occure at ItemInsert()", ex);
            }
            finally
            {
                this.CloseConnection();
            }
            return(oResult);
        }
示例#5
0
        public CResult AddButtonColor(CButtonColor inUser)
        {
            try
            {
                m_oResult = RMS.DataAccess.Database.Instance.ButtonColor.AddButtonColor(inUser);

            }
            catch (Exception ex)
            {
                System.Console.WriteLine("Exception occuer at DeleteItem() : " + ex.Message);
                m_oResult.IsException = true;
                m_oResult.Action = EERRORNAME.EXCEPTION_OCCURE;
                m_oResult.SetParams(ex.Message);
                m_oResult.Message = ex.Message;
                Logger.Write("Exception : " + ex + " in DeleteItem()", LogLevel.Error, "CItemManager");
            }
            return m_oResult;
        }
示例#6
0
        public CButtonColor ButtonColorGetByButtonName(String inButtonName)
        {
            CButtonColor tempButtonColor = new CButtonColor();

            try
            {
                this.OpenConnection();
                string sSql =String.Format(SqlQueries.GetQuery(Query.ButtonColorByButtonName),inButtonName);
                IDataReader oReader = this.ExecuteReader(sSql);
                if (oReader != null)
                {
                    while (oReader.Read())
                    {
                        tempButtonColor = ReaderToButtonColor(oReader);
                    }
                }
            }
            catch (Exception ex)
            {
                System.Console.WriteLine("###" + ex.ToString() + "###");
                Logger.Write("Exception : " + ex.Message + " in ButtonColorGetByButtonName()", LogLevel.Error, "Database");
                if (ex.GetType().Equals(typeof(SqlException)))
                {
                    SqlException oSQLEx = ex as SqlException;
                    if (oSQLEx.Number != 7619)
                        throw new Exception("Exception occured at ButtonColorGetByButtonName()", ex);
                }
                else
                {
                    throw new Exception("Exception occured at ButtonColorGetByButtonName()", ex);
                }
            }
            finally
            {
                this.CloseConnection();
            }

            return tempButtonColor;
        }
示例#7
0
 public void ButtonColorUpdate(CButtonColor inButtonColor)
 {
 }
示例#8
0
 public void ButtonColorInsert(CButtonColor inButtonColor)
 {
 }
示例#9
0
 public void ButtonColorDelete(CButtonColor inButtonColor)
 {
 }
示例#10
0
        private CButtonColor ReaderToButtonColor(IDataReader inReader)
        {
            CButtonColor tempButtonColor = new CButtonColor();

            if (inReader["button_id"] != null)
                tempButtonColor.ButtonID = int.Parse(inReader["button_id"].ToString());

            if (inReader["name"] != null)
                tempButtonColor.ButtonName = inReader["name"].ToString();

            if (inReader["color"] != null)
                tempButtonColor.ButtonColor = inReader["color"].ToString();

            return tempButtonColor;
        }
示例#11
0
        private CButtonColor ReaderToButtonColor(IDataReader oReader)
        {
            CButtonColor oItem = new CButtonColor();

            if (oReader["button_id"] != null)
                oItem.ButtonID = Int32.Parse(oReader["button_id"].ToString());

            if (oReader["name"] != null)
                oItem.ButtonName = oReader["name"].ToString();

            if (oReader["color"] != null)
                oItem.ButtonColor = oReader["color"].ToString();

            return oItem;
        }
示例#12
0
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            try
            {
                if (cmbButtonColor.SelectedValue != null)
                {
                    int iTempInt = Int32.Parse(cmbButtonColor.SelectedValue.ToString());

                    String sTempStr = txtColorName.Text.Trim();

                    if (sTempStr.Equals(String.Empty))
                    {
                    }
                    else
                    {
                        CButtonColor oTempButton = new CButtonColor();

                        oTempButton.ButtonColor = sTempStr;
                        oTempButton.ButtonID = iTempInt;
                        oTempButton.CurrentUserId = RMSGlobal.LogInUserName;
                        oTempButton.LoginDateTime = RMSGlobal.GetCurrentDateTime();

                        CUserManager oManager = new CUserManager();

                        CResult oResult = oManager.UpdateButtonColor(oTempButton);

                        if (oResult.IsSuccess)
                        {
                            lblSaveStatus.Text = "Button color has been saved successfully.";

                            lblSaveStatus.Visible = true;
                        }
                        else
                        {
                            lblSaveStatus.Text = "Could not update the button color. Please try again.";
                            lblSaveStatus.Visible = true;
                        }
                    }
                }
            }
            catch (Exception exp)
            {
                MessageBox.Show(exp.Message, RMSGlobal.MessageBoxTitle,
                    MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }