示例#1
0
        public bool UpdateRecords_SysCode(CodeCls slCls, out string returnMessage)
        {
            bool b = false;

            returnMessage = string.Empty;
            int liExecute = 0;

            try
            {
                string query = " UPDATE Sys_Code SET " +
                               "   CodeName = @CodeName " +
                               " , CodeDescr = @CodeDescr " +
                               " , ActiveYN = @ActiveYN " +
                               " , CodeOrder = @CodeOrder " +
                               " , SysCodeType = @SysCodeType " +
                               " , Att1 = @Att1 " +
                               " , Att2 = @Att2 " +
                               " , UpdUserID = @UpdUserID " +
                               " , UpdDT = NOW() " +
                               " WHERE ID = @ID ";

                using (MySqlCommand cmd = new MySqlCommand(query))
                {
                    cmd.Parameters.Clear();
                    cmd.Parameters.AddWithValue("@ID", slCls.ID);
                    cmd.Parameters.AddWithValue("@CodeName", slCls.CodeName);
                    cmd.Parameters.AddWithValue("@CodeDescr", slCls.CodeDescr);
                    cmd.Parameters.AddWithValue("@ActiveYN", slCls.ActiveYN);
                    cmd.Parameters.AddWithValue("@CodeOrder", slCls.CodeOrder);
                    cmd.Parameters.AddWithValue("@SysCodeType", slCls.SysCodeType);
                    cmd.Parameters.AddWithValue("@Att1", slCls.Att1);
                    cmd.Parameters.AddWithValue("@Att2", slCls.Att2);
                    cmd.Parameters.AddWithValue("@UpdUserID", slCls.UpdUserID);

                    liExecute = publicNewClass.mydb.ExecuteCmd(query, 300, cmd.Parameters, out returnMessage);
                    b         = (liExecute == -1) ? false : true;
                }
            }
            catch (Exception ex)
            {
                returnMessage = ex.Message;
                liExecute     = -1;
            }

            b = liExecute == -1 ? false : true;
            return(b);
        }
示例#2
0
        public bool InsertRecords_SysCode(CodeCls slCls, out string returnMessage)
        {
            bool b = false;

            returnMessage = string.Empty;
            int liExecute = 0;

            try
            {
                string query = " INSERT INTO Sys_Code (CompanyID, Code, CodeName " +
                               " , ActiveYN, CodeOrder, CodeDescr, SysCodeType " +
                               " , Att1, Att2, UpdUserID, UpdDT) VALUES " +
                               " ( @CompanyID, @Code, @CodeName " +
                               " , @ActiveYN, @CodeOrder, @CodeDescr, @SysCodeType " +
                               " , @Att1, @Att2, @UpdUserID, NOW()) ";

                using (MySqlCommand cmd = new MySqlCommand(query))
                {
                    cmd.Parameters.Clear();
                    cmd.Parameters.AddWithValue("@CompanyID", slCls.CompanyID);
                    cmd.Parameters.AddWithValue("@Code", slCls.Code);
                    cmd.Parameters.AddWithValue("@CodeName", slCls.CodeName);
                    cmd.Parameters.AddWithValue("@CodeDescr", slCls.CodeDescr);
                    cmd.Parameters.AddWithValue("@ActiveYN", slCls.ActiveYN);
                    cmd.Parameters.AddWithValue("@CodeOrder", slCls.CodeOrder);
                    cmd.Parameters.AddWithValue("@SysCodeType", slCls.SysCodeType);
                    cmd.Parameters.AddWithValue("@Att1", slCls.Att1);
                    cmd.Parameters.AddWithValue("@Att2", slCls.Att2);
                    cmd.Parameters.AddWithValue("@UpdUserID", slCls.UpdUserID);

                    liExecute = publicNewClass.mydb.ExecuteCmd(query, 300, cmd.Parameters, out returnMessage);
                    b         = (liExecute == -1) ? false : true;
                }
            }
            catch (Exception ex)
            {
                returnMessage = ex.Message;
                liExecute     = -1;
            }

            b = liExecute == -1 ? false : true;
            return(b);
        }