예제 #1
0
    public void SetGameController(string scriptName) {

        GameObject gameControllerObject = GameObject.Find("Main Camera");

        if (gameControllerObject != null)
        {
            gameController = gameControllerObject.GetComponent(scriptName) as BaseFunctions;
        }
    }
예제 #2
0
        public async Task <bool> SaveUserToDB()
        {
            if (App.uploadStream != null)
            {
                string uploadImage = await UploadImageToServer();

                if (uploadImage.ToString() != "false")
                {
                    currentUser.userImage = uploadImage.ToString();
                }
            }
            currentUser.userFirstName           = FirstName.Text;
            currentUser.userLastName            = LastName.Text;
            currentUser.userPosition            = position.Text;
            currentUser.userCompany             = company.Text;
            currentUser.userPhone               = phone.Text;
            currentUser.userWebsite             = website.Text;
            currentUser.userAddress             = address.Text;
            currentUser.userDescription         = shortBio.Text;
            currentUser.userGplus               = userGPlus.Text;
            currentUser.userFacebook            = userFacebook.Text;
            currentUser.userCity                = city.Text;
            currentUser.userState               = states[state.SelectedIndex];
            currentUser.userPostal              = postal.Text;
            currentUser.userLinkedIn            = userLinkedIn.Text;
            currentUser.userTwitter             = userTwitter.Text;
            App.serverData.mei_user.currentUser = currentUser;
            App.serverData.SaveUserDataToLocal();
            if (!string.IsNullOrEmpty(oldImage) && currentUser.userImage != oldImage)
            {
                var k = await DeleteOldimage();

                Debug.WriteLine("Old Image deletion" + k.ToString());
            }
            return(await BaseFunctions.SaveUserToServer());
        }
예제 #3
0
        public ucTesting()
        {
            InitializeComponent();
            //Display comport
            BaseFunctions.display_Port_Name();
            //Binding data
            this.border_DUT01.DataContext = GlobalData.testingDataDut1;
            this.border_DUT02.DataContext = GlobalData.testingDataDut2;
            this.border_DUT03.DataContext = GlobalData.testingDataDut3;
            this.border_DUT04.DataContext = GlobalData.testingDataDut4;

            //this._loadSetting(); //Load setting
            BaseFunctions.connect_Instrument(); //Connect Instrument

            timer          = new DispatcherTimer();
            timer.Interval = new TimeSpan(0, 0, 0, 0, 500);
            timer.Tick    += ((sender, e) => {
                if (GlobalData.testingDataDut1.BUTTONENABLE == false)
                {
                    this._dut1scrollViewer.ScrollToEnd();
                }
                if (GlobalData.testingDataDut2.BUTTONENABLE == false)
                {
                    this._dut2scrollViewer.ScrollToEnd();
                }
                if (GlobalData.testingDataDut3.BUTTONENABLE == false)
                {
                    this._dut3scrollViewer.ScrollToEnd();
                }
                if (GlobalData.testingDataDut4.BUTTONENABLE == false)
                {
                    this._dut4scrollViewer.ScrollToEnd();
                }
            });
            timer.Start();
        }
예제 #4
0
        public async void EmailInvoiceFunction(object sender, EventArgs e)
        {
            await((HomeLayout)App.Current.MainPage).SetLoading(true, "Sending email...");
            string cardType = await App.serverData.GetTransactionInformation(transaction.transactionID, "trans_cardType");

            string card4 = await App.serverData.GetTransactionInformation(transaction.transactionID, "trans_last4");

            if (transaction.transactionType == "Sale")
            {
                bool sent = await BaseFunctions.EmailSaleInvoice(transaction, cardType + " ending with " + card4);

                await((HomeLayout)App.Current.MainPage).SetLoading(false, "Sending email...");
                if (sent)
                {
                    await App.Current.MainPage.DisplayAlert("Success", "Invoice has been sent to your email", "Ok");
                }
                else
                {
                    await App.Current.MainPage.DisplayAlert("Failed", "Something went wrong please retry.", "Ok");
                }
            }
            else if (transaction.transactionType == "Donation")
            {
                bool sent = await BaseFunctions.EmailDonationInvoice(transaction, cardType + " ending with " + card4);

                await((HomeLayout)App.Current.MainPage).SetLoading(false, "Sending email...");
                if (sent)
                {
                    await App.Current.MainPage.DisplayAlert("Success", "Invoice has been sent to your email", "Ok");
                }
                else
                {
                    await App.Current.MainPage.DisplayAlert("Failed", "Something went wrong please retry.", "Ok");
                }
            }
        }
        public async void SaveNote(object sender, EventHandler e)
        {
            if (currentNote.userNote != noteEditor.Text)
            {
                currentNote.userNote = noteEditor.Text;
                for (int i = 0; i < App.serverData.mei_user.noteList.Count; i++)
                {
                    if (App.serverData.mei_user.noteList[i].noteID == currentNote.noteID)
                    {
                        var cTime = DateTime.Now;
                        currentNote.noteDateTime            = cTime.ToString("MM/dd/yyyy hh:mm:ss tt");
                        App.serverData.mei_user.noteList[i] = currentNote;
                        await((HomeLayout)App.Current.MainPage).SetLoading(true, "Saving note...");
                        await BaseFunctions.EditNoteInServer(currentNote);

                        await((HomeLayout)App.Current.MainPage).SetLoading(false, "Deleting note...");
                    }
                }
            }
            noteEditor.Unfocus();
            //if(parentNotes!=null)
            //parentNotes.SetDetails();
            e(this, null);
        }
예제 #6
0
        public static string createActivationKey(byte pinCheckDigit)
        {
            byte[] buffer = BaseFunctions.secureRandom(14);
            buffer[0] = pinCheckDigit;
            string str = "";

            for (int i = 0; i < buffer.Length; i++)
            {
                str += (int)((buffer[i] % 10 < 0) ? (buffer[i] % 10 + 10) : (buffer[i] % 10));
            }
            string s    = str.Substring(0, 7);
            string str2 = str.Substring(7, 7);
            string str3 = string.Concat(BaseFunctions.calcChecksum(long.Parse(s), 7));
            string str4 = string.Concat(BaseFunctions.calcChecksum(long.Parse(str2), 7));

            return(string.Concat(new string[]
            {
                s,
                str3,
                "-",
                str2,
                str4
            }));
        }
        public PartialViewResult RoleRelatedUsersDelete(string role_id, string id)
        {
            GenelRepository         gnlDB = RepositoryManager.GetRepository <GenelRepository>();
            gnl_roles_related_users role_related_users = new gnl_roles_related_users();

            Role model    = new Role();
            Guid role_uid = Guid.Empty;
            Guid user_uid = Guid.Empty;

            if (Guid.TryParse(role_id, out role_uid) && BaseFunctions.getInstance().IsNumeric(id))
            {
                var obj = gnlDB.GetRoleRelatedUsersById(Convert.ToInt32(id));
                if (obj != null && obj.Count > 0)
                {
                    gnlDB.DeleteRoleRelatedUsers(obj[0]);
                }
            }

            List <gnl_role_related_users_v> listRoleRelatedUsers = gnlDB.GetRoleRelatedUsers(role_uid);

            model.roleRelatedUsers = listRoleRelatedUsers;

            return(PartialView("RoleRelatedUsers", model));
        }
        public static string createActivationKey(byte pinCheckDigit)
        {
            byte[] array = BaseFunctions.secureRandom(14);
            array[0] = pinCheckDigit;
            string text = "";

            for (int i = 0; i < array.Length; i++)
            {
                text += (int)((array[i] % 10 < 0) ? (array[i] % 10 + 10) : (array[i] % 10));
            }
            string text2 = text.Substring(0, 7);
            string text3 = text.Substring(7, 7);
            string text4 = string.Concat(BaseFunctions.calcChecksum(long.Parse(text2), 7));
            string text5 = string.Concat(BaseFunctions.calcChecksum(long.Parse(text3), 7));

            return(string.Concat(new string[]
            {
                text2,
                text4,
                "-",
                text3,
                text5
            }));
        }
 public static long createSequenceNumber()
 {
     byte[] array = BaseFunctions.secureRandom(2);
     return((long)(array[0] * 10 + array[1]));
 }
 public static byte[] createSeed(string pin, string activationKey)
 {
     return(HOTPCipherInitialize.derivateKey(BaseFunctions.convertStringToByteArray(activationKey), BaseFunctions.convertStringToByteArray(pin), 10, 32));
 }
        public async void SetAbout()
        {
            eventDescription.IsVisible = true;
            emptyList.IsVisible        = false;
            await((HomeLayout)App.Current.MainPage).SetLoading(true, "Syncing event RSVP status...");
            currentEvent = await((HomeLayout)App.Current.MainPage).GetCurrentDomainEventFromServer();
            if (currentEvent.s_event.eventType != "Subscription")
            {
                cancelSubscription.IsVisible = false;
            }
            else
            {
                subscription = App.serverData.mei_user.userSubscriptionList.Find(x => x.planID == currentEvent.s_event.eventSubscriptionPlanID);
                if (subscription != null)
                {
                    await((HomeLayout)App.Current.MainPage).SetLoading(true, "Syncing event RSVP status...");
                    string subStatus = await App.serverData.GetSubscriptionStatus(subscription.subscriptionID, "sub_status");

                    cancelSubscription.IsVisible = true;
                    if ((subStatus.Equals("Canceled") || subStatus.Equals("Expired")) && currentEvent.s_event.eventSubscriptionType != "Single")
                    {
                        cancelSubscription.IsEnabled = false;
                        if (subStatus.Equals("Canceled"))
                        {
                            cancelSubscription.Text = "Subscription Canceled";
                        }
                        else
                        {
                            cancelSubscription.Text = "Subscription Expired";
                        }
                    }
                    else if (currentEvent.s_event.eventSubscriptionType != "Single")
                    {
                        cancelSubscription.IsVisible = false;
                    }
                }
            }
            if (!string.IsNullOrEmpty(currentEvent.s_event.eventName))
            {
                eventName.Text = currentEvent.s_event.eventName;
            }
            else
            {
                eventName.Text = "No event name";
            }
            if (!string.IsNullOrEmpty(currentEvent.s_event.eventLogo))
            {
                aboutEventLogo.Source = currentEvent.s_event.eventLogo;
                Regex  initials = new Regex(@"(\b[a-zA-Z])[a-zA-Z]* ?");
                string init     = initials.Replace(currentEvent.s_event.eventName, "$1");
                if (init.Length > 3)
                {
                    init = init.Substring(0, 3);
                }
                logoText.Text = init.ToUpper();
            }
            else
            {
                aboutEventLogo.Source = "";
                Regex  initials = new Regex(@"(\b[a-zA-Z])[a-zA-Z]* ?");
                string init     = initials.Replace(currentEvent.s_event.eventName, "$1");
                if (init.Length > 3)
                {
                    init = init.Substring(0, 3);
                }
                logoText.Text = init.ToUpper();
            }
            if (!string.IsNullOrEmpty(currentEvent.s_event.eventVenueName))
            {
                eventVenueName.Text = currentEvent.s_event.eventVenueName;
            }
            else
            {
                eventVenueName.Text = "";
            }
            if (!string.IsNullOrEmpty(currentEvent.s_event.eventAbout))
            {
                eventDescription.Text = currentEvent.s_event.eventAbout;
            }
            else
            {
                eventDescription.IsVisible = false;
                emptyList.IsVisible        = true;
                if (!string.IsNullOrEmpty(currentEvent.s_event.eventDescription))
                {
                    eventDescription.Text = currentEvent.s_event.eventDescription;
                }
                else
                {
                    eventDescription.IsVisible = false;
                    emptyList.IsVisible        = true;
                }
            }
            if (!string.IsNullOrEmpty(currentEvent.s_event.eventAddress))
            {
                eventCityState.Text = currentEvent.s_event.eventAddress;
            }
            else
            {
                eventCityState.Text = "";
            }
            if (currentEvent.s_event.eventStartDate.Equals(currentEvent.s_event.eventEndDate))
            {
                eventDays.Text = BaseFunctions.getMonthDay(currentEvent.s_event.eventStartDate) + ", " + BaseFunctions.getYear(currentEvent.s_event.eventEndDate);
            }
            else
            {
                if (BaseFunctions.GetMonth(currentEvent.s_event.eventStartDate) == BaseFunctions.GetMonth(currentEvent.s_event.eventEndDate))
                {
                    eventDays.Text = BaseFunctions.getMonthDay(currentEvent.s_event.eventStartDate) + " - " + BaseFunctions.getDayYear(currentEvent.s_event.eventEndDate);
                }
                else
                {
                    eventDays.Text = BaseFunctions.getMonthDay(currentEvent.s_event.eventStartDate) + " - " + BaseFunctions.getMonthDay(currentEvent.s_event.eventEndDate) + ", " + BaseFunctions.getYear(currentEvent.s_event.eventEndDate);
                }
            }
            var k = await rsvpTemplate.CheckRSVP();

            await((HomeLayout)App.Current.MainPage).SetLoading(false, "Loading event sessions...");
        }
예제 #12
0
        public int InsertCierreKardex(int Accion, int UsuarioID, string Almacen, string ProductoID, string EmpresaID, string Periodo, int Anno, bool CostoCero, decimal Cantidad2, decimal CostoUnitario)
        {
            int       totalAfectados = 0;
            CD_Kardex ObjCD_Kardex   = new CD_Kardex(AppSettings.GetConnectionString);

            if (Accion == 1)
            {
                DataTable dtTMP  = new DataTable();
                DataTable dtTMP2 = new DataTable();
                if (CostoCero == false)
                {
                    //aplicar la lógica del cierre en el reporte mensual
                    if (ProductoID == "TODOS")
                    {
                        ProductoID = "";
                    }


                    DateTime FecInicial, FecFinal;
                    FecInicial = new DateTime(Anno, Convert.ToInt16(Periodo), 1);
                    FecFinal   = new DateTime(Anno, Convert.ToInt16(Periodo), 1).AddMonths(1);


                    dtTMP2 = new CL_Kardex().getDTKardex_varios(ProductoID, EmpresaID, FecInicial, FecFinal, Almacen, 1);
                    dtTMP  = new CL_Kardex().ArmarReporteKardex(dtTMP2);


                    //Seleccionamos disticnt de los productos
                    DataTable DtProductos = new DataTable();
                    DtProductos = dtTMP.DefaultView.ToTable(true, "ProductoID");

                    //tabla apra agregar los cierres
                    DataTable DTCierre = new DataTable("Cierre");
                    DTCierre.Columns.Add("ProductoID", typeof(string));
                    DTCierre.Columns.Add("Cantidad", typeof(decimal));
                    DTCierre.Columns.Add("CostoUnitario", typeof(decimal));


                    foreach (DataRow DRP in DtProductos.Rows)
                    {
                        //filtramos datos por producto
                        DataView Dv = new DataView(dtTMP, "ProductoID='" + DRP["ProductoID"].ToString() + "'", "ID DESC", DataViewRowState.CurrentRows);

                        DataRow DR = DTCierre.NewRow();
                        DR["ProductoID"]    = DRP["ProductoID"];
                        DR["Cantidad"]      = decimal.Round(Convert.ToDecimal(Dv[0]["FCantidad"]), 2);
                        DR["CostoUnitario"] = decimal.Round(Convert.ToDecimal(Dv[0]["FCostoUnitario"]), 2);
                        DTCierre.Rows.Add(DR);
                    }
                    string XML  = "";
                    string _xml = new BaseFunctions().GetXML(DTCierre).Replace("NewDataSet", "DocumentElement");
                    XML = _xml.Replace("Table", "Cierre");

                    //insercion masiva del kardex
                    totalAfectados = ObjCD_Kardex.InsertCierreKardex(Accion, XML, UsuarioID, null, null, EmpresaID, Periodo, Anno, false, Cantidad2, CostoUnitario);
                }
                else
                {
                    string XML = "";
                    totalAfectados = ObjCD_Kardex.InsertCierreKardex(Accion, XML, UsuarioID, Almacen, ProductoID, EmpresaID, Periodo, Anno, CostoCero, Cantidad2, CostoUnitario);
                }
            }
            else if (Accion == 2)
            {
                //ingreso manual
                totalAfectados = ObjCD_Kardex.InsertCierreKardex(Accion, "", UsuarioID, Almacen, ProductoID, EmpresaID, Periodo, Anno, CostoCero, Cantidad2, CostoUnitario);
            }
            return(totalAfectados);
        }
예제 #13
0
 public async void SetCurrentEventReminder(object sender, EventArgs e)
 {
     if (CheckSelfPermission(Manifest.Permission.WriteCalendar.ToString()) == Android.Content.PM.Permission.Granted)
     {
         try
         {
             if (!isEventInCal(this, App.reminderEvent.eventName))
             {
                 ContentValues eventValues = new ContentValues();
                 eventValues.Put(CalendarContract.Events.InterfaceConsts.CalendarId, 1);
                 eventValues.Put(CalendarContract.Events.InterfaceConsts.Title, App.reminderEvent.eventName);
                 eventValues.Put(CalendarContract.Events.InterfaceConsts.Description, App.reminderEvent.eventDescription);
                 eventValues.Put(CalendarContract.Events.InterfaceConsts.Dtstart, GetDateTimeMS(BaseFunctions.GetDateTimeFull(App.reminderEvent.eventStartDate + " " + App.reminderEvent.eventStartTime)));
                 eventValues.Put(CalendarContract.Events.InterfaceConsts.Dtend, GetDateTimeMS(BaseFunctions.GetDateTimeFull(App.reminderEvent.eventEndDate + " " + App.reminderEvent.eventEndTime)));
                 eventValues.Put(CalendarContract.Events.InterfaceConsts.AllDay, "0");
                 eventValues.Put(CalendarContract.Events.InterfaceConsts.EventLocation, App.reminderEvent.eventAddress);
                 eventValues.Put(CalendarContract.Events.InterfaceConsts.HasAlarm, "1");
                 eventValues.Put(CalendarContract.Events.InterfaceConsts.EventTimezone, "UTC");
                 eventValues.Put(CalendarContract.Events.InterfaceConsts.EventEndTimezone, "UTC");
                 var           eventUri       = ContentResolver.Insert(CalendarContract.Events.ContentUri, eventValues);
                 long          eventID        = long.Parse(eventUri.LastPathSegment);
                 ContentValues reminderValues = new ContentValues();
                 reminderValues.Put(CalendarContract.Reminders.InterfaceConsts.Minutes, 30);
                 reminderValues.Put(CalendarContract.Reminders.InterfaceConsts.EventId, eventID);
                 reminderValues.Put(CalendarContract.Reminders.InterfaceConsts.Method, (int)RemindersMethod.Alert);
                 var reminderUri = ContentResolver.Insert(CalendarContract.Reminders.ContentUri, reminderValues);
                 await App.Current.MainPage.DisplayAlert("Alert", "This event is added to your calender", "Ok");
             }
             else
             {
                 await App.Current.MainPage.DisplayAlert("Alert", "This event is already added to your calender", "Ok");
             }
         }
         catch (Exception ex)
         {
             System.Diagnostics.Debug.WriteLine(ex.ToString());
         }
     }
     else
     {
         RequestPermissions(new string[] { Manifest.Permission.WriteCalendar.ToString() }, calenderRequestCode);
     }
 }
예제 #14
0
 public static string[] tokenTANMatrixArrayFetch(TokenCryptoData tokenCryptoData, string masterKey, string dataEntropy)
 {
     string[] result;
     try
     {
         string[] array = BaseFunctions.DecodeFrom64(tokenCryptoData.CryptoData.SupportCryptoData).Split(new char[]
         {
             ';'
         });
         if (tokenCryptoData.TokenBaseParams.OTPValidationWindow != array.Length)
         {
             result = null;
         }
         else
         {
             byte[]   tokenSeed = tokenCryptoData.GetTokenSeed(masterKey);
             string[] array2    = new string[tokenCryptoData.TokenBaseParams.OTPValidationWindow];
             for (int i = 0; i < tokenCryptoData.TokenBaseParams.OTPValidationWindow; i++)
             {
                 tokenCryptoData.ResetMovingFactor((long)int.Parse(array[i]));
                 array2[i] = HOTPPwdGenerator.generate(tokenCryptoData, tokenSeed, (dataEntropy == null || dataEntropy.Length < 1) ? new byte[0] : BaseFunctions.convertStringToByteArray(dataEntropy));
             }
             result = array2;
         }
     }
     catch
     {
         LOGGER.Write(LOGGER.LogCategory.ERROR, "SF.Expand.SAF.Core::TANMatrixArrayFetch[]", null);
         result = null;
     }
     finally
     {
     }
     return(result);
 }
예제 #15
0
        private void BtnGrabar_Click(object sender, EventArgs e)
        {
            try
            {
                if (Ds != null)//si datatset tiene tablas
                {
                    bool   MenorqDisponible = false;
                    string Producto         = "";

                    #region crear solicitud de transferencia
                    DataTable dtRequerimiento = new DataTable();
                    dtRequerimiento.Columns.Add("Origen", typeof(string));
                    dtRequerimiento.Columns.Add("Sede", typeof(string));
                    dtRequerimiento.Columns.Add("AlmacenID", typeof(string));
                    dtRequerimiento.Columns.Add("Almacen", typeof(string));
                    dtRequerimiento.Columns.Add("ProductoID", typeof(string));
                    dtRequerimiento.Columns.Add("Producto", typeof(string));
                    dtRequerimiento.Columns.Add("UM", typeof(string));
                    dtRequerimiento.Columns.Add("Marca", typeof(string));
                    dtRequerimiento.Columns.Add("Disponible", typeof(decimal));
                    dtRequerimiento.Columns.Add("CantidadSolicitada", typeof(decimal));
                    dtRequerimiento.Columns.Add("Observacion", typeof(string));


                    //#region Macroinsumos
                    //filtrar todos los productos para que se conviertan en columnas
                    DataTable DtFiltro1 = new DataTable();
                    DtFiltro1 = new BaseFunctions().SelectDistinct(Ds.Tables["Temp"], "ProductoIDMateria", "AlmacenMateria", "NomProducto");

                    //crear las columnas
                    DataTable DTAcu = new DataTable();
                    DTAcu.Columns.Add("ProductoIDMateria", typeof(string));
                    DTAcu.Columns.Add("Almacen", typeof(string));
                    DTAcu.Columns.Add("Cantidad", typeof(decimal));

                    string empresa = "", sede = "001PU";
                    if (CboEmpresa.SelectedIndex == 0)
                    {
                        empresa = "IH";
                    }
                    else
                    {
                        empresa = "GH";
                    }


                    //filtrar e ir agregando
                    foreach (DataRow dr2 in DtFiltro1.Rows)
                    {
                        DataRow DR = DTAcu.NewRow();
                        DR["ProductoIDMateria"] = dr2["ProductoIDMateria"];
                        DR["Almacen"]           = empresa + sede + dr2["AlmacenMateria"];

                        //filtrar e ir agregando
                        DataView Dv = new DataView(Ds.Tables["DtSumatoria"]);
                        Dv.RowFilter = "NomProducto = '" + dr2["NomProducto"] + "'";
                        decimal Cantidad = 0;
                        Cantidad       = Convert.ToDecimal(Dv[0]["Cantidad"]);
                        DR["Cantidad"] = Cantidad;
                        DTAcu.Rows.Add(DR);
                    }

                    foreach (DataRow DR in DTAcu.Rows)
                    {
                        DataRow row = dtRequerimiento.NewRow();
                        row["Origen"]     = empresa + sede + "PRO"; //quien lo solicita
                        row["Sede"]       = AppSettings.NomSede;
                        row["AlmacenID"]  = DR["Almacen"];          //quien debe darselo
                        row["Almacen"]    = "PRODUCCION";
                        row["ProductoID"] = DR["ProductoIDMateria"];
                        row["Producto"]   = "";
                        row["UM"]         = "";
                        row["Marca"]      = "";

                        //obtener el disponible
                        DataView DvS = new DataView(Ds.Tables["DtStockLocalSede"]);
                        DvS.RowFilter = "ProductoID = '" + DR["ProductoIDMateria"] + "'";
                        if (DvS.Count == 1)
                        {
                            row["Disponible"] = DvS[0]["StockDisponible"];
                            Producto          = DvS[0]["NomProducto"].ToString();
                        }
                        else
                        {
                            row["Disponible"] = 0;
                            Producto          = DR["ProductoIDMateria"].ToString();
                        }
                        //validar si lo solicitado es menor que lo disponible, sea el caso se creara el requerimiento de trasnferencia
                        if (Convert.ToDecimal(row["Disponible"]) < Convert.ToDecimal(DR["Cantidad"]))
                        {
                            MenorqDisponible = true;
                            break;
                        }
                        row["CantidadSolicitada"] = DR["Cantidad"];
                        row["Observacion"]        = "para produccion del dia: " + DateTime.Now.ToString();
                        dtRequerimiento.Rows.Add(row);
                    }

                    #endregion

                    if (MenorqDisponible == false)
                    {
                        //new CL_Requerimientos().InsertarTransferencia(dtRequerimiento, AppSettings.UserID, empresa, AppSettings.NomSede, AppSettings.ApeNom_Login);
                        #region guardar historico
                        ObjCL_Produccion.InsertMateriaPrimaHistorico(empresa, AppSettings.UserID, Ds.Tables["Temp"], DtProductosBatch);
                        #endregion
                        MessageBox.Show("Se guardo correctamente en el historial", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                    else
                    {
                        MessageBox.Show("El producto: " + Producto + " no tiene suficiente stock disponible, disminuyalo o espere que  cuente con el stock necesario.\r\n\r\n No se creo el requerimiento de transferencia ni se guardo el plan de producción.", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                    BtnGrabar.Visible = false;
                    BtnNuevo_Click(null, null);
                }//fin si dataset tiene tablas
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message + ". Metodo  InsertMateriaPrimaHistorico().", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
예제 #16
0
        public AutenticationStatus Autenticate(string tokenInternalID, string password, string dataEntropy, out string newChallenge)
        {
            newChallenge = null;
            TokenCryptoData     _tkCryptoData = new TokensDAO().loadTokenCryptoData(tokenInternalID);
            AutenticationStatus result;

            if (_tkCryptoData.ID == null)
            {
                result = AutenticationStatus.ErrorCheckTokenStatus;
            }
            else
            {
                if (_tkCryptoData.TokenBaseParams.MovingFactorType != TokenMovingFactorType.EventBase && _tkCryptoData.TokenBaseParams.SeedType == TokenSeedType.ActivactionKey)
                {
                    throw new Exception("Function not implemented for this type of token!!");
                }
                long _MovingFactor;
                AutenticationStatus _authStatus = HOTPPwdValidator.Validate(_tkCryptoData, (dataEntropy == null) ? new byte[0] : BaseFunctions.convertStringToByteArray(dataEntropy), this._masterKey, password, out _MovingFactor);
                if (_authStatus == AutenticationStatus.Success || _authStatus == AutenticationStatus.SuccessButSynchronized)
                {
                    _tkCryptoData.ResetMovingFactor(_MovingFactor);
                    if (new TokensDAO().updateMovingFactor(_tkCryptoData) != OperationResult.Success)
                    {
                        result = AutenticationStatus.TokenOrPasswordInvalid;
                        return(result);
                    }
                }
                result = _authStatus;
            }
            return(result);
        }
        public async void SponsorDetials(SponsorGroup _sponsor, SponsorsTemplate parentSponsor)
        {
            await((HomeLayout)App.Current.MainPage).SetLoading(true, "loading sponsor...");
            currentSponsor = _sponsor;
            sponsorTemp    = parentSponsor;
            VcardContact c_user = new VcardContact();

            c_user.FirstName   = currentSponsor.company.CompanyName;
            c_user.LastName    = currentSponsor.company.CompanyName;
            c_user.company     = currentSponsor.company.CompanyName;
            c_user.phoneNumber = currentSponsor.company.companyPhone;
            c_user.email       = currentSponsor.company.companyEmail;
            App.contactuser    = c_user;
            if (currentSponsor.company != null)
            {
                CheckSocialVisiblilty();
                if (!string.IsNullOrEmpty(currentSponsor.company.companyLogo))
                {
                    sponsorLogo.Source = currentSponsor.company.companyLogo;
                    Regex  initials = new Regex(@"(\b[a-zA-Z])[a-zA-Z]* ?");
                    string init     = initials.Replace(currentSponsor.company.CompanyName, "$1");
                    if (init.Length > 3)
                    {
                        init = init.Substring(0, 3);
                    }
                    logoText.Text = init.ToUpper();
                }
                else
                {
                    sponsorLogo.Source = "";
                    Regex  initials = new Regex(@"(\b[a-zA-Z])[a-zA-Z]* ?");
                    string init     = initials.Replace(currentSponsor.company.CompanyName, "$1");
                    if (init.Length > 3)
                    {
                        init = init.Substring(0, 3);
                    }
                    logoText.Text = init.ToUpper();
                }
                if (!string.IsNullOrEmpty(currentSponsor.company.CompanyName))
                {
                    sponsorName.Text = currentSponsor.company.CompanyName;
                }
                else
                {
                    sponsorName.Text = "";
                }
                if (currentSponsor.sponsor.sponsorFields.Count > 0)
                {
                    BaseFunctions.GetCustomFields(customFieldsLayout, currentSponsor.sponsor.sponsorFields);
                }
                if (!string.IsNullOrEmpty(currentSponsor.company.companyWebsite))
                {
                    websiteURL = currentSponsor.company.companyWebsite;
                }
                id = _sponsor.sponsor.sponsorID;
                if (!string.IsNullOrEmpty(currentSponsor.company.companyDescription))
                {
                    description.Text    = currentSponsor.company.companyDescription;
                    emptyList.IsVisible = false;
                }
                else
                {
                    emptyList.IsVisible = true;
                    description.ParentView.IsVisible = false;
                }
            }
            CheckBookmark(App.serverData.mei_user.currentUser.userBookmarks.isBookmarked(currentSponsor));
            await Task.Delay(1000);

            await((HomeLayout)App.Current.MainPage).SetLoading(false, "");
        }
예제 #18
0
        public async Task <bool> SaveUserToBrainTree()
        {
            if (string.IsNullOrEmpty(NameOnCard.Text))
            {
                await App.Current.MainPage.DisplayAlert("Alert", "Required Name on Card", "OK");

                return(false);
            }
            if (string.IsNullOrEmpty(cardNumber.Text))
            {
                await App.Current.MainPage.DisplayAlert("Alert", "Required Card Number", "OK");

                return(false);
            }
            if (string.IsNullOrEmpty(cardMonth.Text))
            {
                await App.Current.MainPage.DisplayAlert("Alert", "Required Expiration Month of Card", "OK");

                return(false);
            }
            if (string.IsNullOrEmpty(cardYear.Text))
            {
                await App.Current.MainPage.DisplayAlert("Alert", "Required Expiration Year of Card", "OK");

                return(false);
            }
            if (string.IsNullOrEmpty(cardCvv.Text))
            {
                await App.Current.MainPage.DisplayAlert("Alert", "Required CVV", "OK");

                return(false);
            }
            if (string.IsNullOrEmpty(billingFirstName.Text))
            {
                await App.Current.MainPage.DisplayAlert("Alert", "Required First Name for billing information", "OK");

                return(false);
            }
            if (string.IsNullOrEmpty(billingLastName.Text))
            {
                await App.Current.MainPage.DisplayAlert("Alert", "Required Last Name for billing information", "OK");

                return(false);
            }

            if (string.IsNullOrEmpty(billingAddressLine.Text))
            {
                await App.Current.MainPage.DisplayAlert("Alert", "Required Address for billing information", "OK");

                return(false);
            }
            if (string.IsNullOrEmpty(billingCity.Text))
            {
                await App.Current.MainPage.DisplayAlert("Alert", "Required City for billing information", "OK");

                return(false);
            }

            if (string.IsNullOrEmpty(billingPostalCode.Text))
            {
                await App.Current.MainPage.DisplayAlert("Alert", "Required Postal / Zip code for billing information", "OK");

                return(false);
            }
            bool returnValue = false;

            if (App.serverData.mei_user.userCustomerTokenList.Count > currentIndex)
            {
                UserCard currentCard = new UserCard();
                currentCard.card                      = App.serverData.mei_user.userCustomerTokenList[currentIndex].card;
                currentCard.cardToken                 = App.serverData.mei_user.userCustomerTokenList[currentIndex].cardToken;
                currentCard.card.cardName             = NameOnCard.Text;
                currentCard.card.cardExpMonth         = cardMonth.Text;
                currentCard.card.cardExpYear          = cardYear.Text;
                currentCard.card.cardCVV              = cardCvv.Text;
                currentCard.card.cardBillingFirstName = billingFirstName.Text;
                currentCard.card.cardBillingLastName  = billingLastName.Text;
                currentCard.card.cardBillingAddress   = billingAddressLine.Text;
                //currentCard.billingInformation.addressLine2 = billingAddressLine2.Text;
                currentCard.card.cardBillingCity    = billingCity.Text;
                currentCard.card.cardBillingZipCode = billingPostalCode.Text;
                currentCard.card.cardBillingState   = states[billingState.SelectedIndex];
                string token = await BaseFunctions.UpdateBraintreeUser(currentIndex, currentUser, currentCard);

                if (token == "updated")
                {
                    App.serverData.mei_user.userCustomerTokenList[currentIndex] = currentCard;
                    ((HomeLayout)App.Current.MainPage).paymentList.PullToRefresh();
                    returnValue = true;
                }
                else
                {
                    returnValue = false;
                }
            }
            else
            {
                if (!agreeTermSwitch.IsToggled)
                {
                    await App.Current.MainPage.DisplayAlert("Alert", "Please agree terms and conditions to add a card to your account.", "OK");

                    return(false);
                }

                if (!agreePrivacySwitch.IsToggled)
                {
                    await App.Current.MainPage.DisplayAlert("Alert", "Please agree privacy to add a card to your account.", "OK");

                    return(false);
                }

                List <UserCard> list        = new List <UserCard>();
                UserCard        currentCard = new UserCard();
                currentCard.card                      = new CardObject();
                currentCard.card.cardName             = NameOnCard.Text;
                currentCard.card.cardNumber           = cardNumber.Text;
                currentCard.card.cardExpMonth         = cardMonth.Text;
                currentCard.card.cardExpYear          = cardYear.Text;
                currentCard.card.cardCVV              = cardCvv.Text;
                currentCard.card.cardBillingFirstName = billingFirstName.Text;
                currentCard.card.cardBillingLastName  = billingLastName.Text;
                currentCard.card.cardBillingAddress   = billingAddressLine.Text;
                currentCard.card.cardBillingCity      = billingCity.Text;
                currentCard.card.cardBillingState     = states[billingState.SelectedIndex];
                currentCard.card.cardBillingZipCode   = billingPostalCode.Text;
                string token = "not assigned";
                token = await BaseFunctions.AddUserToBraintree(currentIndex, currentUser, currentCard.card);

                if (token != "")
                {
                    string customerID      = token.Split("&"[0])[0];
                    string customerTokenID = token.Split("&"[0])[1];
                    string cardType        = token.Split("&"[0])[2];
                    currentUser.userCustomerID.Add(customerID);
                    App.serverData.mei_user.currentUser = currentUser;
                    await((HomeLayout)App.Current.MainPage).SetLoading(true, "Adding card to your profile...");
                    await App.serverData.CreateUserTokenList();

                    ((HomeLayout)App.Current.MainPage).paymentList.PullToRefresh();
                    await((HomeLayout)App.Current.MainPage).SetLoading(true, "Saving to server...");
                    returnValue = await BaseFunctions.SaveUserToServer();
                }
                else
                {
                    returnValue = false;
                }
            }
            return(returnValue);
        }
        public static OperationResult TokensCreateNew(TokenTypeBaseParams tkTypeBaseParams, string masterKey, string vendorSerialNumber, string dataEntropy, out TokenCryptoData tokenCryptoData)
        {
            OperationResult result;

            try
            {
                byte[] tkseed;
                byte[] tkserial;
                long   tkmovFactor;
                if (OperationResult.Error == HOTPCryptoData.Generate(masterKey, null, tkTypeBaseParams, out tkseed, out tkserial, out tkmovFactor))
                {
                    tokenCryptoData = new TokenCryptoData(null, null, new CryptoData(), new TokenTypeBaseParams());
                    result          = OperationResult.Error;
                }
                else
                {
                    TokenCryptoData _tkCryptoData = new TokenCryptoData(null, vendorSerialNumber, new CryptoData(tkmovFactor, BaseFunctions.HexEncoder(tkseed), BaseFunctions.HexEncoder(tkserial), ""), tkTypeBaseParams);
                    _tkCryptoData.ResetMovingFactor(HOTPCipherInitialize.createSequenceNumber());
                    if (tkTypeBaseParams.MovingFactorType == TokenMovingFactorType.TransactionAuthenticationNumber)
                    {
                        string supportCryptoData;
                        if (OperationResult.Error == TokensBaseFunctions.tokenTANMatrixIntegrityCheck(_tkCryptoData, _tkCryptoData.GetTokenSeed(masterKey), (dataEntropy == null || dataEntropy.Length < 1) ? new byte[0] : BaseFunctions.convertStringToByteArray(dataEntropy), out supportCryptoData))
                        {
                            tokenCryptoData = new TokenCryptoData(null, null, new CryptoData(), new TokenTypeBaseParams());
                            result          = OperationResult.Error;
                            return(result);
                        }
                        _tkCryptoData.ResetSupportCryptoData(supportCryptoData);
                    }
                    tokenCryptoData = _tkCryptoData;
                    result          = OperationResult.Success;
                }
            }
            catch (Exception ex)
            {
                tokenCryptoData = new TokenCryptoData(null, null, default(CryptoData), default(TokenTypeBaseParams));
                SAFLOGGER.Write(SAFLOGGER.LOGGEREventID.EXCEPTION, "SAFCORE", new string[]
                {
                    "http://sfexpand.SAFCore.TokensBaseFunctions.softfinanca.com/",
                    Assembly.GetExecutingAssembly().FullName.ToString(),
                    ex.ToString()
                });
                result = OperationResult.Error;
            }
            finally
            {
                // byte[] tkseed = null;
                // byte[] tkserial = null;
            }
            return(result);
        }
        public static OperationResult TokensImportNew(TokenTypeBaseParams tkTypeBaseParams, string masterKey, string vendorSerialNumber, string externalSeed, string pin, long movingFactor, out TokenCryptoData TokenCryptoData)
        {
            TokenCryptoData = new TokenCryptoData(null, null, new CryptoData(), new TokenTypeBaseParams());
            OperationResult result;

            try
            {
                if (tkTypeBaseParams.SeedType != TokenSeedType.Dynamic)
                {
                    throw new Exception("Invalid Seed type!");
                }
                if (tkTypeBaseParams.MovingFactorType != TokenMovingFactorType.EventBase || movingFactor < 1L)
                {
                    throw new Exception("Invalid MovingFactorType!");
                }
                byte[] tkserial = HOTPCipherInitialize.createSerialNumber((pin == null || pin.Length < 1) ? HOTPCipherInitialize.Generate4DigitsPin() : pin);
                byte[] tkseed   = HOTPCipher.encryptData(BaseFunctions.HexDecoder(externalSeed), HOTPCipherInitialize.createCryptKey(tkserial, (masterKey == null || masterKey.Length < 1) ? new byte[0] : BaseFunctions.convertStringToByteArray(masterKey)));
                TokenCryptoData = new TokenCryptoData(null, vendorSerialNumber, new CryptoData(movingFactor, BaseFunctions.HexEncoder(tkseed), BaseFunctions.HexEncoder(tkserial), ""), tkTypeBaseParams);
                TokenCryptoData.ResetMovingFactor(movingFactor);
                result = OperationResult.Success;
            }
            catch (Exception ex)
            {
                TokenCryptoData = new TokenCryptoData(null, null, new CryptoData(), new TokenTypeBaseParams());
                SAFLOGGER.Write(SAFLOGGER.LOGGEREventID.EXCEPTION, "SAFCORE", new string[]
                {
                    "http://sfexpand.SAFCore.TokensBaseFunctions.softfinanca.com/",
                    Assembly.GetExecutingAssembly().FullName.ToString(),
                    ex.ToString()
                });
                result = OperationResult.Error;
            }
            finally
            {
            }
            return(result);
        }
 public static string[] tokenTANMatrixArrayFetch(TokenCryptoData tokenCryptoData, string masterKey, string dataEntropy)
 {
     string[] result;
     try
     {
         string[] _TanChallenge = BaseFunctions.DecodeFrom64(tokenCryptoData.CryptoData.SupportCryptoData).Split(new char[]
         {
             ';'
         });
         if (tokenCryptoData.TokenBaseParams.OTPValidationWindow != _TanChallenge.Length)
         {
             result = null;
         }
         else
         {
             byte[]   _seedOpen = tokenCryptoData.GetTokenSeed(masterKey);
             string[] _matriz   = new string[tokenCryptoData.TokenBaseParams.OTPValidationWindow];
             for (int _index = 0; _index < tokenCryptoData.TokenBaseParams.OTPValidationWindow; _index++)
             {
                 tokenCryptoData.ResetMovingFactor((long)int.Parse(_TanChallenge[_index]));
                 _matriz[_index] = HOTPPwdGenerator.generate(tokenCryptoData, _seedOpen, (dataEntropy == null || dataEntropy.Length < 1) ? new byte[0] : BaseFunctions.convertStringToByteArray(dataEntropy));
             }
             result = _matriz;
         }
     }
     catch (Exception ex)
     {
         SAFLOGGER.Write(SAFLOGGER.LOGGEREventID.EXCEPTION, "SAFCORE", new string[]
         {
             "http://sfexpand.SAFCore.TokensBaseFunctions.softfinanca.com/",
             Assembly.GetExecutingAssembly().FullName.ToString(),
             ex.ToString()
         });
         result = null;
     }
     finally
     {
     }
     return(result);
 }
예제 #22
0
        public int InsertCierreKardex(int Accion, int UsuarioID, string Almacen, string ProductoID, string EmpresaID, string Periodo, int Anno, bool CostoCero, decimal Cantidad2, decimal CostoUnitario)
        {
            int       totalAfectados = 0;
            CD_Kardex ObjCD_Kardex   = new CD_Kardex(AppSettings.GetConnectionString);

            if (Accion == 1)
            {
                DataTable dtTMP = new DataTable();
                if (CostoCero == false)
                {
                    //aplicar la lógica del cierre en el reporte mensual
                    if (ProductoID == "TODOS")
                    {
                        ProductoID = "";
                    }


                    DateTime FecInicial, FecFinal;
                    FecInicial = new DateTime(Anno, Convert.ToInt16(Periodo), 1);
                    FecFinal   = new DateTime(Anno, Convert.ToInt16(Periodo), 1).AddMonths(1);

                    dtTMP = new CL_Kardex().getDTKardex_varios(ProductoID, EmpresaID, FecInicial, FecFinal, Almacen, 2);

                    //buscar '0' en los valores, no deberia existir el '0'
                    DataView DVCero = new DataView(dtTMP, "PrecioUnitario = 0", "", DataViewRowState.CurrentRows);
                    if (DVCero.Count > 0)
                    {
                        throw new Exception("Hay " + DVCero.Count.ToString() + " costo(s) unitario igual a 0\n\nno se insertara ningun registro");
                    }

                    decimal Cantidad = 0, CantidadAcumulada = 0, PrecioPonderado = 0, CostoAcumulado = 0;

                    //UsuarioID
                    //Creamos tabla para ordenar los datos
                    DataTable DtKardex = new DataTable("GetKardex");
                    DtKardex.Columns.Add("ID", typeof(int)).AutoIncrement = true;
                    DtKardex.Columns.Add("ProductoID", typeof(string));
                    DtKardex.Columns.Add("FCantidad", typeof(decimal));
                    DtKardex.Columns.Add("FCostoUnitario", typeof(decimal));


                    //Seleccionamos disticnt de los productos
                    DataTable DtProductos = new DataTable();
                    DtProductos = dtTMP.DefaultView.ToTable(true, "ProductoID");

                    foreach (DataRow DRP in DtProductos.Rows)
                    {
                        //filtramos datos por producto
                        DataView Dv = new DataView(dtTMP, "ProductoID='" + DRP["ProductoID"].ToString() + "'", "AudCrea ASC", DataViewRowState.CurrentRows);

                        foreach (DataRowView Dr in Dv)
                        {
                            DataRow DR = DtKardex.NewRow();
                            DR["ProductoID"] = Dr["ProductoID"];

                            Cantidad = Convert.ToDecimal(Dr["Cantidad"]);

                            //validar si es entrada o salida
                            if (Dr["Tipo"].ToString() == "I")
                            {
                                PrecioPonderado      = Convert.ToDecimal(Dr["PrecioUnitario"]);//temporal
                                CantidadAcumulada   += Cantidad;
                                CostoAcumulado      += Cantidad * PrecioPonderado;
                                DR["FCantidad"]      = CantidadAcumulada;
                                PrecioPonderado      = CostoAcumulado / CantidadAcumulada;//precio real nuevo
                                DR["FCostoUnitario"] = PrecioPonderado;
                            }
                            else if (Dr["Tipo"].ToString() == "S" & Dr["TipoOperacion"].ToString() == "01") //salida por venta
                            {
                                CantidadAcumulada   -= Cantidad;
                                CostoAcumulado       = CantidadAcumulada * PrecioPonderado;
                                DR["FCantidad"]      = CantidadAcumulada;
                                PrecioPonderado      = CostoAcumulado / CantidadAcumulada;
                                DR["FCostoUnitario"] = PrecioPonderado;
                            }
                            else if (Dr["Tipo"].ToString() == "S")                              //otro tipo de salida
                            {
                                PrecioPonderado      = Convert.ToDecimal(Dr["PrecioUnitario"]); //temporal
                                CantidadAcumulada   -= Cantidad;
                                DR["FCantidad"]      = CantidadAcumulada;
                                CostoAcumulado      -= Cantidad * PrecioPonderado;
                                PrecioPonderado      = CostoAcumulado / CantidadAcumulada;
                                DR["FCostoUnitario"] = PrecioPonderado;
                            }
                            else if (Dr["Tipo"].ToString() == "A") //saldo inicial
                            {
                                PrecioPonderado    = Convert.ToDecimal(Dr["PrecioUnitario"]);
                                CantidadAcumulada += Cantidad;

                                CostoAcumulado      += Cantidad * PrecioPonderado;
                                DR["FCantidad"]      = Cantidad;
                                DR["FCostoUnitario"] = PrecioPonderado;
                            }
                            DtKardex.Rows.Add(DR);
                        }
                        Cantidad = 0; CantidadAcumulada = 0; PrecioPonderado = 0;
                    }

                    //una ves creada la tabla, se debe capturar los totales y ordenarlos en otra tabla
                    //Creamos tabla para ordenar los datos


                    DataTable DTCierre = new DataTable("Cierre");
                    DTCierre.Columns.Add("ProductoID", typeof(string));
                    DTCierre.Columns.Add("Cantidad", typeof(decimal));
                    DTCierre.Columns.Add("CostoUnitario", typeof(decimal));
                    foreach (DataRow DRP in DtProductos.Rows)
                    {
                        //cacturar el ultimo valor agregado, ese sera el costo nuevo
                        DataView DV = new DataView(DtKardex, "ProductoID = '" + DRP["ProductoID"].ToString() + "'", "ID DESC", DataViewRowState.CurrentRows);
                        DataRow  DR = DTCierre.NewRow();
                        DR["ProductoID"]    = DRP["ProductoID"];
                        DR["Cantidad"]      = DV[0]["FCantidad"];
                        DR["CostoUnitario"] = DV[0]["FCostoUnitario"];
                        DTCierre.Rows.Add(DR);
                    }
                    string XML = "";

                    string _xml = new BaseFunctions().GetXML(DTCierre).Replace("NewDataSet", "DocumentElement");
                    XML = _xml.Replace("Table", "Cierre");

                    //insercion masiva del kardex
                    totalAfectados = ObjCD_Kardex.InsertCierreKardex(Accion, XML, UsuarioID, null, null, EmpresaID, Periodo, Anno, false, Cantidad2, CostoUnitario);
                }
                else
                {
                    string XML = "";
                    totalAfectados = ObjCD_Kardex.InsertCierreKardex(Accion, XML, UsuarioID, Almacen, ProductoID, EmpresaID, Periodo, Anno, CostoCero, Cantidad2, CostoUnitario);
                }
            }
            else if (Accion == 2)
            {
                //ingreso manual
                totalAfectados = ObjCD_Kardex.InsertCierreKardex(Accion, "", UsuarioID, Almacen, ProductoID, EmpresaID, Periodo, Anno, CostoCero, Cantidad2, CostoUnitario);
            }
            return(totalAfectados);
        }
예제 #23
0
        public void SetEventDetails(DomainEvent currentEvent)
        {
            if (!string.IsNullOrEmpty(currentEvent.s_event.eventVenueName))
            {
                currentCenter.Text = currentEvent.s_event.eventVenueName;
            }
            else
            {
                currentCenter.Text = "";
            }
            if (!string.IsNullOrEmpty(currentEvent.s_event.eventName))
            {
                currentEventName.Text = currentEvent.s_event.eventName;
            }
            else
            {
                currentEventName.Text = "";
            }
            if (!string.IsNullOrEmpty(currentEvent.s_event.eventVenueMap.venueAddress))
            {
                currentCityState.Text = currentEvent.s_event.eventVenueMap.venueAddress;
            }
            else
            {
                currentCityState.Text = "";
            }

            if (!string.IsNullOrEmpty(currentEvent.s_event.eventLogo))
            {
                eventIcon.Source = currentEvent.s_event.eventLogo;
            }
            else
            {
                eventIcon.Source = "eventicon.png";
            }

            if (currentEvent.s_event.eventStartDate.Equals(currentEvent.s_event.eventEndDate))
            {
                currentSchedule.Text = BaseFunctions.getMonthDay(currentEvent.s_event.eventStartDate) + ", " + BaseFunctions.getFullYear(currentEvent.s_event.eventStartDate);
            }
            else
            {
                if (BaseFunctions.GetMonth(currentEvent.s_event.eventStartDate) == BaseFunctions.GetMonth(currentEvent.s_event.eventEndDate))
                {
                    currentSchedule.Text = BaseFunctions.getMonthDay(currentEvent.s_event.eventStartDate) + " - " + BaseFunctions.getDayYear(currentEvent.s_event.eventStartDate);
                }
                else
                {
                    currentSchedule.Text = BaseFunctions.getMonthDay(currentEvent.s_event.eventStartDate) + " - " + BaseFunctions.getMonthDay(currentEvent.s_event.eventEndDate) + ", " + BaseFunctions.getYear(currentEvent.s_event.eventEndDate);
                }
            }
        }
예제 #24
0
        private void BtnGenerarHojaDespacho_Click(object sender, EventArgs e)
        {
            if (DtGuias.Rows.Count > 0)
            {
                BtnGenerarHojaDespacho.Visible = false;
                BtnNuevo.Visible   = false;
                BtnGrabar.Visible  = false;
                BtnBalanza.Visible = false;
                RbPeso.Visible     = false;
                RbTara.Visible     = false;
                #region inserta hoja de despacho y se obtiene el codigo

                //Insertar Hoja de despacho
                E_HojaDespacho ObjHojaDespacho = new E_HojaDespacho();
                ObjHojaDespacho.EmpresaID         = EmpresaIDUser;
                ObjHojaDespacho.EmpresaTransporte = EmpresaTransporte;
                ObjHojaDespacho.NombreChofer      = NomTransportista;
                ObjHojaDespacho.placa             = TxtPlaca.Text;
                ObjHojaDespacho.Carrosa           = TxtCarrosa.Text;
                ObjHojaDespacho.FechaLlegada      = Convert.ToDateTime(DeFechaLlegada.Value);
                ObjHojaDespacho.FechaSalida       = Convert.ToDateTime(DeFechaSalida.Value);
                ObjHojaDespacho.NumJabas          = NroJabasTotal;
                ObjHojaDespacho.PesoTotal         = BrutoTotal;
                ObjHojaDespacho.PesoNeto          = NetoTotal;
                ObjHojaDespacho.TotalAnimales     = Cantidad;
                ObjHojaDespacho.TaraTotal         = TaraTotal;
                ObjHojaDespacho.UsuarioID         = AppSettings.UserID;

                NumHojaDespacho = new CL_HojaDespacho().InsertHojaDespacho(ObjHojaDespacho, AppSettings.SedeID);
                #endregion

                #region crear tablas
                //Tabla para insertar el detalle de la hoja de despacho
                DataTable DetalleHojaDespacho = new DataTable();
                DetalleHojaDespacho.TableName = "DetalleHojaDespacho";
                DetalleHojaDespacho.Columns.Add("ProductoID", typeof(string));
                DetalleHojaDespacho.Columns.Add("NumHojaDespacho", typeof(string));
                DetalleHojaDespacho.Columns.Add("NumGuiaRemision", typeof(string));
                DetalleHojaDespacho.Columns.Add("NumRequerimiento", typeof(string));
                DetalleHojaDespacho.Columns.Add("NroFactura", typeof(string));
                DetalleHojaDespacho.Columns.Add("TotalPeso", typeof(decimal));
                DetalleHojaDespacho.Columns.Add("Motivo", typeof(string));
                DetalleHojaDespacho.Columns.Add("NumGuiaTransportista", typeof(string));
                DetalleHojaDespacho.Columns.Add("Bultos", typeof(string));
                DetalleHojaDespacho.Columns.Add("IDProveedor", typeof(int));
                #endregion

                //para detalle hoja despacho
                foreach (DataRow Row2 in DtGuias.Rows)
                {
                    DataRow RowHD = DetalleHojaDespacho.NewRow();
                    RowHD["ProductoID"]           = Row2["ProductoID"];
                    RowHD["NumHojaDespacho"]      = NumHojaDespacho;
                    RowHD["NumGuiaRemision"]      = Row2["NumGuiaRemision"];
                    RowHD["NumRequerimiento"]     = Row2["NumRequerimiento"];
                    RowHD["NroFactura"]           = Row2["NroFactura"];
                    RowHD["TotalPeso"]            = Row2["TotalPeso"];
                    RowHD["Motivo"]               = Row2["Motivo"];
                    RowHD["NumGuiaTransportista"] = Row2["NumGuiaTransportista"];
                    RowHD["Bultos"]               = Row2["Bultos"];
                    RowHD["IDProveedor"]          = Row2["IDProveedor"];
                    DetalleHojaDespacho.Rows.Add(RowHD);
                }


                if (DetalleHojaDespacho.Rows.Count > 0)
                {
                    string xml = new BaseFunctions().GetXML(DetalleHojaDespacho).Replace("NewDataSet", "DocumentElement");
                    bool   Valor;
                    Valor = new CL_HojaDespacho().InsertXMLDetalleHojaDespacho(xml);
                    if (Valor == false)
                    {
                        MessageBox.Show("Ocurrio un error al intentar insertar los detalles de la hoja de despacho", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }

                //mostrar en reporte
                Reportes.FrmHojaDespacho ObjFrmHojaD = new Reportes.FrmHojaDespacho();
                ObjFrmHojaD.NumHojaDespacho = NumHojaDespacho;
                ObjFrmHojaD.ShowDialog();
            }
            else
            {
                MessageBox.Show("No se ha creado aún alguna guia.", "Hoja de despacho", MessageBoxButtons.OK, MessageBoxIcon.Stop);
            }
        }
예제 #25
0
        public AutenticationStatus Autenticate(string tokenInternalID, string password, string dataEntropy, out string newChallenge)
        {
            newChallenge = null;
            TokenCryptoData     _tkCryptoData = new TokensDAO().loadTokenCryptoData(tokenInternalID);
            AutenticationStatus result;

            if (_tkCryptoData.ID == null)
            {
                result = AutenticationStatus.TokenNotFoundOrCanceled;
            }
            else
            {
                if (_tkCryptoData.TokenBaseParams.MovingFactorType != TokenMovingFactorType.TransactionAuthenticationNumber)
                {
                    throw new Exception("Function not implemented for this type of token!!");
                }
                string currentChallenge = (string)new TokensChallengeRequestDAO().loadChallengeRequest(tokenInternalID);
                if (currentChallenge == null)
                {
                    result = AutenticationStatus.InvalidDataOnPasswordValidation;
                }
                else
                {
                    int      iRequest       = int.Parse(SAFConfiguration.readParameterExternal("TANRequestPositions"));
                    int      iDigitsByPos   = int.Parse(SAFConfiguration.readParameterExternal("TANDigitsByPosition"));
                    int      iFixPosOnFaill = int.Parse(SAFConfiguration.readParameterExternal("TANFixedPosOnFail"));
                    string   _otp           = string.Empty;
                    byte[]   _tkSeedOpen    = BaseFunctions.HexDecoder(_tkCryptoData.CryptoData.CryptoKey.Trim());
                    byte[]   _dataEntropy   = (dataEntropy == null || dataEntropy.Length < 1) ? new byte[0] : BaseFunctions.convertStringToByteArray(dataEntropy);
                    string[] _arrayPosValid = currentChallenge.Split(new char[]
                    {
                        '|'
                    });
                    string[] _arrayChallenge = BaseFunctions.DecodeFrom64(_tkCryptoData.CryptoData.SupportCryptoData.Trim()).Split(new char[]
                    {
                        ';'
                    });
                    for (int idx = 0; idx < _arrayPosValid.Length; idx++)
                    {
                        string[] _temp = _arrayPosValid[idx].Trim().Split(new char[]
                        {
                            ';'
                        });
                        _tkCryptoData.ResetMovingFactor(long.Parse(_arrayChallenge[(int)checked ((IntPtr)long.Parse(_temp[0]))]));
                        _otp += HOTPPwdGenerator.generate(_tkCryptoData, _tkSeedOpen, _dataEntropy).Substring(int.Parse(_temp[1]), 1);
                    }
                    if (password.Trim() == _otp)
                    {
                        if (OperationResult.Success == new TokensChallengeRequestDAO().resetChallengeRequest(tokenInternalID))
                        {
                            result = AutenticationStatus.Success;
                            return(result);
                        }
                    }
                    result = AutenticationStatus.TokenOrPasswordInvalid;
                }
            }
            return(result);
        }
예제 #26
0
        public static OperationResult TokensCreateNew(TokenTypeBaseParams tkTypeBaseParams, string masterKey, string vendorSerialNumber, string dataEntropy, out TokenCryptoData tokenCryptoData)
        {
            OperationResult result;

            try
            {
                byte[] data;
                byte[] data2;
                long   movingFactor;
                if (OperationResult.Error == HOTPCryptoData.Generate(masterKey, null, tkTypeBaseParams, out data, out data2, out movingFactor))
                {
                    tokenCryptoData = new TokenCryptoData(null, null, default(CryptoData), default(TokenTypeBaseParams));
                    result          = OperationResult.Error;
                }
                else
                {
                    TokenCryptoData tokenCryptoData2 = new TokenCryptoData(null, vendorSerialNumber, new CryptoData(movingFactor, BaseFunctions.HexEncoder(data), BaseFunctions.HexEncoder(data2), ""), tkTypeBaseParams);
                    tokenCryptoData2.ResetMovingFactor(HOTPCipherInitialize.createSequenceNumber());

                    /*--------------------------*/
                    byte[]        tokenSeed = tokenCryptoData2.GetTokenSeed(masterKey);
                    string        x         = Encoding.ASCII.GetString(tokenSeed);
                    Base32Encoder enc       = new Base32Encoder();
                    string        y         = enc.Encode(tokenSeed);


                    /*--------------------------*/


                    if (tkTypeBaseParams.MovingFactorType == TokenMovingFactorType.TransactionAuthenticationNumber)
                    {
                        string value;
                        if (OperationResult.Error == TokensBaseFunctions.tokenTANMatrixIntegrityCheck(tokenCryptoData2, tokenCryptoData2.GetTokenSeed(masterKey), (dataEntropy == null || dataEntropy.Length < 1) ? new byte[0] : BaseFunctions.convertStringToByteArray(dataEntropy), out value))
                        {
                            tokenCryptoData = new TokenCryptoData(null, null, default(CryptoData), default(TokenTypeBaseParams));
                            result          = OperationResult.Error;
                            return(result);
                        }
                        tokenCryptoData2.ResetSupportCryptoData(value);
                    }
                    tokenCryptoData = tokenCryptoData2;
                    result          = OperationResult.Success;
                }
            }
            catch
            {
                LOGGER.Write(LOGGER.LogCategory.ERROR, "SF.Expand.SAF.Core::TokensCreateNew[]", null);
                tokenCryptoData = new TokenCryptoData(null, null, default(CryptoData), default(TokenTypeBaseParams));
                result          = OperationResult.Error;
            }
            return(result);
        }
예제 #27
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            Button b          = sender as Button;
            string buttonName = b.Name;
            string _index     = buttonName.Substring(buttonName.Length - 1, 1);

            this._resetDisplay(_index); //manual

            if (GlobalData.initSetting.ONTTYPE == "GW040H" || (GlobalData.initSetting.ONTTYPE == "GW020BoB" && GlobalData.initSetting.ENABLEWRITEAPD == true))
            {
                this.Opacity = 0.3;
                wBosaSerialNumber wb = new wBosaSerialNumber(_index);
                wb.ShowDialog();
                this.Opacity = 1;
            }

            //Kiểm tra trạng thái calib của máy đo ER
            try {
                double _temp = 0, _hours;
                string _time;
                bool   ret;
                ret = Function.IO.CalibrationModuleTime.Read(out _time);
                //ret = GlobalData.erDevice.getTemperature(out _temp);
                ret = BaseFunctions.last_Time_Calibrate_Module_DCAX86100D_To_Hours(_time, out _hours);
                if (_hours > 5 || _temp > 5)
                {
                    CalibModuleWarning cm = new CalibModuleWarning(_time.ToString(), _temp.ToString());
                    cm.ShowDialog();
                }
            }
            catch { }

            //***BEGIN -----------------------------------------//
            System.Threading.Thread t = new System.Threading.Thread(new System.Threading.ThreadStart(() => {
                //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//
                //Start count time
                System.Diagnostics.Stopwatch st = new System.Diagnostics.Stopwatch();
                st.Start();

                string _name        = buttonName;
                testinginfo testtmp = null;
                BaseFunctions.get_Testing_Info_By_Name(_name, ref testtmp);
                variables vari = new variables();

                string _BosaSN = "";
                if (GlobalData.initSetting.ONTTYPE == "GW040H" || (GlobalData.initSetting.ONTTYPE == "GW020BoB" && GlobalData.initSetting.ENABLEWRITEAPD == true))
                {
                    testtmp.SYSTEMLOG += string.Format("Input Bosa Serial...\r\n...{0}\r\n", testtmp.BOSASERIAL);
                    _BosaSN            = testtmp.BOSASERIAL;
                    if (_BosaSN == "--")
                    {
                        return;
                    }
                }

                if (GlobalData.initSetting.ENABLEWRITEMAC)
                {
                    if (testtmp.MACADDRESS == "--")
                    {
                        return;
                    }
                }

                //Get Bosa Information from Bosa Serial
                bosainfo bosaInfo = new bosainfo();

                if (GlobalData.initSetting.ONTTYPE == "GW040H" || (GlobalData.initSetting.ONTTYPE == "GW020BoB" && GlobalData.initSetting.ENABLEWRITEAPD == true))
                {
                    testtmp.SYSTEMLOG += string.Format("Get Bosa information...\r\n");
                    bosaInfo           = this._getDataByBosaSN(_BosaSN);
                    if (bosaInfo == null)
                    {
                        testtmp.ERRORCODE   = "(Mã Lỗi: COT-BS-0001)";
                        testtmp.SYSTEMLOG  += string.Format("...FAIL. {0}. Bosa SN is not existed\r\n", testtmp.ERRORCODE);
                        testtmp.TOTALRESULT = Parameters.testStatus.FAIL.ToString();
                        goto END;
                    }
                    testtmp.SYSTEMLOG += string.Format("...Ith= {0}mA\r\n", bosaInfo.Ith);
                    testtmp.SYSTEMLOG += string.Format("...Vbr= {0}V\r\n", bosaInfo.Vbr);
                    testtmp.SYSTEMLOG += string.Format("...PASS\r\n");
                }

                //Calib
                testtmp.TOTALRESULT   = Parameters.testStatus.Wait.ToString();
                testtmp.BUTTONCONTENT = "STOP"; testtmp.BUTTONENABLE = false;
                bool _result          = RunAll(testtmp, bosaInfo, vari);

                testtmp.TOTALRESULT = _result == false ? Parameters.testStatus.FAIL.ToString() : Parameters.testStatus.PASS.ToString();

                END:
                testtmp.SYSTEMLOG    += string.Format("\r\n----------------------------\r\nTotal Judged={0}\r\n", testtmp.TOTALRESULT);
                testtmp.BUTTONCONTENT = "START"; testtmp.BUTTONENABLE = true;

                //Stop count time
                st.Stop();
                testtmp.SYSTEMLOG += string.Format("Total time = {0} seconds\r\n", st.ElapsedMilliseconds / 1000);
                testtmp.TOTALTIME += (st.ElapsedMilliseconds / 1000).ToString();

                //save log
                Function.IO.LogDetail.Save(testtmp);
                Function.IO.LogTest.Save(testtmp);
                //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//
            }));
            t.IsBackground = true;
            t.Start();
            //***END -------------------------------------------//
        }
        public ActionResult RoleAuthorization(RoleAuthorization model, FormCollection formCollection)
        {
            GenelRepository gnlDB = RepositoryManager.GetRepository <GenelRepository>();

            model.activeRoles = gnlDB.GetActiveRoles();
            ViewBag.Success   = true;

            SessionContext.Current.ActiveUser.FromUpdateButton = model.FromUpdateButton;
            SessionContext.Current.ActiveUser.SelectedRoleId   = model.SelectedRoleId;

            if (SessionContext.Current.ActiveUser.FromUpdateButton == "1")
            {
                try
                {
                    gnlDB.DeleteRoleRights(model.SelectedRoleId);

                    DataSet dsMenu = BaseDB.DBManager.AppConnection.GetDataSet("select * from gnl_menu");

                    foreach (DataRow row in dsMenu.Tables[0].Rows)
                    {
                        bool menuRight      = false;
                        bool deleteRight    = false;
                        bool updateRight    = false;
                        bool reportRight    = false;
                        bool newRecordRight = false;

                        foreach (var key in formCollection.AllKeys)
                        {
                            string[] arr = key.Split('_');
                            if (arr.Length > 1)
                            {
                                if (arr[1] != "" && BaseFunctions.getInstance().IsNumeric(arr[1]) && arr[1] == row["menu_id"].ToString())
                                {
                                    if (arr[0] == "Show")
                                    {
                                        menuRight = true;
                                    }

                                    if (arr[0] == "Update")
                                    {
                                        updateRight = true;
                                    }

                                    if (arr[0] == "Delete")
                                    {
                                        deleteRight = true;
                                    }

                                    if (arr[0] == "Report")
                                    {
                                        reportRight = true;
                                    }

                                    if (arr[0] == "NewRecord")
                                    {
                                        newRecordRight = true;
                                    }
                                }
                            }
                        }
                        gnl_role_rights rights = new gnl_role_rights();
                        gnlDB.AddRoleRights(rights, Guid.Parse(model.SelectedRoleId), Convert.ToInt32(row["menu_id"].ToString()), menuRight, updateRight, deleteRight, reportRight, newRecordRight);
                    }

                    ViewBag.ResultMessage = Resources.GlobalResource.transaction_success;
                }
                catch (Exception exp)
                {
                    ViewBag.Success = false;
                    ModelState.AddModelError("Error", exp.Message);
                }
            }
            return(View(model));
        }
        public static byte[] createCryptKey(byte[] serialNumber, string pin)
        {
            string text = BaseFunctions.HexEncoder(serialNumber);

            return(HashBaseFunction.createBinaryHash(text.Substring(text.Length - 4, 4) + pin + text.Substring(0, 2)));
        }
예제 #30
0
        public DataSet CrearGuiaTransporte(E_GuiaTransporte CabeceraGuiaTransporte, DataTable DtDetalleGuiaRemisionVenta, string EmpresaSede)
        {
            string  NumGuiaTransportista;
            DataSet Ds = new DataSet();

            #region crear tabla cabecera
            DataTable DtCabecera = new DataTable("DtCabecera");
            DtCabecera.Columns.Add("NumGuiaTransportista", typeof(string));
            DtCabecera.Columns.Add("EmpresaID", typeof(string));
            DtCabecera.Columns.Add("NumGuiaRemision", typeof(string));
            DtCabecera.Columns.Add("DomicilioPartida", typeof(string));
            DtCabecera.Columns.Add("NroDomicilioPartida", typeof(Int32));
            DtCabecera.Columns.Add("IntDomicilioPartida", typeof(Int32));
            DtCabecera.Columns.Add("ZonaDomicilioPartida", typeof(string));
            DtCabecera.Columns.Add("DisDomicilioPartida", typeof(string));
            DtCabecera.Columns.Add("ProvDomicilioPartida", typeof(string));
            DtCabecera.Columns.Add("DepDomicilioPartida", typeof(string));
            DtCabecera.Columns.Add("DomicilioLlegada", typeof(string));
            DtCabecera.Columns.Add("NroDomicilioLlegada", typeof(Int32));
            DtCabecera.Columns.Add("IntDomicilioLlegada", typeof(Int32));
            DtCabecera.Columns.Add("ZonaDomicilioLlegada", typeof(string));
            DtCabecera.Columns.Add("DisDomicilioLlegada", typeof(string));
            DtCabecera.Columns.Add("ProvDomicilioLlegada", typeof(string));
            DtCabecera.Columns.Add("DepDomicilioLlegada", typeof(string));
            DtCabecera.Columns.Add("Remitente", typeof(string));
            DtCabecera.Columns.Add("RUCRemitente", typeof(string));
            DtCabecera.Columns.Add("DireccionRemitente", typeof(string));
            DtCabecera.Columns.Add("ObservacionRemitente", typeof(string));
            DtCabecera.Columns.Add("Destinatario", typeof(string));
            DtCabecera.Columns.Add("RUCDestinatario", typeof(string));
            DtCabecera.Columns.Add("DireccionDestinatario", typeof(string));
            DtCabecera.Columns.Add("ObservacionDestinatario", typeof(string));
            DtCabecera.Columns.Add("Marca", typeof(string));
            DtCabecera.Columns.Add("Placa", typeof(string));
            DtCabecera.Columns.Add("Carrosa", typeof(string));
            DtCabecera.Columns.Add("NombreChofer", typeof(string));
            DtCabecera.Columns.Add("DNIChofer", typeof(string));
            DtCabecera.Columns.Add("FechaSalida", typeof(DateTime));
            DtCabecera.Columns.Add("ConfiguracionVehicular", typeof(string));
            DtCabecera.Columns.Add("NroConstInscripcion", typeof(Int32));
            DtCabecera.Columns.Add("NroLicTransportista", typeof(string));
            DtCabecera.Columns.Add("UsuarioID", typeof(Int32));
            DtCabecera.Columns.Add("EstadoID", typeof(Int32));
            #endregion
            #region crear tabla detalle
            DataTable DtDetalleGuiaTransportista = new DataTable("DetalleGuiaRemisionVenta");
            DtDetalleGuiaTransportista.Columns.Add("NumGuiaTransportista", typeof(string));
            DtDetalleGuiaTransportista.Columns.Add("ProductoID", typeof(string));
            DtDetalleGuiaTransportista.Columns.Add("CantidadEnviada", typeof(decimal));
            DtDetalleGuiaTransportista.Columns.Add("NomProducto", typeof(string));
            DtDetalleGuiaTransportista.Columns.Add("UnidadMedidaID", typeof(string));
            DtDetalleGuiaTransportista.Columns.Add("PesoNeto", typeof(decimal));
            #endregion

            SqlDatabase  SqlClient  = new SqlDatabase(connectionString);
            SqlDatabase  SqlClientD = new SqlDatabase(connectionString);
            DbConnection tCnn;
            tCnn = SqlClient.CreateConnection();
            tCnn.Open();

            DbTransaction tran = tCnn.BeginTransaction();

            try
            {
                //acumular de 10
                DataTable NewDtDetalleGuiaRemisionVenta = DtDetalleGuiaRemisionVenta.Clone();
                foreach (DataRow Dr in DtDetalleGuiaRemisionVenta.Rows)
                {
                    NewDtDetalleGuiaRemisionVenta.ImportRow(Dr);
                    if (NewDtDetalleGuiaRemisionVenta.Rows.Count == 10)//maximo de lineas que puede contener una guia
                    {
                        //insertar la guia
                        DbCommand SqlCommand = SqlClient.GetStoredProcCommand("Almacen.Usp_InsertGuiaTransportista");
                        #region Cabecera guia
                        SqlClient.AddInParameter(SqlCommand, "@EmpresaID", SqlDbType.Char, CabeceraGuiaTransporte.EmpresaID);
                        SqlClient.AddInParameter(SqlCommand, "@NumGuiaRemision", SqlDbType.Char, CabeceraGuiaTransporte.NumGuiaRemision);
                        SqlClient.AddInParameter(SqlCommand, "@DomicilioPartida", SqlDbType.VarChar, CabeceraGuiaTransporte.DomicilioPartida);
                        SqlClient.AddInParameter(SqlCommand, "@NroDomicilioPartida", SqlDbType.Int, CabeceraGuiaTransporte.NroDomicilioPartida);
                        SqlClient.AddInParameter(SqlCommand, "@IntDomicilioPartida", SqlDbType.Int, CabeceraGuiaTransporte.IntDomicilioPartida);
                        SqlClient.AddInParameter(SqlCommand, "@ZonaDomicilioPartida", SqlDbType.VarChar, CabeceraGuiaTransporte.ZonaDomicilioPartida);
                        SqlClient.AddInParameter(SqlCommand, "@DisDomicilioPartida", SqlDbType.VarChar, CabeceraGuiaTransporte.DisDomicilioPartida);
                        SqlClient.AddInParameter(SqlCommand, "@ProvDomicilioPartida", SqlDbType.VarChar, CabeceraGuiaTransporte.ProvDomicilioPartida);
                        SqlClient.AddInParameter(SqlCommand, "@DepDomicilioPartida", SqlDbType.VarChar, CabeceraGuiaTransporte.DepDomicilioPartida);
                        SqlClient.AddInParameter(SqlCommand, "@DomicilioLlegada", SqlDbType.VarChar, CabeceraGuiaTransporte.DomicilioLlegada);
                        SqlClient.AddInParameter(SqlCommand, "@NroDomicilioLlegada", SqlDbType.Int, CabeceraGuiaTransporte.NroDomicilioLlegada);
                        SqlClient.AddInParameter(SqlCommand, "@IntDomicilioLlegada", SqlDbType.Int, CabeceraGuiaTransporte.IntDomicilioLlegada);
                        SqlClient.AddInParameter(SqlCommand, "@ZonaDomicilioLlegada", SqlDbType.VarChar, CabeceraGuiaTransporte.ZonaDomicilioLlegada);
                        SqlClient.AddInParameter(SqlCommand, "@DisDomicilioLlegada", SqlDbType.VarChar, CabeceraGuiaTransporte.DisDomicilioLlegada);
                        SqlClient.AddInParameter(SqlCommand, "@ProvDomicilioLlegada", SqlDbType.VarChar, CabeceraGuiaTransporte.ProvDomicilioLlegada);
                        SqlClient.AddInParameter(SqlCommand, "@DepDomicilioLlegada", SqlDbType.VarChar, CabeceraGuiaTransporte.DepDomicilioLlegada);
                        SqlClient.AddInParameter(SqlCommand, "@Remitente", SqlDbType.VarChar, CabeceraGuiaTransporte.Remitente);
                        SqlClient.AddInParameter(SqlCommand, "@RUCRemitente", SqlDbType.Char, CabeceraGuiaTransporte.RUCRemitente);
                        SqlClient.AddInParameter(SqlCommand, "@DireccionRemitente", SqlDbType.VarChar, CabeceraGuiaTransporte.DireccionRemitente);
                        SqlClient.AddInParameter(SqlCommand, "@ObservacionRemitente", SqlDbType.VarChar, CabeceraGuiaTransporte.ObservacionRemitente);
                        SqlClient.AddInParameter(SqlCommand, "@Destinatario", SqlDbType.VarChar, CabeceraGuiaTransporte.Destinatario);
                        SqlClient.AddInParameter(SqlCommand, "@RUCDestinatario", SqlDbType.Char, CabeceraGuiaTransporte.RUCDestinatario);
                        SqlClient.AddInParameter(SqlCommand, "@DireccionDestinatario", SqlDbType.VarChar, CabeceraGuiaTransporte.DireccionDestinatario);
                        SqlClient.AddInParameter(SqlCommand, "@ObservacionDestinatario", SqlDbType.VarChar, CabeceraGuiaTransporte.ObservacionDestinatario);
                        SqlClient.AddInParameter(SqlCommand, "@Marca", SqlDbType.VarChar, CabeceraGuiaTransporte.Marca);
                        SqlClient.AddInParameter(SqlCommand, "@Placa", SqlDbType.VarChar, CabeceraGuiaTransporte.Placa);
                        SqlClient.AddInParameter(SqlCommand, "@Carrosa", SqlDbType.VarChar, CabeceraGuiaTransporte.Carrosa);
                        SqlClient.AddInParameter(SqlCommand, "@NombreChofer", SqlDbType.VarChar, CabeceraGuiaTransporte.NombreChofer);
                        SqlClient.AddInParameter(SqlCommand, "@DNIChofer", SqlDbType.Char, CabeceraGuiaTransporte.DNIChofer);
                        SqlClient.AddInParameter(SqlCommand, "@FechaSalida", SqlDbType.DateTime, CabeceraGuiaTransporte.FechaSalida);
                        SqlClient.AddInParameter(SqlCommand, "@ConfiguracionVehicular", SqlDbType.VarChar, CabeceraGuiaTransporte.ConfiguracionVehicular);
                        SqlClient.AddInParameter(SqlCommand, "@NroConstInscripcion", SqlDbType.Int, CabeceraGuiaTransporte.NroConstInscripcion);
                        SqlClient.AddInParameter(SqlCommand, "@NroLicTransportista", SqlDbType.VarChar, CabeceraGuiaTransporte.NroLicTransportista);
                        SqlClient.AddInParameter(SqlCommand, "@TipoGuia", SqlDbType.Char, CabeceraGuiaTransporte.TipoGuia);
                        SqlClient.AddInParameter(SqlCommand, "@UsuarioID", SqlDbType.Int, CabeceraGuiaTransporte.UsuarioID);

                        SqlClient.AddInParameter(SqlCommand, "@EmpresaSede", SqlDbType.Char, EmpresaSede);
                        #endregion
                        NumGuiaTransportista = Convert.ToString(SqlClient.ExecuteScalar(SqlCommand, tran));

                        #region Agregar Cabecera
                        DataRow DRC = DtCabecera.NewRow();
                        DRC["NumGuiaTransportista"]    = NumGuiaTransportista;
                        DRC["EmpresaID"]               = CabeceraGuiaTransporte.EmpresaID;
                        DRC["NumGuiaRemision"]         = CabeceraGuiaTransporte.NumGuiaRemision;
                        DRC["DomicilioPartida"]        = CabeceraGuiaTransporte.DomicilioPartida;
                        DRC["NroDomicilioPartida"]     = CabeceraGuiaTransporte.NroDomicilioPartida;
                        DRC["IntDomicilioPartida"]     = CabeceraGuiaTransporte.IntDomicilioPartida;
                        DRC["ZonaDomicilioPartida"]    = CabeceraGuiaTransporte.ZonaDomicilioPartida;
                        DRC["DisDomicilioPartida"]     = CabeceraGuiaTransporte.DisDomicilioPartida;
                        DRC["ProvDomicilioPartida"]    = CabeceraGuiaTransporte.ProvDomicilioPartida;
                        DRC["DepDomicilioPartida"]     = CabeceraGuiaTransporte.DepDomicilioPartida;
                        DRC["DomicilioLlegada"]        = CabeceraGuiaTransporte.DomicilioLlegada;
                        DRC["NroDomicilioLlegada"]     = CabeceraGuiaTransporte.NroDomicilioLlegada;
                        DRC["IntDomicilioLlegada"]     = CabeceraGuiaTransporte.IntDomicilioLlegada;
                        DRC["ZonaDomicilioLlegada"]    = CabeceraGuiaTransporte.ZonaDomicilioLlegada;
                        DRC["DisDomicilioLlegada"]     = CabeceraGuiaTransporte.DisDomicilioLlegada;
                        DRC["ProvDomicilioLlegada"]    = CabeceraGuiaTransporte.ProvDomicilioLlegada;
                        DRC["DepDomicilioLlegada"]     = CabeceraGuiaTransporte.DepDomicilioLlegada;
                        DRC["Remitente"]               = CabeceraGuiaTransporte.Remitente;
                        DRC["RUCRemitente"]            = CabeceraGuiaTransporte.RUCRemitente;
                        DRC["DireccionRemitente"]      = CabeceraGuiaTransporte.DireccionRemitente;
                        DRC["ObservacionRemitente"]    = CabeceraGuiaTransporte.ObservacionRemitente;
                        DRC["Destinatario"]            = CabeceraGuiaTransporte.Destinatario;
                        DRC["RUCDestinatario"]         = CabeceraGuiaTransporte.RUCDestinatario;
                        DRC["DireccionDestinatario"]   = CabeceraGuiaTransporte.DireccionDestinatario;
                        DRC["ObservacionDestinatario"] = CabeceraGuiaTransporte.ObservacionDestinatario;
                        DRC["Marca"]                  = CabeceraGuiaTransporte.Marca;
                        DRC["Placa"]                  = CabeceraGuiaTransporte.Placa;
                        DRC["Carrosa"]                = CabeceraGuiaTransporte.Carrosa;
                        DRC["NombreChofer"]           = CabeceraGuiaTransporte.NombreChofer;
                        DRC["DNIChofer"]              = CabeceraGuiaTransporte.DNIChofer;
                        DRC["FechaSalida"]            = CabeceraGuiaTransporte.FechaSalida;
                        DRC["ConfiguracionVehicular"] = CabeceraGuiaTransporte.ConfiguracionVehicular;
                        DRC["NroConstInscripcion"]    = CabeceraGuiaTransporte.NroConstInscripcion;
                        DRC["NroLicTransportista"]    = CabeceraGuiaTransporte.NroLicTransportista;
                        DRC["UsuarioID"]              = CabeceraGuiaTransporte.UsuarioID;
                        DRC["EstadoID"]               = 0;
                        DtCabecera.Rows.Add(DRC);
                        #endregion

                        string xml, xmlDetalle;
                        xml        = new BaseFunctions().GetXML(NewDtDetalleGuiaRemisionVenta).Replace("NewDataSet", "DocumentElement");
                        xmlDetalle = xml.Replace("Table", "DetalleGuiaTransportista");

                        DbCommand SqlCommand2 = SqlClientD.GetStoredProcCommand("Almacen.Usp_Insert_XMLDetalleGuiaTransportistaVenta2");
                        SqlClientD.AddInParameter(SqlCommand2, "@XML", SqlDbType.Xml, xmlDetalle);
                        SqlClientD.AddInParameter(SqlCommand2, "@NumGuiaTransportista", SqlDbType.Char, NumGuiaTransportista);
                        SqlClientD.ExecuteNonQuery(SqlCommand2, tran);

                        #region agregar detalles
                        foreach (DataRow DR in NewDtDetalleGuiaRemisionVenta.Rows)
                        {
                            DataRow DRD = DtDetalleGuiaTransportista.NewRow();
                            DRD["NumGuiaTransportista"] = NumGuiaTransportista;
                            DRD["ProductoID"]           = DR["ProductoID"];
                            DRD["CantidadEnviada"]      = DR["CantidadEnviada"];
                            DRD["NomProducto"]          = DR["NomProducto"];
                            DRD["UnidadMedidaID"]       = DR["UnidadMedidaID"];
                            DRD["PesoNeto"]             = DR["PesoNeto"];
                            DtDetalleGuiaTransportista.Rows.Add(DRD);
                        }
                        #endregion

                        SqlCommand2.Dispose();
                        SqlCommand.Dispose();

                        NewDtDetalleGuiaRemisionVenta.Rows.Clear();
                    }
                }

                if (NewDtDetalleGuiaRemisionVenta.Rows.Count < 10 & NewDtDetalleGuiaRemisionVenta.Rows.Count > 0)//en caso de que la guia sea menor que 10
                {
                    //insertar la guia
                    DbCommand SqlCommand = SqlClient.GetStoredProcCommand("Almacen.Usp_InsertGuiaTransportista");
                    #region Cabecera guia
                    SqlClient.AddInParameter(SqlCommand, "@EmpresaID", SqlDbType.Char, CabeceraGuiaTransporte.EmpresaID);
                    SqlClient.AddInParameter(SqlCommand, "@NumGuiaRemision", SqlDbType.Char, CabeceraGuiaTransporte.NumGuiaRemision);
                    SqlClient.AddInParameter(SqlCommand, "@DomicilioPartida", SqlDbType.VarChar, CabeceraGuiaTransporte.DomicilioPartida);
                    SqlClient.AddInParameter(SqlCommand, "@NroDomicilioPartida", SqlDbType.Int, CabeceraGuiaTransporte.NroDomicilioPartida);
                    SqlClient.AddInParameter(SqlCommand, "@IntDomicilioPartida", SqlDbType.Int, CabeceraGuiaTransporte.IntDomicilioPartida);
                    SqlClient.AddInParameter(SqlCommand, "@ZonaDomicilioPartida", SqlDbType.VarChar, CabeceraGuiaTransporte.ZonaDomicilioPartida);
                    SqlClient.AddInParameter(SqlCommand, "@DisDomicilioPartida", SqlDbType.VarChar, CabeceraGuiaTransporte.DisDomicilioPartida);
                    SqlClient.AddInParameter(SqlCommand, "@ProvDomicilioPartida", SqlDbType.VarChar, CabeceraGuiaTransporte.ProvDomicilioPartida);
                    SqlClient.AddInParameter(SqlCommand, "@DepDomicilioPartida", SqlDbType.VarChar, CabeceraGuiaTransporte.DepDomicilioPartida);
                    SqlClient.AddInParameter(SqlCommand, "@DomicilioLlegada", SqlDbType.VarChar, CabeceraGuiaTransporte.DomicilioLlegada);
                    SqlClient.AddInParameter(SqlCommand, "@NroDomicilioLlegada", SqlDbType.Int, CabeceraGuiaTransporte.NroDomicilioLlegada);
                    SqlClient.AddInParameter(SqlCommand, "@IntDomicilioLlegada", SqlDbType.Int, CabeceraGuiaTransporte.IntDomicilioLlegada);
                    SqlClient.AddInParameter(SqlCommand, "@ZonaDomicilioLlegada", SqlDbType.VarChar, CabeceraGuiaTransporte.ZonaDomicilioLlegada);
                    SqlClient.AddInParameter(SqlCommand, "@DisDomicilioLlegada", SqlDbType.VarChar, CabeceraGuiaTransporte.DisDomicilioLlegada);
                    SqlClient.AddInParameter(SqlCommand, "@ProvDomicilioLlegada", SqlDbType.VarChar, CabeceraGuiaTransporte.ProvDomicilioLlegada);
                    SqlClient.AddInParameter(SqlCommand, "@DepDomicilioLlegada", SqlDbType.VarChar, CabeceraGuiaTransporte.DepDomicilioLlegada);
                    SqlClient.AddInParameter(SqlCommand, "@Remitente", SqlDbType.VarChar, CabeceraGuiaTransporte.Remitente);
                    SqlClient.AddInParameter(SqlCommand, "@RUCRemitente", SqlDbType.Char, CabeceraGuiaTransporte.RUCRemitente);
                    SqlClient.AddInParameter(SqlCommand, "@DireccionRemitente", SqlDbType.VarChar, CabeceraGuiaTransporte.DireccionRemitente);
                    SqlClient.AddInParameter(SqlCommand, "@ObservacionRemitente", SqlDbType.VarChar, CabeceraGuiaTransporte.ObservacionRemitente);
                    SqlClient.AddInParameter(SqlCommand, "@Destinatario", SqlDbType.VarChar, CabeceraGuiaTransporte.Destinatario);
                    SqlClient.AddInParameter(SqlCommand, "@RUCDestinatario", SqlDbType.Char, CabeceraGuiaTransporte.RUCDestinatario);
                    SqlClient.AddInParameter(SqlCommand, "@DireccionDestinatario", SqlDbType.VarChar, CabeceraGuiaTransporte.DireccionDestinatario);
                    SqlClient.AddInParameter(SqlCommand, "@ObservacionDestinatario", SqlDbType.VarChar, CabeceraGuiaTransporte.ObservacionDestinatario);
                    SqlClient.AddInParameter(SqlCommand, "@Marca", SqlDbType.VarChar, CabeceraGuiaTransporte.Marca);
                    SqlClient.AddInParameter(SqlCommand, "@Placa", SqlDbType.VarChar, CabeceraGuiaTransporte.Placa);
                    SqlClient.AddInParameter(SqlCommand, "@Carrosa", SqlDbType.VarChar, CabeceraGuiaTransporte.Carrosa);
                    SqlClient.AddInParameter(SqlCommand, "@NombreChofer", SqlDbType.VarChar, CabeceraGuiaTransporte.NombreChofer);
                    SqlClient.AddInParameter(SqlCommand, "@DNIChofer", SqlDbType.Char, CabeceraGuiaTransporte.DNIChofer);
                    SqlClient.AddInParameter(SqlCommand, "@FechaSalida", SqlDbType.DateTime, CabeceraGuiaTransporte.FechaSalida);
                    SqlClient.AddInParameter(SqlCommand, "@ConfiguracionVehicular", SqlDbType.VarChar, CabeceraGuiaTransporte.ConfiguracionVehicular);
                    SqlClient.AddInParameter(SqlCommand, "@NroConstInscripcion", SqlDbType.Int, CabeceraGuiaTransporte.NroConstInscripcion);
                    SqlClient.AddInParameter(SqlCommand, "@NroLicTransportista", SqlDbType.VarChar, CabeceraGuiaTransporte.NroLicTransportista);
                    SqlClient.AddInParameter(SqlCommand, "@TipoGuia", SqlDbType.Char, CabeceraGuiaTransporte.TipoGuia);
                    SqlClient.AddInParameter(SqlCommand, "@UsuarioID", SqlDbType.Int, CabeceraGuiaTransporte.UsuarioID);

                    SqlClient.AddInParameter(SqlCommand, "@EmpresaSede", SqlDbType.Char, EmpresaSede);
                    #endregion
                    NumGuiaTransportista = Convert.ToString(SqlClient.ExecuteScalar(SqlCommand, tran));

                    #region Agregar Cabecera
                    DataRow DRC = DtCabecera.NewRow();
                    DRC["NumGuiaTransportista"]    = NumGuiaTransportista;
                    DRC["EmpresaID"]               = CabeceraGuiaTransporte.EmpresaID;
                    DRC["NumGuiaRemision"]         = CabeceraGuiaTransporte.NumGuiaRemision;
                    DRC["DomicilioPartida"]        = CabeceraGuiaTransporte.DomicilioPartida;
                    DRC["NroDomicilioPartida"]     = CabeceraGuiaTransporte.NroDomicilioPartida;
                    DRC["IntDomicilioPartida"]     = CabeceraGuiaTransporte.IntDomicilioPartida;
                    DRC["ZonaDomicilioPartida"]    = CabeceraGuiaTransporte.ZonaDomicilioPartida;
                    DRC["DisDomicilioPartida"]     = CabeceraGuiaTransporte.DisDomicilioPartida;
                    DRC["ProvDomicilioPartida"]    = CabeceraGuiaTransporte.ProvDomicilioPartida;
                    DRC["DepDomicilioPartida"]     = CabeceraGuiaTransporte.DepDomicilioPartida;
                    DRC["DomicilioLlegada"]        = CabeceraGuiaTransporte.DomicilioLlegada;
                    DRC["NroDomicilioLlegada"]     = CabeceraGuiaTransporte.NroDomicilioLlegada;
                    DRC["IntDomicilioLlegada"]     = CabeceraGuiaTransporte.IntDomicilioLlegada;
                    DRC["ZonaDomicilioLlegada"]    = CabeceraGuiaTransporte.ZonaDomicilioLlegada;
                    DRC["DisDomicilioLlegada"]     = CabeceraGuiaTransporte.DisDomicilioLlegada;
                    DRC["ProvDomicilioLlegada"]    = CabeceraGuiaTransporte.ProvDomicilioLlegada;
                    DRC["DepDomicilioLlegada"]     = CabeceraGuiaTransporte.DepDomicilioLlegada;
                    DRC["Remitente"]               = CabeceraGuiaTransporte.Remitente;
                    DRC["RUCRemitente"]            = CabeceraGuiaTransporte.RUCRemitente;
                    DRC["DireccionRemitente"]      = CabeceraGuiaTransporte.DireccionRemitente;
                    DRC["ObservacionRemitente"]    = CabeceraGuiaTransporte.ObservacionRemitente;
                    DRC["Destinatario"]            = CabeceraGuiaTransporte.Destinatario;
                    DRC["RUCDestinatario"]         = CabeceraGuiaTransporte.RUCDestinatario;
                    DRC["DireccionDestinatario"]   = CabeceraGuiaTransporte.DireccionDestinatario;
                    DRC["ObservacionDestinatario"] = CabeceraGuiaTransporte.ObservacionDestinatario;
                    DRC["Marca"]                  = CabeceraGuiaTransporte.Marca;
                    DRC["Placa"]                  = CabeceraGuiaTransporte.Placa;
                    DRC["Carrosa"]                = CabeceraGuiaTransporte.Carrosa;
                    DRC["NombreChofer"]           = CabeceraGuiaTransporte.NombreChofer;
                    DRC["DNIChofer"]              = CabeceraGuiaTransporte.DNIChofer;
                    DRC["FechaSalida"]            = CabeceraGuiaTransporte.FechaSalida;
                    DRC["ConfiguracionVehicular"] = CabeceraGuiaTransporte.ConfiguracionVehicular;
                    DRC["NroConstInscripcion"]    = CabeceraGuiaTransporte.NroConstInscripcion;
                    DRC["NroLicTransportista"]    = CabeceraGuiaTransporte.NroLicTransportista;
                    DRC["UsuarioID"]              = CabeceraGuiaTransporte.UsuarioID;
                    DRC["EstadoID"]               = 0;
                    DtCabecera.Rows.Add(DRC);
                    #endregion

                    string xml, xmlDetalle;
                    xml        = new BaseFunctions().GetXML(NewDtDetalleGuiaRemisionVenta).Replace("NewDataSet", "DocumentElement");
                    xmlDetalle = xml.Replace("Table", "DetalleGuiaTransportista");

                    DbCommand SqlCommand2 = SqlClientD.GetStoredProcCommand("Almacen.Usp_Insert_XMLDetalleGuiaTransportistaVenta2");
                    SqlClientD.AddInParameter(SqlCommand2, "@XML", SqlDbType.Xml, xmlDetalle);
                    SqlClientD.AddInParameter(SqlCommand2, "@NumGuiaTransportista", SqlDbType.Char, NumGuiaTransportista);
                    SqlClientD.ExecuteNonQuery(SqlCommand2, tran);

                    #region agregar detalles

                    foreach (DataRow DR in NewDtDetalleGuiaRemisionVenta.Rows)
                    {
                        DataRow DRD = DtDetalleGuiaTransportista.NewRow();
                        DRD["NumGuiaTransportista"] = NumGuiaTransportista;
                        DRD["ProductoID"]           = DR["ProductoID"];
                        DRD["CantidadEnviada"]      = DR["CantidadEnviada"];
                        DRD["NomProducto"]          = DR["NomProducto"];
                        DRD["UnidadMedidaID"]       = DR["UnidadMedidaID"];
                        DRD["PesoNeto"]             = DR["PesoNeto"];
                        DtDetalleGuiaTransportista.Rows.Add(DRD);
                    }
                    #endregion

                    SqlCommand2.Dispose();
                    SqlCommand.Dispose();

                    NewDtDetalleGuiaRemisionVenta.Rows.Clear();
                }

                tran.Commit();
                tCnn.Close();
                tCnn.Dispose();

                Ds.Tables.Add(DtCabecera);
                Ds.Tables.Add(DtDetalleGuiaTransportista);

                return(Ds);
            }
            catch (Exception ex)
            {
                tran.Rollback();
                tCnn.Close();
                tCnn.Dispose();
                throw new Exception(ex.Message);
            }
        }
예제 #31
0
        private void BtnAnular_Click(object sender, EventArgs e)
        {
            if (MessageBox.Show("¿Seguro que desea anular la guia de remisión Nro: " + TxtNumGuiaRemision.Text + ".?", "Guia de remisión", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
            {
                //****************************** anular guia *****************************************

                #region Crear Tablas
                //tabla para actualizar el nuevo stock (agregar productos recepcionados)
                DataTable DtActuStockLocal = new DataTable();
                DtActuStockLocal.TableName = "StockAlmacen";
                DtActuStockLocal.Columns.Add("NumRequerimiento", typeof(string));
                DtActuStockLocal.Columns.Add("AlmacenID", typeof(string));
                DtActuStockLocal.Columns.Add("ProductoID", typeof(string));
                DtActuStockLocal.Columns.Add("StockAdicion", typeof(decimal));
                #endregion

                //actualizar datos del requerimiento
                CL_Requerimientos ObjCL_Requerimientos = new CL_Requerimientos();
                CL_GuiaRemision   ObjCL_GuiaRemision   = new CL_GuiaRemision();

                foreach (DataRow Row2 in DtDetalle.Rows)
                {
                    #region Actualizar Estado Requerimientos
                    string  NumRequerimiento;
                    decimal CantidadTransito;
                    string  ProductoID;


                    NumRequerimiento = Row2["NumRequerimiento"].ToString();
                    ProductoID       = Row2["ProductoID"].ToString();
                    CantidadTransito = Convert.ToDecimal(Row2["CantidadEnviada"]);

                    bool Valor;

                    Valor = ObjCL_Requerimientos.UpdateDetalleRequerimientoAnulado(NumRequerimiento, CantidadTransito, ProductoID, AppSettings.UserID, AppSettings.SedeID);

                    if (Valor == false)
                    {
                        MessageBox.Show("ocurrio un error al intentar actualizar el requerimiento: \r\nNumRequerimiento: " + NumRequerimiento + "ProductoID: " + ProductoID + "\r\nCantidadTransito: " + CantidadTransito, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }

                    Valor = ObjCL_GuiaRemision.UpdateGuiaRemisionEstado(TxtGuia.Text, 10, "A", AppSettings.UserID, AppSettings.SedeID);
                    #endregion

                    #region llenar tabla para actualizar el stock local
                    DataRow DrR = DtActuStockLocal.NewRow();
                    DrR["NumRequerimiento"] = Row2["NumRequerimiento"];
                    DrR["AlmacenID"]        = AppSettings.EmpresaID + AppSettings.SedeID + "000";
                    DrR["ProductoID"]       = Row2["ProductoID"];
                    DrR["StockAdicion"]     = Row2["CantidadEnviada"];
                    DtActuStockLocal.Rows.Add(DrR);
                    #endregion
                }

                #region agrupar para actualizar el stock local
                //Agrupar los productos apra almacenarlos
                DataTable DtProducto        = new DataTable();
                DataTable DtActuStockLocal2 = new DataTable();
                DtActuStockLocal2.TableName = "StockAlmacen";
                DtActuStockLocal2.Columns.Add("NumRequerimiento", typeof(string));
                DtActuStockLocal2.Columns.Add("AlmacenID", typeof(string));
                DtActuStockLocal2.Columns.Add("ProductoID", typeof(string));
                DtActuStockLocal2.Columns.Add("StockAdicion", typeof(decimal));
                DtProducto = new BaseFunctions().SelectDistinct(DtActuStockLocal, "ProductoID", "AlmacenID");
                foreach (DataRow RowP in DtProducto.Rows)
                {
                    DataView Dv = new DataView(DtActuStockLocal);
                    Dv.RowFilter = "ProductoID = '" + RowP["ProductoID"] + "' and AlmacenID = '" + RowP["AlmacenID"] + "'";
                    decimal Suma             = 0;
                    string  NumRequerimiento = "";
                    foreach (DataRowView Drv in Dv) //sumar las cantidades por producto
                    {
                        Suma            += Convert.ToDecimal(Drv["StockAdicion"]);
                        NumRequerimiento = Drv["NumRequerimiento"].ToString();
                    }
                    DataRow DrR = DtActuStockLocal2.NewRow();
                    DrR["NumRequerimiento"] = NumRequerimiento;
                    DrR["AlmacenID"]        = RowP["AlmacenID"];
                    DrR["ProductoID"]       = RowP["ProductoID"];
                    DrR["StockAdicion"]     = Suma;
                    DtActuStockLocal2.Rows.Add(DrR);
                }

                #endregion
                #region Actualizar el stock
                CL_Almacen ObjCL_Almacen = new CL_Almacen();

                foreach (DataRow R in DtActuStockLocal2.Rows)
                {
                    ObjCL_Almacen.UpdateStockAdidion(R["AlmacenID"].ToString(), R["ProductoID"].ToString(), Convert.ToDecimal(R["StockAdicion"]), R["NumRequerimiento"].ToString(), "R");
                }
                #endregion
            }

            MessageBox.Show("Se termino de anular la guía", "Guia remitente", MessageBoxButtons.OK, MessageBoxIcon.Information);
        }