Exemplo n.º 1
0
        public Java.Lang.String upsertHearingFormat(Java.Lang.String modelJson)
        {
            var output = new Java.Lang.String("");

            Console.WriteLine("upsertHearingFormat json model-->" + modelJson);
            try {
                var convertable = modelJson.Replace(":null", ":''").Replace(":[]", ":null").ToString();
                var model       = JsonConvert.DeserializeObject <HearingFormatView> (convertable);
                using (var db = FactoryConn.GetConn()) {
                    var incompleteHf = db.Table <HearingFormat> ().Where(hef => hef.CaseDetention == model.idCase &&
                                                                         hef.IsFinished == false).OrderByDescending(hef => hef.Id).FirstOrDefault();
                    if (incompleteHf != null && incompleteHf.Id > 0 && incompleteHf.Id != model.idFormat)
                    {
                        output = new Java.Lang.String("Tiene un formato de audiencia anterior incompleto, debe terminarlo para poder agregar un nuevo formato de audiencia.");
                    }
                    else if (model.isFinished ?? false)
                    {
                        if (model.vincProcess != null && model.vincProcess == Constants.PROCESS_VINC_NO)
                        {
                            var renewCred = Crypto.HashPassword(model.credPass);
                            var loggedUsr = db.Table <User> ().FirstOrDefault();
                            if (loggedUsr == null || renewCred != loggedUsr.password)
                            {
                                output = new Java.Lang.String("La contraseña es incorrecta, verifique los datos.");
                            }
                        }
                    }
                    db.Close();
                }
                if (output.ToString() == "")
                {
                    HFDtoSave salve = new HFDtoSave();
                    salve = fillHearingFormatWithView(model);
                    salve.IsSubstracted = model.IsSubstracted;
                    output = new Java.Lang.String(hearingFormatServiceSave(salve));
                }
            } catch (Exception e) {
                Console.WriteLine("exception in upsertHearingFormat()");
                Console.WriteLine("Exception message :::>" + e.Message);
                output = new Java.Lang.String("Ha ocurrido un error, intente nuevamente");
            }
            return(output);
        }
Exemplo n.º 2
0
        public void Alert(Java.Lang.String text, Java.Lang.String annotation)
        {
            //ContextThemeWrapper wrapper = new ContextThemeWrapper(context, App.FUNCTIONS.GetDialogTheme());
            //StorehouseSuperDialog alert = new StorehouseSuperDialog(wrapper);

            //alert.SetTitleTextColor(Android.Graphics.Color.White);
            //alert.SetTitleBackgroundColor(Android.Resource.Color.Transparent);
            //alert.SetTitle((string)text);
            //alert.SetMessage((string)annotation);
            //alert.Show();

            string english = (string)annotation;
            string chinese = ((string)text).Split(' ')[0];
            string pinyin  = (string)text.Replace(chinese + " ", "");

            LearningCharacter character = new LearningCharacter()
            {
                Chinese = chinese,
                Pinyin  = pinyin,
                English = english
            };

            App.FUNCTIONS.ShowCharacterLearningDialog(context, character, webview);
        }