예제 #1
0
        public Boolean updateCustomerGroup(customergroup sgroup)
        {
            Boolean status   = true;
            string  utString = "";

            try
            {
                string updateSQL = "update CustomerGroup set " +
                                   "GroupDescription = " + "'" + sgroup.GroupDescription + "'" +
                                   " where GroupLevel = " + sgroup.GroupLevel + " and GroupCode = '" + sgroup.GroupCode + "'";

                utString = utString + updateSQL + Main.QueryDelimiter;
                utString = utString +
                           ActivityLogDB.PrepareActivityLogQquerString("update", "CustomerGroup", "", updateSQL) +
                           Main.QueryDelimiter;

                if (!UpdateTable.UT(utString))
                {
                    status = false;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(this.ToString() + "-" + System.Reflection.MethodBase.GetCurrentMethod().Name + "() : Error");
                status = false;
            }
            return(status);
        }
예제 #2
0
        public List <customergroup> getCustomerGroupDetails(int lvl)
        {
            customergroup        cgroup;
            List <customergroup> customerGroupList = new List <customergroup>();

            try
            {
                string query = "select GroupLevel,GroupCode, GroupDescription, CreateTime, CreateUser " +
                               " from CustomerGroup where GroupLevel = " + lvl;
                SqlConnection conn = new SqlConnection(Login.connString);
                SqlCommand    cmd  = new SqlCommand(query, conn);
                conn.Open();
                SqlDataReader reader = cmd.ExecuteReader();
                while (reader.Read())
                {
                    cgroup                  = new customergroup();
                    cgroup.GroupLevel       = reader.GetInt32(0);
                    cgroup.GroupCode        = reader.GetString(1);
                    cgroup.GroupDescription = reader.GetString(2);
                    cgroup.CreateTime       = reader.GetDateTime(3);
                    cgroup.CreateUser       = reader.GetString(4);

                    customerGroupList.Add(cgroup);
                }
                conn.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(this.ToString() + "-" + System.Reflection.MethodBase.GetCurrentMethod().Name + "() : Error");
            }
            return(customerGroupList);
        }
예제 #3
0
        public Boolean insertCustomerGroup(customergroup cgroup)
        {
            Boolean status   = true;
            string  utString = "";

            try
            {
                string updateSQL = "insert into CustomerGroup " +
                                   "(Grouplevel,GroupCode,GroupDescription,CreateTime,CreateUser) " +
                                   "values ('" + cgroup.GroupLevel + "','"
                                   + cgroup.GroupCode + "','" +
                                   cgroup.GroupDescription + "'," +
                                   "GETDATE()" + ",'" +
                                   Login.userLoggedIn + "')";

                utString = utString + updateSQL + Main.QueryDelimiter;
                utString = utString +
                           ActivityLogDB.PrepareActivityLogQquerString("insert", "CustomerGroup", "", updateSQL) +
                           Main.QueryDelimiter;

                if (!UpdateTable.UT(utString))
                {
                    status = false;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(this.ToString() + "-" + System.Reflection.MethodBase.GetCurrentMethod().Name + "() : Error");
                status = false;
            }
            return(status);
        }
예제 #4
0
        public Boolean validateCustomerGroup(customergroup sg)
        {
            Boolean status = true;

            try
            {
                if ((sg.GroupCode.Trim().Length == 0) || (sg.GroupCode == null))
                {
                    status = false;
                }
                if ((sg.GroupDescription.Trim().Length == 0) || (sg.GroupDescription == null))
                {
                    status = false;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(this.ToString() + "-" + System.Reflection.MethodBase.GetCurrentMethod().Name + "() : Error");
                status = false;
            }
            return(status);
        }