Ejemplo n.º 1
0
 // POST: api/SubQuestionCategory
 /// <summary>
 /// It takes the parameter SUB_QUESTION_CATEGORY model type .
 /// If SUB_QUESTION_CATEGORY.SQC_ID = 0 or NULL then it performs INSERT
 /// If SUB_QUESTION_CATEGORY.SQC_ID > 0 and SUB_QUESTION_CATEGORY.DEL_FLG=N then it performs UPDATE
 /// If SUB_QUESTION_CATEGORY.DEL_FLG=Y then it performs DELETE
 /// </summary>
 /// <param name="sqc"></param>
 public void Post([FromBody] SUB_QUESTION_CATEGORY sqc)
 {
     if ((sqc.SQC_ID.HasValue ? sqc.SQC_ID.Value : 0) == 0)
     {
         _logicLayer.InsertSubQuestionCategory(sqc);
     }
     else
     if (sqc.SQC_ID.Value > 0 && (string.IsNullOrWhiteSpace(sqc.DEL_FLG) ? "N" : sqc.DEL_FLG) == "N")
     {
         _logicLayer.UpdateSubQuestionCategory(sqc);
     }
     else
     {
         _logicLayer.DeleteSubQuestionCategory(sqc.SQC_ID.Value);
     }
 }
Ejemplo n.º 2
0
        internal List <SUB_QUESTION_CATEGORY> GetSubQuestionCategory(int qcId)
        {
            var SubQuestionCategory = new List <SUB_QUESTION_CATEGORY>();

            using (var connection = MySqlDbConnection.NewConnection)
            {
                _statement = string.Format(MySQLquery.GetSubQuestionCat,
                                           qcId > 0 ? Convert.ToString(qcId) : "QC_ID");
                //qcId);
                using (var command = MySqlDbConnection.Command(connection, _statement))
                {
                    using (var reader = command.ExecuteReader())
                    {
                        if (reader.HasRows)
                        {
                            while (reader.Read())
                            {
                                var subQuestCat = new SUB_QUESTION_CATEGORY();

                                subQuestCat.SQC_ID      = UtilityDL.CheckNull <int>(reader["SQC_ID"]);
                                subQuestCat.QC_ID       = UtilityDL.CheckNull <int>(reader["QC_ID"]);
                                subQuestCat.DOM_ID      = UtilityDL.CheckNull <int>(reader["DOM_ID"]);
                                subQuestCat.SUB_DOM_ID  = UtilityDL.CheckNull <int>(reader["SUB_DOM_ID"]);
                                subQuestCat.NAME        = UtilityDL.CheckNull <string>(reader["NAME"]);
                                subQuestCat.DESCRIPTION = UtilityDL.CheckNull <string>(reader["DESCRIPTION"]);
                                subQuestCat.SEQ_NO      = UtilityDL.CheckNull <int>(reader["SEQ_NO"]);

                                subQuestCat.ORGL_STAMP = UtilityDL.CheckNull <DateTime>(reader["ORGL_STAMP"]);
                                subQuestCat.ORGL_USER  = UtilityDL.CheckNull <string>(reader["ORGL_USER"]);
                                subQuestCat.UPDT_STAMP = UtilityDL.CheckNull <DateTime>(reader["UPDT_STAMP"]);
                                subQuestCat.UPDT_USER  = UtilityDL.CheckNull <string>(reader["UPDT_USER"]);
                                subQuestCat.DEL_FLG    = UtilityDL.CheckNull <string>(reader["DEL_FLG"]);

                                SubQuestionCategory.Add(subQuestCat);
                            }
                        }
                    }
                }

                return(SubQuestionCategory);
            }
        }
Ejemplo n.º 3
0
        internal void UpdateSubQuestionCategory(SUB_QUESTION_CATEGORY sqc)
        {
            using (var connection = MySqlDbConnection.NewConnection)
            {
                _statement = string.Format(MySQLquery.UpdateSubQuestionCategory,
                                           sqc.QC_ID.HasValue ?  Convert.ToString(sqc.QC_ID.Value) : "QC_ID",
                                           sqc.DOM_ID.HasValue ?  Convert.ToString(sqc.DOM_ID.Value) : "DOM_ID",
                                           sqc.SUB_DOM_ID.HasValue ? Convert.ToString(sqc.SUB_DOM_ID.Value) : "SUB_DOM_ID",
                                           string.IsNullOrWhiteSpace(sqc.NAME) ? "NAME" : string.Concat("'", sqc.NAME, "'"),
                                           string.IsNullOrWhiteSpace(sqc.DESCRIPTION) ? "DESCRIPTION" : string.Concat("'", sqc.DESCRIPTION, "'"),
                                           sqc.SEQ_NO.HasValue ? Convert.ToString(sqc.SEQ_NO.Value) : "SEQ_NO",
                                           string.IsNullOrWhiteSpace(sqc.UPDT_USER) ? "UPDT_USER" : string.Concat("'", sqc.UPDT_USER, "'"),
                                           "SYSDATE()",
                                           sqc.SQC_ID.Value
                                           );

                using (var command = MySqlDbConnection.Command(connection, _statement))
                {
                    command.ExecuteNonQuery();
                }
            }
        }
Ejemplo n.º 4
0
        internal void InsertSubQuestionCategory(SUB_QUESTION_CATEGORY sqc)
        {
            using (var connection = MySqlDbConnection.NewConnection)
            {
                _statement = string.Format(MySQLquery.InsertSubQuestionCategory,
                                           sqc.QC_ID.Value,
                                           sqc.DOM_ID.Value,
                                           sqc.SUB_DOM_ID.Value,
                                           string.Concat("'", sqc.NAME, "'"),
                                           string.Concat("'", sqc.DESCRIPTION, "'"),
                                           sqc.SEQ_NO.Value,
                                           string.Concat("'", string.IsNullOrWhiteSpace(sqc.DEL_FLG) ? "N" : sqc.DEL_FLG, "'"), //dm.DEL_FLG
                                           string.Concat("'", string.IsNullOrWhiteSpace(sqc.ORGL_USER) ? "ADMIN" : sqc.ORGL_USER, "'"),
                                           "SYSDATE()"
                                           );



                using (var command = MySqlDbConnection.Command(connection, _statement))
                {
                    command.ExecuteNonQuery();
                }
            }
        }
Ejemplo n.º 5
0
 internal void UpdateSubQuestionCategory(SUB_QUESTION_CATEGORY sqcId)
 {
     _dac.UpdateSubQuestionCategory(sqcId);
 }
Ejemplo n.º 6
0
 internal void InsertSubQuestionCategory(SUB_QUESTION_CATEGORY sqcId)
 {
     _dac.InsertSubQuestionCategory(sqcId);
 }
Ejemplo n.º 7
0
 // PUT: api/Domain/5
 public void Put([FromBody] SUB_QUESTION_CATEGORY sc)
 {
     _logicLayer.UpdateSubQuestionCategory(sc);
 }