Beispiel #1
0
        public static int InsertNewFormInfo(FormInfo formInfo)
        {
            int numberAffectedRows = 0;
            SqlCeConnection conn = BackEndUtils.GetSqlConnection();
            try {
                conn.Open();
                SqlCeCommand command = new SqlCeCommand(Form_Updated_SQL.commandInsertIntoFormInfo, conn);
                command.Parameters.Add("@formName", formInfo.localFormName);
                command.Parameters.Add("@formStatus", FormInfo.formStatus.Active);
                command.Parameters.Add("@formUpdated", "True");
                numberAffectedRows = Convert.ToInt32(command.ExecuteNonQuery());

            } finally {
                conn.Close();
            }
            return numberAffectedRows;
        }
Beispiel #2
0
 public static int InsertFormInfoCheckForFirstUse(string formName)
 {
     FormInfo formInfo = new FormInfo(formName, (int)FormInfo.formStatus.Active, "True");
     SqlCeConnection conn = BackEndUtils.GetSqlConnection();
     int returnedFormStatus = -1;
     try {
         conn.Open();
         int foundRows = GetFoundRowsForExistingForm(formName, conn);
         if (foundRows > 0) {
             returnedFormStatus = GetFormStatus(formName, conn);
         } else {
             InsertNewFormInfo(formInfo);
         }
     } finally {
         conn.Close();
     }
     return returnedFormStatus;
 }