Ejemplo n.º 1
0
        public BaseResponse InsertImplementAgency([FromBody] ImplementAgenciesRequest request)
        {
            BaseResponse response = new BaseResponse();

            using (TransactionScope scope = new TransactionScope())
            {
                try
                {
                    if (!BAplication.ValidateAplicationToken(request.ApplicationToken))
                    {
                        response.Code    = "2";
                        response.Message = Messages.ApplicationTokenNoAutorize;
                        return(response);
                    }

                    string webRoot     = _env.ContentRootPath;
                    string rootPath    = _appSettings.Value.rootPath;
                    string ProjectPath = _appSettings.Value.ProjectPath;

                    BaseRequest baseRequest = new BaseRequest();

                    foreach (MImplementAgency model in request.ImplementAgencies)
                    {
                        MImplementAgency fund = new MImplementAgency();

                        fund.ImplementAgencyCode = model.ImplementAgencyCode;
                        fund.Description         = model.Description;
                        fund.ShortDescription    = model.ShortDescription;

                        BImplementAgency.Insert(fund);
                    }

                    scope.Complete();
                    response.Code    = "0";
                    response.Message = "Success";
                }
                catch (Exception ex)
                {
                    response.Code    = "2";
                    response.Message = ex.Message;

                    scope.Dispose();
                }
            }

            return(response);
        }
Ejemplo n.º 2
0
        public static int Insert(MImplementAgency ent)
        {
            using (SqlConnection con = new SqlConnection(ConnectionDB.GetConnectionString()))
            {
                SqlCommand cmd = new SqlCommand("sp_ImplementAgency_Ins", con);
                cmd.CommandTimeout = 0;
                cmd.CommandType    = CommandType.StoredProcedure;
                cmd.Parameters.Add("@IImplementAgencyCode", SqlDbType.VarChar).Value = ent.ImplementAgencyCode;
                cmd.Parameters.Add("@IDescription", SqlDbType.VarChar).Value         = ent.Description;
                cmd.Parameters.Add("@IShortDescription", SqlDbType.VarChar).Value    = ent.ShortDescription;

                con.Open();

                cmd.ExecuteNonQuery();

                con.Close();
            }

            return(0);
        }
Ejemplo n.º 3
0
        public static List <MImplementAgency> List()
        {
            List <MImplementAgency> lisQuery = new List <MImplementAgency>();

            using (SqlConnection con = new SqlConnection(ConnectionDB.GetConnectionString()))
            {
                try
                {
                    SqlCommand cmd = new SqlCommand("sp_ImplementAgency_Lis", con);
                    cmd.CommandTimeout = 0;
                    cmd.CommandType    = CommandType.StoredProcedure;
                    con.Open();

                    using (var reader = cmd.ExecuteReader())
                    {
                        while (reader.Read())
                        {
                            MImplementAgency entRow = new MImplementAgency();
                            entRow.ImplementAgencyId   = Convert.ToInt32(reader["ImplementAgencyId"]);
                            entRow.ImplementAgencyCode = Convert.ToString(reader["ImplementAgencyCode"]);
                            entRow.Description         = Convert.ToString(reader["Description"]);
                            entRow.ShortDescription    = Convert.ToString(reader["ShortDescription"]);
                            lisQuery.Add(entRow);
                        }
                    }

                    con.Close();
                }
                catch (Exception ex)
                {
                    lisQuery = null;
                }
            }

            return(lisQuery);
        }
Ejemplo n.º 4
0
 public static int Insert(MImplementAgency ent)
 {
     return(DAImplementAgency.Insert(ent));
 }