Example #1
0
        public async Task <IActionResult> Get([FromBody] Common.Ac_Mtr_Agreement_Document model)
        {
            try
            {
                var message = new Message();
                message.BusinessLogic = configuration.GetValue <string>("AppSettings:BusinessLogic:Gbl_Mtr_Evidence");
                message.Connection    = configuration.GetValue <string>("ConnectionStrings:MEXPRESS_AC");
                message.Operation     = Operation.Get;
                message.MessageInfo   = model.SerializeObject();
                using (var businessLgic = new ServiceManager())
                {
                    var result = await businessLgic.DoWork(message);

                    if (result.Status == Status.Failed)
                    {
                        return(BadRequest(result.Result));
                    }
                    var resultModel = result.DeSerializeObject <Common.Ac_Mtr_Agreement_Document>();
                    var dataSuccess = new
                    {
                        Data          = resultModel,
                        MessageResult = Backend.Common.Enum.Status.Success,
                        Message       = string.Empty,
                        RegisterType  = string.Empty
                    };
                    return(Ok(dataSuccess));
                }
            }
            catch (Exception ex)
            {
                return(BadRequest(ex));
            }
        }
Example #2
0
        private List <Common.Ac_Mtr_Agreement_Document> GetArchives(Dictionary <string, StringValues> fields)
        {
            var list     = new List <Common.Ac_Mtr_Agreement_Document>();
            var contador = (fields["Archive_New_Name"].Count);

            for (var x = 0; x < contador; x++)
            {
                var obj = new Common.Ac_Mtr_Agreement_Document();

                foreach (var dictionary in fields)
                {
                    if (dictionary.Key == "Archive_New_Name")
                    {
                        obj.Archive_New_Name = dictionary.Value[x];
                    }

                    else if (dictionary.Key == "Pk_Cat_Document_Agreement")
                    {
                        obj.Pk_Cat_Document_Agreement = Convert.ToInt32(dictionary.Value[x]);
                    }

                    else if (dictionary.Key == "Pk_Ac_Trade_Agreement")
                    {
                        obj.Pk_Ac_Trade_Agreement = Convert.ToInt64(dictionary.Value[x]);
                    }

                    else if (dictionary.Key == "Creation_User")
                    {
                        obj.Creation_User = dictionary.Value[x];
                    }

                    else if (dictionary.Key == "Modification_User")
                    {
                        obj.Modification_User = dictionary.Value[x];
                    }

                    else if (dictionary.Key == "Archive_Original_Name")
                    {
                        obj.Archive_Original_Name = dictionary.Value[x];
                    }

                    else if (dictionary.Key == "File_Description")
                    {
                        obj.File_Description = dictionary.Value[x];
                    }

                    else if (dictionary.Key == "Name_Agreement")
                    {
                        obj.Name_Agreement = dictionary.Value[x];
                    }

                    else if (dictionary.Key == "Active")
                    {
                        obj.Active = Convert.ToBoolean(dictionary.Value[x]);
                    }

                    else if (dictionary.Key == "Is_Invoice")
                    {
                        obj.Is_Invoice = Convert.ToBoolean(dictionary.Value[x]);
                    }
                }

                list.Add(obj);
            }

            return(list);
        }