Ejemplo n.º 1
0
        public static ResponseModel CreateFlag(FlagModel flag)
        {
            try
            {
                ResponseModel vrlResponse = new ResponseModel();
                var           VL_BD       = new DBManager(DBManager.TAG_SQL);
                int           resultado;

                resultado = VL_BD.EjecutarStoredProc(DBManager.dbflags, "sp_transacciones_flag", "@oSalida",
                                                     new DBManager.ParametrosStoredP("@iOperacion", "A", ParameterDirection.Input, DbType.String),
                                                     new DBManager.ParametrosStoredP("@iDescripcion", flag.Descripcion, ParameterDirection.Input, DbType.String),
                                                     new DBManager.ParametrosStoredP("@oSalida", 0, ParameterDirection.Output, DbType.Int64));



                if (resultado == 0)
                {
                    vrlResponse.RsCode    = CodeManager.CODE_200;
                    vrlResponse.RsMessage = CodeManager.DESC_10001;
                    vrlResponse.RsContent = "Creado correctamente";
                }
                else if (resultado == 100)
                {
                    vrlResponse.RsCode    = CodeManager.CODE_200;
                    vrlResponse.RsMessage = CodeManager.DESC_10001;
                    vrlResponse.RsContent = "Ya existe un registro con esa descripcion";
                }
                return(vrlResponse);
            }
            catch (Exception ex)
            {
                throw new Exception("Error: " + ex.Message.ToString());
            }
        }
        public static int DeleteFlag(int Id)
        {
            FlagModel data = new FlagModel
            {
                CommentId = Id
            };

            string sql = @"DELETE FROM dbo.FlaggedComments WHERE CommentId= @CommentId;";

            return(SqlDataAccess.SaveData(sql, data));
        }
Ejemplo n.º 3
0
 /// <summary>
 /// 获得文章详细信息
 /// </summary>
 protected void GetFlagInfo()
 {
     model = new FlagBll().GetModel(this._id);
     if (model != null)
     {
         this.txtTitle.Text = model.flag_name;
         //this.txtSort.Text = model.Sort.ToString();
         //this.ddlParentCategory.SelectedValue = model.ParentCategoryId.ToString();
         //this.txtAddDate.Text = Convert.ToDateTime(model.AddedDate).ToString("yyyy-MM-dd");
     }
 }
Ejemplo n.º 4
0
        public IHttpActionResult Update(int id, FlagModel flag)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            ResponseModel response = FlagService.UpdateFlag(id, flag);

            return(Ok(response));
        }
 private void uxSubmit_Click(object sender, RoutedEventArgs e)
 {
     Flag              = new FlagModel();
     Flag.ItemNum      = int.Parse(uxItem.Text);
     Flag.Description  = uxDescription.Text;
     Flag.PricePerItem = double.Parse(uxPrice.Text);
     Flag.Quantity     = int.Parse(uxQuantity.Text);
     Flag.OurCost      = double.Parse(uxOurCost.Text);
     Flag.Value        = double.Parse(uxValue.Text);
     DialogResult      = true;
     Close();
 }
        public static int CreateFlag(int Id, string Rea)
        {
            FlagModel data = new FlagModel
            {
                CommentId = Id,
                Reason    = Rea
            };

            string sql = @"insert into dbo.FlaggedComments (CommentId, Reason)
                          values (@CommentId, @Reason);";

            return(SqlDataAccess.SaveData(sql, data));
        }
Ejemplo n.º 7
0
        public IHttpActionResult Create(FlagModel flag)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }


            ResponseModel response = FlagService.CreateFlag(flag);

            return(Ok(response));
            //return Ok(customerFake);
        }
Ejemplo n.º 8
0
        private void LoadScandicFlags()
        {
            var flags = App.FlagRepository.GetAll();

            uxList.ItemsSource = flags
                                 .Select(t => FlagModel.ToModel(t))
                                 .ToList();

            // OR
            //var uiContactModelList = new List<ContactModel>();
            //foreach (var repositoryContactModel in contacts)
            //{
            //    This is the .Select(t => ... )
            //    var uiContactModel = ContactModel.ToModel(repositoryContactModel);
            //
            //    uiContactModelList.Add(uiContactModel);
            //}

            //uxContactList.ItemsSource = uiContactModelList;
        }
Ejemplo n.º 9
0
        public JsonResult Create(FlagModel flagModel)
        {
            ExecuteCommand(new FlagServiceCommand(UserInfo.Id, flagModel.ServiceId, (FlagType)flagModel.Category, flagModel.Reason));

            return(Json(new { Success = true }));
        }
Ejemplo n.º 10
0
        public JsonResult Create(FlagModel flagModel)
        {
            ExecuteCommand(new FlagServiceCommand(UserInfo.Id, flagModel.ServiceId, (FlagType)flagModel.Category, flagModel.Reason));

            return Json(new { Success = true });
        }
Ejemplo n.º 11
0
 private void uxList_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     selectedContact = (FlagModel)uxList.SelectedValue;
 }
Ejemplo n.º 12
0
        public IHttpActionResult Create(FlagModel flagModel)
        {
            var flagId = this.flagsService.Create(flagModel.ChapterId, flagModel.Reason, this.CurrentUserId);

            return(this.Ok(flagId));
        }
Ejemplo n.º 13
0
 public MainWindow()
 {
     Model = new FlagModel();
     InitializeComponent();
 }
Ejemplo n.º 14
0
        public static ResponseModel SelectFlags(int id = 0)
        {
            try
            {
                DataSet dsFlags;

                // Modelo de respuestas personalizadas
                ResponseModel vrlResponse = new ResponseModel();
                //usuarioModel jsonM = new usuarioModel();
                var VL_BD = new DBManager(DBManager.TAG_SQL);

                dsFlags = new DataSet();

                if (id == 0)
                {
                    dsFlags = VL_BD.LlenarDatasetStoredProc(DBManager.dbflags, "sp_transacciones_flag",
                                                            new DBManager.ParametrosStoredP("@iOperacion", "D", ParameterDirection.Input, DbType.String),
                                                            new DBManager.ParametrosStoredP("@oSalida", 0, ParameterDirection.Output, DbType.Int64));
                }
                else
                {
                    dsFlags = VL_BD.LlenarDatasetStoredProc(DBManager.dbflags, "sp_transacciones_flag",
                                                            new DBManager.ParametrosStoredP("@iOperacion", "E", ParameterDirection.Input, DbType.String),
                                                            new DBManager.ParametrosStoredP("@iID", id, ParameterDirection.Input, DbType.Int64),
                                                            new DBManager.ParametrosStoredP("@oSalida", 0, ParameterDirection.Output, DbType.Int64));
                }



                if (dsFlags.Tables.Count > 0)
                {
                    List <FlagModel> ListaFlags = new List <FlagModel>();
                    foreach (DataRow item in dsFlags.Tables[0].Rows)
                    {
                        FlagModel flag = new FlagModel();

                        flag.id          = int.Parse(item["flag_id"].ToString());
                        flag.Descripcion = item["flag_desc"].ToString();
                        flag.estado      = int.Parse(item["flag_estado"].ToString());

                        ListaFlags.Add(flag);
                    }

                    vrlResponse.RsCode    = CodeManager.CODE_200;
                    vrlResponse.RsMessage = CodeManager.DESC_10001;
                    vrlResponse.RsContent = ListaFlags;
                }
                else
                {
                    vrlResponse.RsCode    = CodeManager.CODE_200;
                    vrlResponse.RsMessage = CodeManager.DESC_10001;
                    vrlResponse.RsContent = "No existe informacion para mostrar";
                }


                return(vrlResponse);
            }
            catch (Exception ex)
            {
                throw new Exception("Error: " + ex.Message.ToString());
            }
        }