Пример #1
0
        public async Task <string> Insert(Payment valPayment)
        {
            string vResult = string.Empty;

            try {
                ResponseGateway vProccessPayGateway = await InsertPaymentGateway(valPayment);

                GatewayService vGatewayService = new GatewayService();
                if (vProccessPayGateway != null && vProccessPayGateway.transactionResponse.state == "APPROVED")
                {
                    valPayment.IdTransaction   = vProccessPayGateway.transactionResponse.transactionId;
                    valPayment.GatewayJsonData = JsonConvert.SerializeObject(vProccessPayGateway);
                    SQLToolsLibrary     vSqlTools      = new SQLToolsLibrary();
                    List <SqlParameter> vParameterList = new List <SqlParameter> {
                        new SqlParameter("@Id", valPayment.Id),
                        new SqlParameter("@IdTransaction", !(valPayment.IdTransaction == Guid.Empty) ? valPayment.IdTransaction : Guid.Empty),
                        new SqlParameter("@GatewayJsonGata", !string.IsNullOrEmpty(valPayment.GatewayJsonData) ? valPayment.GatewayJsonData : "{}"),
                        new SqlParameter("@IdUser", valPayment.IdUser != Guid.Empty ? valPayment.IdUser : throw new Exception(GlobalValues.vTextExceptionParameterNull)),
                        new SqlParameter("@IdActivity", valPayment.IdActivity != Guid.Empty ? valPayment.IdActivity : throw new Exception(GlobalValues.vTextExceptionParameterNull)),
                        new SqlParameter("@Mount", valPayment.Mount),
                        new SqlParameter("@IdCurrency", valPayment.IdCurrency != Guid.Empty ? valPayment.IdCurrency : throw new Exception(GlobalValues.vTextExceptionParameterNull)),
                        new SqlParameter("@FirstName", !string.IsNullOrEmpty(valPayment.FirstName) ? valPayment.FirstName : throw new Exception(GlobalValues.vTextExceptionParameterNull)),
                        new SqlParameter("@LastName", !string.IsNullOrEmpty(valPayment.LastName) ? valPayment.LastName : throw new Exception(GlobalValues.vTextExceptionParameterNull)),
                        new SqlParameter("@TypeNumberDocument", !string.IsNullOrEmpty(valPayment.TypeNumberDocument) ? valPayment.TypeNumberDocument : throw new Exception(GlobalValues.vTextExceptionParameterNull)),
                        new SqlParameter("@NumberDocument", !string.IsNullOrEmpty(valPayment.NumberDocument) ? valPayment.NumberDocument : throw new Exception(GlobalValues.vTextExceptionParameterNull)),
                        new SqlParameter("@Email", !string.IsNullOrEmpty(valPayment.Email) ? valPayment.Email : throw new Exception(GlobalValues.vTextExceptionParameterNull)),
                        new SqlParameter("@Phone", !string.IsNullOrEmpty(valPayment.Phone) ? valPayment.Phone : throw new Exception(GlobalValues.vTextExceptionParameterNull)),
                        new SqlParameter("@Persons", valPayment.Persons),
                        new SqlParameter("@DateReserve", valPayment.DateReserve),
                        new SqlParameter("@State", valPayment.State),
                        new SqlParameter("@UserCreate", !string.IsNullOrEmpty(valPayment.UserCreate) ? valPayment.UserCreate : string.Empty),
                        new SqlParameter("@DateCreate", valPayment.DateCreate)
                    };
                    bool vInsert = vSqlTools.ExecuteIUWithStoreProcedure(vParameterList, "sp_Insert_Payment", vConnection);

                    if (vInsert)
                    {
                        SenderMail vSenderMail = new SenderMail();
                        await vSenderMail.SendEmailWithPayment(valPayment);

                        await vSenderMail.SendEmailToCompanies(valPayment);

                        vResult = "1";
                        vResult = "1";
                    }
                    else
                    {
                        vResult = "3";
                    }
                }
                else
                {
                    vResult = GatewayUtils.ProccessingResponseGateway(vProccessPayGateway.transactionResponse.state);
                }
            } catch (Exception vEx) {
                string vMessage = vEx.Message;
                vResult = "4";
            }
            return(vResult);
        }
Пример #2
0
        public bool Update(Company valCompany)
        {
            bool            vResult   = false;
            SQLToolsLibrary vSqlTools = new SQLToolsLibrary();

            try {
                List <SqlParameter> vParameterList = new List <SqlParameter>();
                Company             vCompanyOld    = new Company();
                vParameterList.Add(new SqlParameter("@Id", valCompany.Id));
                DataTable vDatainTable = vSqlTools.ExcecuteSelectWithStoreProcedure(vParameterList, "sp_Select_Company", "Master");
                vCompanyOld = DataTableToElement(vDatainTable);

                if (vCompanyOld != null)
                {
                    vParameterList.Add(new SqlParameter("@Name", !string.Equals(valCompany.Name, vCompanyOld.Name) ? valCompany.Name : vCompanyOld.Name));
                    vParameterList.Add(new SqlParameter("@TypeNumberDocument", !string.Equals(valCompany.TypeNumberDocument, vCompanyOld.TypeNumberDocument) ? valCompany.TypeNumberDocument : vCompanyOld.TypeNumberDocument));
                    vParameterList.Add(new SqlParameter("@NumberDocument", !string.Equals(valCompany.NumberDocument, vCompanyOld.NumberDocument) ? valCompany.NumberDocument : vCompanyOld.NumberDocument));
                    vParameterList.Add(new SqlParameter("@Phone", !string.Equals(valCompany.Phone, vCompanyOld.Phone) ? valCompany.Phone : vCompanyOld.Phone));
                    vParameterList.Add(new SqlParameter("@Movil", !string.Equals(valCompany.Movil, vCompanyOld.Movil) ? valCompany.Movil : vCompanyOld.Movil));
                    vParameterList.Add(new SqlParameter("@UrlPhoto", !string.Equals(valCompany.UrlPhoto, vCompanyOld.UrlPhoto) ? valCompany.UrlPhoto : vCompanyOld.UrlPhoto));
                    vParameterList.Add(new SqlParameter("@Address", !string.Equals(valCompany.Address, vCompanyOld.Address) ? valCompany.Address : vCompanyOld.Address));
                    vParameterList.Add(new SqlParameter("@IdDistrict", !Equals(valCompany.IdDistrict, vCompanyOld.IdDistrict) ? valCompany.IdDistrict : vCompanyOld.IdDistrict));
                    vParameterList.Add(new SqlParameter("@Email1", !string.Equals(valCompany.Email1, vCompanyOld.Email1) ? valCompany.Email1 : vCompanyOld.Email1));
                    vParameterList.Add(new SqlParameter("@Email2", !string.Equals(valCompany.Email2, vCompanyOld.Email2) ? valCompany.Email2 : vCompanyOld.Email2));
                    vParameterList.Add(new SqlParameter("@IsEnable", !Equals(valCompany.IsEnable, vCompanyOld.IsEnable) ? valCompany.IsEnable : vCompanyOld.IsEnable));
                    vParameterList.Add(new SqlParameter("@State", !Equals(valCompany.State, vCompanyOld.State) ? valCompany.State : vCompanyOld.State));
                    vParameterList.Add(new SqlParameter("@UserUpdate", valCompany.UserUpdate));
                    vResult = vSqlTools.ExecuteIUWithStoreProcedure(vParameterList, "sp_Update_Company", "Master");
                }
            } catch (Exception) {
                vResult = false;
            }
            return(vResult);
        }
Пример #3
0
        public bool Insert(Company valCompany)
        {
            bool                vResult        = false;
            SQLToolsLibrary     vSqlTools      = new SQLToolsLibrary();
            List <SqlParameter> vParameterList = new List <SqlParameter> {
                new SqlParameter("@Id", Guid.NewGuid()),
                new SqlParameter("@Name", !string.IsNullOrEmpty(valCompany.Name) ? valCompany.Name : string.Empty),
                new SqlParameter("@TypeNumberDocument", !string.IsNullOrEmpty(valCompany.TypeNumberDocument) ? valCompany.TypeNumberDocument : string.Empty),
                new SqlParameter("@NumberDocument", !string.IsNullOrEmpty(valCompany.NumberDocument) ? valCompany.NumberDocument : string.Empty),
                new SqlParameter("@Phone", !string.IsNullOrEmpty(valCompany.Phone) ? valCompany.Phone : string.Empty),
                new SqlParameter("@Movil", !string.IsNullOrEmpty(valCompany.Movil) ? valCompany.Movil : string.Empty),
                new SqlParameter("@UrlPhoto", !string.IsNullOrEmpty(valCompany.UrlPhoto) ? valCompany.UrlPhoto : string.Empty),
                new SqlParameter("@Address", !string.IsNullOrEmpty(valCompany.Address) ? valCompany.Address : string.Empty),
                new SqlParameter("@IdDistrict", valCompany.IdDistrict),
                new SqlParameter("@Email1", !string.IsNullOrEmpty(valCompany.Email1) ? valCompany.Email1 : string.Empty),
                new SqlParameter("@Email2", !string.IsNullOrEmpty(valCompany.Email2) ? valCompany.Email1 : string.Empty),
                new SqlParameter("@IsEnable", valCompany.IsEnable),
                new SqlParameter("@State", valCompany.State),
                new SqlParameter("@UserCreate", !string.IsNullOrEmpty(valCompany.UserCreate) ? valCompany.UserCreate : string.Empty),
                new SqlParameter("@DateCreate", DateTime.Now)
            };

            vResult = vSqlTools.ExecuteIUWithStoreProcedure(vParameterList, "sp_Insert_Company", "Master");
            return(vResult);
        }
Пример #4
0
        public string UpdateUser(User valUser)
        {
            string vResult = "4";

            try {
                SQLToolsLibrary     vSqlTools      = new SQLToolsLibrary();
                List <SqlParameter> vParameterList = new List <SqlParameter> {
                    new SqlParameter("@Id", valUser.Id != Guid.Empty ? valUser.Id : throw new Exception(GlobalValues.vTextExceptionParameterNull)),
                    new SqlParameter("@TypeNumberDocument", !string.IsNullOrEmpty(valUser.TypeNumberDocument) ? valUser.TypeNumberDocument : string.Empty),
                    new SqlParameter("@NumberDocument", !string.IsNullOrEmpty(valUser.NumberDocument) ? valUser.NumberDocument : string.Empty),
                    new SqlParameter("@Nacionality", !string.IsNullOrEmpty(valUser.Nacionality) ? valUser.Nacionality : string.Empty),
                    new SqlParameter("@Password", !string.IsNullOrEmpty(valUser.Password) ? valUser.Password : throw new Exception(GlobalValues.vTextExceptionParameterNull)),
                    new SqlParameter("@FirstName", !string.IsNullOrEmpty(valUser.FirstName) ? valUser.FirstName : throw new Exception(GlobalValues.vTextExceptionParameterNull)),
                    new SqlParameter("@SecondName", !string.IsNullOrEmpty(valUser.SecondName) ? valUser.SecondName : string.Empty),
                    new SqlParameter("@FirstLastName", !string.IsNullOrEmpty(valUser.FirstLastName) ? valUser.FirstLastName : throw new Exception(GlobalValues.vTextExceptionParameterNull)),
                    new SqlParameter("@SecondLastName", !string.IsNullOrEmpty(valUser.SecondLastName) ? valUser.SecondLastName : string.Empty),
                    new SqlParameter("@BirthDate", valUser.BirthDate != DateTime.MinValue ? valUser.BirthDate : new DateTime(1900, 1, 1)),
                    new SqlParameter("@IdMasterCity", valUser.IdMasterCity != Guid.Empty ? valUser.IdMasterCity : Guid.Empty),
                    new SqlParameter("@Phone", !string.IsNullOrEmpty(valUser.Phone) ? valUser.Phone : string.Empty),
                    new SqlParameter("@IdCompany", valUser.IdCompany != Guid.Empty ? valUser.IdCompany : Guid.Empty),
                    new SqlParameter("@UserUpdate", !string.IsNullOrEmpty(valUser.UserCreate) ? valUser.UserCreate : string.Empty),
                    new SqlParameter("@DateUpdate", DateTime.Now)
                };

                bool vUpdate = vSqlTools.ExecuteIUWithStoreProcedure(vParameterList, "sp_Update_User", vConnection);
                if (vUpdate)
                {
                    vResult = "1";
                }
            } catch (Exception e) {
                string vMsg = e.Message;
                vResult = "3";
            }
            return(vResult);
        }
Пример #5
0
        public string UpdateRanking(Payment valPayment)
        {
            string vResult = string.Empty;

            try {
                SQLToolsLibrary     vSqlTools      = new SQLToolsLibrary();
                List <SqlParameter> vParameterList = new List <SqlParameter> {
                    new SqlParameter("@Id", valPayment.Id),
                    new SqlParameter("@IdActivity", valPayment.IdActivity != Guid.Empty ? valPayment.IdActivity : throw new Exception(GlobalValues.vTextExceptionParameterNull)),
                    new SqlParameter("@Ranking", valPayment.Ranking),
                    new SqlParameter("@UserUpdate", !string.IsNullOrEmpty(valPayment.UserUpdate) ? valPayment.UserUpdate : string.Empty),
                    new SqlParameter("@DateUpdate", DateTime.Now)
                };
                bool vInsert = vSqlTools.ExecuteIUWithStoreProcedure(vParameterList, "sp_Update_Payment_Activity_Ranking", vConnection);
                if (vInsert)
                {
                    vResult = "1";
                }
                else
                {
                    vResult = "4";
                }
            } catch (Exception) {
                vResult = "4";
            }
            return(vResult);
        }
Пример #6
0
        public bool Update(City valCity)
        {
            bool            vResult   = false;
            SQLToolsLibrary vSqlTools = new SQLToolsLibrary();

            try {
                List <SqlParameter> vParameterList = new List <SqlParameter>();
                if (valCity.Position >= GlobalValues.vZeroValuePosition)
                {
                    vParameterList.Add(new SqlParameter("@Position", valCity.Position));
                }
                if (!string.IsNullOrEmpty(valCity.Name))
                {
                    vParameterList.Add(new SqlParameter("@Name", valCity.Name));
                }
                vParameterList.Add(new SqlParameter("@Id", valCity.Id));
                vParameterList.Add(new SqlParameter("@State", GlobalValues.vDefaultValueState));
                vParameterList.Add(new SqlParameter("@UserUpdate", valCity.UserUpdate));
                vParameterList.Add(new SqlParameter("@DateUpdate", DateTime.Now));
                vResult = vSqlTools.ExecuteIUWithStoreProcedure(vParameterList, "sp_Update_City", "Master");
            } catch (Exception) {
                vResult = false;
            }
            return(vResult);
        }
Пример #7
0
        public string UpdateStateUser(Guid valId, int valState)
        {
            string          vResult = "4";
            SQLToolsLibrary vSTools = new SQLToolsLibrary();

            try {
                int vState = VerifyStateFront(valState);
                if (vState < 2)
                {
                    List <SqlParameter> vParameterList = new List <SqlParameter> {
                        new SqlParameter("@Id", valId != Guid.Empty ? valId :throw new Exception(GlobalValues.vTextExceptionParameterNull)),
                        new SqlParameter("@State", vState != int.MinValue ? vState : 0)
                    };

                    bool vUpdate = vSTools.ExecuteIUWithStoreProcedure(vParameterList, "sp_update_User_State", vConnection);
                    if (vUpdate)
                    {
                        vResult = "1";
                    }
                }
            } catch (Exception vEx) {
                string vMessage = vEx.Message;
                vResult = "3";
            }
            return(vResult);
        }
Пример #8
0
        public bool InsertarListaCityLanguage(List <City> valCity, Guid valIdCity)
        {
            bool vResult = false;

            try {
                SQLToolsLibrary vSqlTools = new SQLToolsLibrary();
                foreach (var vRow in valCity)
                {
                    List <SqlParameter> vParameterListCL = new List <SqlParameter> {
                        new SqlParameter("@Id", Guid.NewGuid()),
                        new SqlParameter("@IdCity", valIdCity != Guid.Empty?valIdCity:throw new Exception(GlobalValues.vTextExceptionParameterNull)),
                        new SqlParameter("@IdLanguage", vRow.IdLanguage != Guid.Empty?vRow.IdLanguage:throw new Exception(GlobalValues.vTextExceptionParameterNull)),
                        new SqlParameter("@Slogan", !string.IsNullOrEmpty(vRow.Slogan)?vRow.Slogan:throw new Exception(GlobalValues.vTextExceptionParameterNull)),
                        new SqlParameter("@Description", !string.IsNullOrEmpty(vRow.Description)?vRow.Description:throw new Exception(GlobalValues.vTextExceptionParameterNull)),
                        new SqlParameter("@Location", !string.IsNullOrEmpty(vRow.Location)?vRow.Location:throw new Exception(GlobalValues.vTextExceptionParameterNull)),
                        new SqlParameter("@FarmingProduction", !string.IsNullOrEmpty(vRow.FarmingProduction)?vRow.FarmingProduction:throw new Exception(GlobalValues.vTextExceptionParameterNull)),
                        new SqlParameter("@DescriptionDistricts", !string.IsNullOrEmpty(vRow.DescriptionDistricts)?vRow.DescriptionDistricts:throw new Exception(GlobalValues.vTextExceptionParameterNull)),
                        new SqlParameter("@State", vRow.State),
                        new SqlParameter("@UserCreate", !string.IsNullOrEmpty(vRow.UserCreate)?vRow.UserCreate:throw new Exception(GlobalValues.vTextExceptionParameterNull)),
                        new SqlParameter("@DateCreate", vRow.DateCreate != DateTime.MinValue?vRow.DateCreate:DateTime.Now),
                    };
                    bool vResponseCityLanguage = vSqlTools.ExecuteIUWithStoreProcedure(vParameterListCL, "sp_Insert_CityLanguage", vConnection);
                    if (vResponseCityLanguage)
                    {
                        vResult = true;
                    }
                }
            } catch (Exception vEx) {
                string vMessage = vEx.Message;
            }
            return(vResult);
        }
Пример #9
0
        public string UpdateStateUserPortal(UserPortalAdmin valUserPortal)
        {
            string          vResult   = "4";
            SQLToolsLibrary vSqlTools = new SQLToolsLibrary();

            try {
                int valState = VerifyState(valUserPortal.State);
                if (valState < 2)
                {
                    List <SqlParameter> valParameterList = new List <SqlParameter> {
                        new SqlParameter("@Id", valUserPortal.Id),
                        new SqlParameter("@State", valState)
                    };
                    bool vSuccessUpdate = vSqlTools.ExecuteIUWithStoreProcedure(valParameterList, "sp_Update_State_User_Portal", vConnection);
                    if (vSuccessUpdate)
                    {
                        vResult = "1";
                    }
                }
            } catch (Exception vEx) {
                string vMsg = vEx.Message;
                vResult = "3";
            }
            return(vResult);
        }
Пример #10
0
        public string UpdateUserPortal(UserPortalAdmin valUSerPortal)
        {
            string vResult = "4";

            try {
                SQLToolsLibrary     vSqlTools         = new SQLToolsLibrary();
                List <SqlParameter> vListofParameters = new List <SqlParameter> {
                    new SqlParameter("@Id", valUSerPortal.Id),
                    new SqlParameter("@Password", !string.IsNullOrEmpty(valUSerPortal.Password)?valUSerPortal.Password:throw new Exception(GlobalValues.vTextExceptionParameterNull)),
                    new SqlParameter("@FirstName", !string.IsNullOrEmpty(valUSerPortal.FirstName)?valUSerPortal.FirstName:throw new Exception(GlobalValues.vTextExceptionParameterNull)),
                    new SqlParameter("@SecondName", valUSerPortal.SecondName),
                    new SqlParameter("@FirstLastname", !string.IsNullOrEmpty(valUSerPortal.FirstLastName)?valUSerPortal.FirstLastName:throw new Exception(GlobalValues.vTextExceptionParameterNull)),
                    new SqlParameter("@SecondLastName", valUSerPortal.SecondLastName),
                    new SqlParameter("@UrlPhoto", valUSerPortal.UrlPhoto),
                    new SqlParameter("@BirthDate", valUSerPortal.BirthDate != DateTime.MinValue ? valUSerPortal.BirthDate : new DateTime(1900, 1, 1)),
                    new SqlParameter("@Phone", valUSerPortal.Phone),
                    new SqlParameter("@backmail", !string.IsNullOrEmpty(valUSerPortal.Backmail)?valUSerPortal.Backmail:throw new Exception(GlobalValues.vTextExceptionParameterNull)),
                    new SqlParameter("@IdCompany", valUSerPortal.IdCompany != Guid.Empty?valUSerPortal.IdCompany:throw new Exception(GlobalValues.vTextExceptionParameterNull)),
                    new SqlParameter("@UserUpdate", !string.IsNullOrEmpty(valUSerPortal.UserUpdate)?valUSerPortal.UserUpdate:throw new Exception(GlobalValues.vTextExceptionParameterNull)),
                    new SqlParameter("@DateUpdate", DateTime.Now),
                };
                bool vSuccessUpdate = vSqlTools.ExecuteIUWithStoreProcedure(vListofParameters, "sp_Update_User_Portal", vConnection);
                if (vSuccessUpdate)
                {
                    vResult = "1";
                }
            } catch (Exception e) {
                string vMsg = e.Message;
                vResult = "3";
            }
            return(vResult);
        }
Пример #11
0
        public bool SaveFile(FileViewModel valFile)
        {
            bool vResult = false;

            SQLToolsLibrary vSqlTools = new SQLToolsLibrary();

            try {
                List <SqlParameter> vParameterList = new List <SqlParameter>();
                vParameterList.Add(new SqlParameter("@STRID", valFile.Id.ToString()));
                vParameterList.Add(new SqlParameter("@STRNAME", valFile.Name));
                vParameterList.Add(new SqlParameter("@STRVISUALNAME", valFile.VisualName));
                vParameterList.Add(new SqlParameter("@STRTHUMBNAIL", valFile.Thumbnail));
                vParameterList.Add(new SqlParameter("@STRABSOLUTEURL", valFile.Url));
                vParameterList.Add(new SqlParameter("@STRICON", valFile.Icon));
                vParameterList.Add(new SqlParameter("@STREXTENSION", valFile.Extension));
                vParameterList.Add(new SqlParameter("@INTSIZE", valFile.Size));
                vParameterList.Add(new SqlParameter("@STRIDFOLDER", valFile.IdFolder.ToString()));
                vParameterList.Add(new SqlParameter("@INTSTATE", valFile.State));
                vParameterList.Add(new SqlParameter("@STRUSERCREATE", valFile.UserCreate));
                bool vInsert = vSqlTools.ExecuteIUWithStoreProcedure(vParameterList, "sp_Insert_File_User");
                vResult = vInsert;
            } catch (Exception vEx) {
                string vMessage = vEx.Message;
            }
            return(vResult);
        }
Пример #12
0
        public async Task <string> Insert(ListCityLanguage valCity)
        {
            string vResult = "4";

            try {
                City vUserExist = SelectUserPortalByName(valCity.ListCity.FirstOrDefault().Name);
                if (vUserExist != null)
                {
                    vResult = "5";
                }
                else if (vUserExist == null)
                {
                    string vUrl = await UploadAzureHelper.UploadFilesToBlobStorageContainer(valCity.ListCity.FirstOrDefault().Photo?.NameFile, valCity.ListCity.FirstOrDefault().Photo?.FileData);

                    if (vUrl != null)
                    {
                        SQLToolsLibrary     vSqlTools      = new SQLToolsLibrary();
                        Guid                IdCity         = Guid.NewGuid();
                        List <SqlParameter> vParameterList = new List <SqlParameter> {
                            new SqlParameter("@Id", IdCity != Guid.Empty?IdCity:throw new Exception(GlobalValues.vTextExceptionParameterNull)),
                            new SqlParameter("@Name", !string.IsNullOrEmpty(valCity.ListCity.FirstOrDefault().Name)?valCity.ListCity.FirstOrDefault().Name:throw new Exception(GlobalValues.vTextExceptionParameterNull)),
                            new SqlParameter("@Icon", !string.IsNullOrEmpty(valCity.ListCity.FirstOrDefault().Icon)?valCity.ListCity.FirstOrDefault().Icon:throw new Exception(GlobalValues.vTextExceptionParameterNull)),
                            new SqlParameter("@Temperature", valCity.ListCity.FirstOrDefault().Temperature != int.MinValue?valCity.ListCity.FirstOrDefault().Temperature:throw new Exception(GlobalValues.vTextExceptionParameterNull)),
                            new SqlParameter("@Altitude", valCity.ListCity.FirstOrDefault().Altitude != int.MinValue?valCity.ListCity.FirstOrDefault().Altitude:throw new Exception(GlobalValues.vTextExceptionParameterNull)),
                            new SqlParameter("@Population", valCity.ListCity.FirstOrDefault().Population != int.MinValue?valCity.ListCity.FirstOrDefault().Population:throw new Exception(GlobalValues.vTextExceptionParameterNull)),
                            new SqlParameter("@UrlPhoto", !string.IsNullOrEmpty(vUrl) ? vUrl : throw new Exception(GlobalValues.vTextExceptionParameterNull)),
                            new SqlParameter("@Position", valCity.ListCity.FirstOrDefault().Position != int.MinValue?valCity.ListCity.FirstOrDefault().Position:0),
                            new SqlParameter("@State", valCity.ListCity.FirstOrDefault().State),
                            new SqlParameter("@UserCreate", !string.IsNullOrEmpty(valCity.ListCity.FirstOrDefault().UserCreate) ? valCity.ListCity.FirstOrDefault().UserCreate : throw new Exception(GlobalValues.vTextExceptionParameterNull)),
                            new SqlParameter("@DateCreate", valCity.ListCity.FirstOrDefault().DateCreate != DateTime.MinValue ? valCity.ListCity.FirstOrDefault().DateCreate:DateTime.Now)
                        };
                        bool vResponseCityLanguage = InsertarListaCityLanguage(valCity.ListCity, IdCity);
                        bool vResponseCity         = vSqlTools.ExecuteIUWithStoreProcedure(vParameterList, "sp_Insert_City", vConnection);

                        if (vResponseCity)
                        {
                            if (vResponseCityLanguage)
                            {
                                return(vResult = "1");
                            }
                            return(vResult = "2");
                        }
                    }
                }
            } catch (Exception vEx) {
                string vMessage = vEx.Message;
                return(vResult = "3");
            }
            return(vResult);
        }
Пример #13
0
        public string Insert(User valUser)
        {
            string vResult = string.Empty;

            try {
                User vUserExist = SelectByEmail(valUser.Email);
                if (vUserExist != null)
                {
                    vResult = "3";
                }
                else if (vUserExist == null)
                {
                    SQLToolsLibrary     vSqlTools      = new SQLToolsLibrary();
                    List <SqlParameter> vParameterList = new List <SqlParameter> {
                        new SqlParameter("@Id", Guid.NewGuid()),
                        new SqlParameter("@TypeNumberDocument", !string.IsNullOrEmpty(valUser.TypeNumberDocument) ? valUser.TypeNumberDocument : string.Empty),
                        new SqlParameter("@NumberDocument", !string.IsNullOrEmpty(valUser.NumberDocument) ? valUser.NumberDocument : string.Empty),
                        new SqlParameter("@Nacionality", !string.IsNullOrEmpty(valUser.Nacionality) ? valUser.Nacionality : string.Empty),
                        new SqlParameter("@UserName", valUser.UserName),
                        new SqlParameter("@Password", valUser.Password),
                        new SqlParameter("@FirstName", valUser.FirstName),
                        new SqlParameter("@SecondName", !string.IsNullOrEmpty(valUser.SecondName) ? valUser.SecondName : string.Empty),
                        new SqlParameter("@FirstLastName", valUser.FirstLastName),
                        new SqlParameter("@SecondLastName", !string.IsNullOrEmpty(valUser.SecondLastName) ? valUser.SecondLastName : string.Empty),
                        new SqlParameter("@Email", !string.IsNullOrEmpty(valUser.Email) ? valUser.Email : string.Empty),
                        new SqlParameter("@UrlPhoto", !string.IsNullOrEmpty(valUser.UrlPhoto) ? valUser.UrlPhoto : string.Empty),
                        new SqlParameter("@BirthDate", valUser.BirthDate != DateTime.MinValue ? valUser.BirthDate : new DateTime(1900, 1, 1)),
                        new SqlParameter("@IdMasterCity", valUser.IdMasterCity != Guid.Empty ? valUser.IdMasterCity : Guid.Empty),
                        new SqlParameter("@Phone", !string.IsNullOrEmpty(valUser.Phone) ? valUser.Phone : string.Empty),
                        new SqlParameter("@IdCompany", valUser.IdCompany != Guid.Empty ? valUser.IdCompany : Guid.Empty),
                        new SqlParameter("@State", valUser.State),
                        new SqlParameter("@UserCreate", !string.IsNullOrEmpty(valUser.UserCreate) ? valUser.UserCreate : string.Empty),
                        new SqlParameter("@DateCreate", DateTime.Now)
                    };
                    bool vInsert = vSqlTools.ExecuteIUWithStoreProcedure(vParameterList, "sp_Insert_UserLogin", vConnection);
                    if (vInsert)
                    {
                        vResult = "1";
                    }
                    else
                    {
                        vResult = "4";
                    }
                }
            } catch (Exception) {
                vResult = "4";
            }
            return(vResult);
        }
Пример #14
0
        public void UpdateUrlFile(Guid valGuidName, string valUrl)
        {
            bool vResult = false;

            SQLToolsLibrary vSqlTools = new SQLToolsLibrary();

            try {
                List <SqlParameter> vParameterList = new List <SqlParameter>();
                vParameterList.Add(new SqlParameter("@STRID", valGuidName.ToString()));
                vParameterList.Add(new SqlParameter("@STRURL", valUrl));
                bool vUpdate = vSqlTools.ExecuteIUWithStoreProcedure(vParameterList, "sp_Update_File_Url");
            } catch (Exception) {
                throw;
            }
        }
Пример #15
0
        public async Task <string> CancelAndRefund(Payment valPayment)
        {
            string vResult = string.Empty;

            try {
                ResponseGatewayRefund vProccessPayGateway = await Refund(valPayment);

                GatewayService vGatewayService = new GatewayService();
                // if (vProccessPayGateway != null && vProccessPayGateway.transactionResponse.state == "PENDING" && vProccessPayGateway.code != "ERROR") {

                valPayment.GatewayJsonData = JsonConvert.SerializeObject(vProccessPayGateway);
                SQLToolsLibrary     vSqlTools      = new SQLToolsLibrary();
                List <SqlParameter> vParameterList = new List <SqlParameter> {
                    new SqlParameter("@Id", valPayment.Id),
                    new SqlParameter("@GatewayJsonData", !string.IsNullOrEmpty(valPayment.GatewayJsonData) ? valPayment.GatewayJsonData : "{}"),
                    new SqlParameter("@UserUpdate", valPayment.UserUpdate),
                    new SqlParameter("@DateUpdate", valPayment.DateUpdate)
                };
                bool vUpdate = vSqlTools.ExecuteIUWithStoreProcedure(vParameterList, "sp_Cancel_Payment", vConnection);

                if (vUpdate)
                {
                    SenderMail vSenderMail = new SenderMail();
                    Payment    vPaymenNew  = SelectById(valPayment.Id, valPayment.IdLanguage);
                    vPaymenNew.LanguageInitials = valPayment.LanguageInitials;
                    await vSenderMail.SendEmailClientWithCancelAndRefund(vPaymenNew);

                    ICompanyData vCompanyData = new CompanyData();
                    Company      vCompany     = vCompanyData.SelectCompanyByPayment(valPayment.Id);
                    vPaymenNew.EmailCompany1 = vCompany.Email1;
                    vPaymenNew.EmailCompany2 = vCompany.Email2;
                    await vSenderMail.SendEmailCompaniesWithCancelAndRefund(vPaymenNew);

                    vResult = "1";
                }
                else
                {
                    vResult = "3";
                }
                //} else {
                //    vResult = GatewayUtils.ProccessingResponseGateway(vProccessPayGateway.transactionResponse.state);
                //}
            } catch (Exception vEx) {
                string vMessage = vEx.Message;
                vResult = "4";
            }
            return(vResult);
        }
Пример #16
0
        public async Task <string> InsertUserPortal(UserPortalAdmin valUser)
        {
            string vResult = "4";

            try {
                UserPortalAdmin vUserExist = SelectUserPortalByEmail(valUser.UserName);
                if (vUserExist != null)
                {
                    vResult = "2";
                }
                else if (vUserExist == null)
                {
                    string vUrl = await UploadAzureHelper.UploadFilesToBlobStorageContainer(valUser.Photo?.NameFile, valUser.Photo?.FileData);


                    SQLToolsLibrary vSqlTools = new SQLToolsLibrary();

                    List <SqlParameter> vListofParameters = new List <SqlParameter> {
                        new SqlParameter("@Id", valUser.Id != Guid.Empty ? valUser.Id : Guid.NewGuid()),
                        new SqlParameter("@UserName", !string.IsNullOrEmpty(valUser.UserName)?valUser.UserName:throw new Exception(GlobalValues.vTextExceptionParameterNull)),
                        new SqlParameter("@Password", !string.IsNullOrEmpty(valUser.Password)?valUser.Password:throw new Exception(GlobalValues.vTextExceptionParameterNull)),
                        new SqlParameter("@FirstName", !string.IsNullOrEmpty(valUser.FirstName)?valUser.FirstName:throw new Exception(GlobalValues.vTextExceptionParameterNull)),
                        new SqlParameter("@SecondName", valUser.SecondName),
                        new SqlParameter("@FirstLastname", !string.IsNullOrEmpty(valUser.FirstLastName)?valUser.FirstLastName:throw new Exception(GlobalValues.vTextExceptionParameterNull)),
                        new SqlParameter("@SecondLastName", valUser.SecondLastName),
                        new SqlParameter("@Email", !string.IsNullOrEmpty(valUser.UserName)?valUser.UserName:throw new Exception(GlobalValues.vTextExceptionParameterNull)),
                        new SqlParameter("@UrlPhoto", !string.IsNullOrEmpty(vUrl) ? vUrl : string.Empty),
                        new SqlParameter("@BirthDate", valUser.BirthDate != DateTime.MinValue ? valUser.BirthDate : new DateTime(1900, 1, 1)),
                        new SqlParameter("@Phone", valUser.Phone),
                        new SqlParameter("@backmail", !string.IsNullOrEmpty(valUser.Backmail)?valUser.Backmail:string.Empty),
                        new SqlParameter("@IdCompany", valUser.IdCompany != Guid.Empty?valUser.IdCompany:throw new Exception(GlobalValues.vTextExceptionParameterNull)),
                        new SqlParameter("@State", valUser.State),
                        new SqlParameter("@UserCreate", valUser.UserCreate /*!string.IsNullOrEmpty(valUser.UserCreate)?valUser.UserCreate:throw new Exception(GlobalValues.vTextExceptionParameterNull)*/),
                        new SqlParameter("@DateCreate", valUser.DateCreate != DateTime.MinValue ? valUser.DateCreate : DateTime.Now)
                    };
                    bool vSuccessInsert = vSqlTools.ExecuteIUWithStoreProcedure(vListofParameters, "sp_Insert_UserPortal", vConnection);
                    if (vSuccessInsert)
                    {
                        vResult = "1";
                    }
                }
            } catch (Exception e) {
                string vMsg = e.Message;
                vResult = "3";
            }
            return(vResult);
        }
Пример #17
0
        public bool Insert(City valCity)
        {
            bool            vResult   = false;
            SQLToolsLibrary vSqlTools = new SQLToolsLibrary();

            try {
                List <SqlParameter> vParameterList = new List <SqlParameter> {
                    new SqlParameter("@Id", Guid.NewGuid()),
                    new SqlParameter("@Name", !string.IsNullOrEmpty(valCity.Name) ? valCity.Name : string.Empty),
                    new SqlParameter("@Position", valCity.Position >= 0 ? valCity.Position : 0),
                    new SqlParameter("@State", GlobalValues.vDefaultValueState),
                    new SqlParameter("@UserCreate", !string.IsNullOrEmpty(valCity.UserCreate) ? valCity.UserCreate : string.Empty),
                    new SqlParameter("@DateCreate", DateTime.Now)
                };
                vResult = vSqlTools.ExecuteIUWithStoreProcedure(vParameterList, "sp_Insert_City", "Master");
            } catch (Exception) {
                vResult = false;
            }
            return(vResult);
        }
Пример #18
0
        public string UpdateState(City valCity)
        {
            string          vResult   = "4";
            SQLToolsLibrary vSqlTools = new SQLToolsLibrary();

            try {
                List <SqlParameter> vParameterList = new List <SqlParameter> {
                    new SqlParameter("@Id", valCity.Id),
                    new SqlParameter("@State", valCity.State)
                };
                bool vResponse = vSqlTools.ExecuteIUWithStoreProcedure(vParameterList, "sp_Update_City_State", vConnection);
                if (vResponse)
                {
                    vResult = "1";
                }
            } catch (Exception vEx) {
                string vMessage = vEx.Message;
                vResult = "3";
            }
            return(vResult);
        }
Пример #19
0
        public bool SaveFolder(FolderViewModel valFolder)
        {
            bool vResult = false;

            SQLToolsLibrary vSqlTools = new SQLToolsLibrary();

            try {
                List <SqlParameter> vParameterList = new List <SqlParameter>();
                vParameterList.Add(new SqlParameter("@STRID", valFolder.Id));
                vParameterList.Add(new SqlParameter("@STRNAME", valFolder.Name));
                vParameterList.Add(new SqlParameter("@STRVISUALNAME", valFolder.VisualName));
                vParameterList.Add(new SqlParameter("@STRTHUMBNAIL", valFolder.Thumnail));
                vParameterList.Add(new SqlParameter("@STRABSOLUTEURL", valFolder.Url));
                vParameterList.Add(new SqlParameter("@STRICON", Constants.vIconFolder));
                vParameterList.Add(new SqlParameter("@INTSTATE", valFolder.State));
                vParameterList.Add(new SqlParameter("@STRUSERCREATE", valFolder.UserCreate));
                bool vInsert = vSqlTools.ExecuteIUWithStoreProcedure(vParameterList, "sp_Insert_Folder_User");
                vResult = vInsert;
            } catch (Exception vEx) {
                string vMessage = vEx.Message;
            }
            return(vResult);
        }