public DataTable GetByIdFacturaDT(int idFactura)
        {
            try
            {
                using (cooperativaEntities bd = new cooperativaEntities())
                {

                    var Listar = (from fd in bd.facturas_detalles

                                  join c in bd.cod_conceptos on fd.id_concepto equals c.id_concepto
                                  where fd.id_factura == idFactura
                                  select new
                                  {
                                      c.concepto,
                                      valor=fd.importe

                                  }).ToList();

                    Commons oCommons = new Commons();
                    return oCommons.convertToTable(Listar);
                }

            }
            catch (Exception)
            {
                return null;
            }
        }
Exemplo n.º 2
0
        public DataTable CargarAcciones(int idSocio)
        {
            try
            {
                using (cooperativaEntities bd = new cooperativaEntities())
                {
                    var _Lista = (from p in bd.acciones
                                  where p.id_socio == idSocio
                                  orderby p.fecha
                                  select new
                                  {
                                    p.id_accion,
                                    p.fecha,
                                    p.importe,
                                    p.cuotas,
                                    p.valor_cuota,
                                    p.facturadas,
                                    p.pendientes,
                                    p.finalizado
                                  }
                                  ).ToList();

                    Commons oCommons = new Commons();
                    return oCommons.convertToTable(_Lista);
                }
            }
            catch (Exception)
            {
                return null;
            }
        }
Exemplo n.º 3
0
 public void OpenNewWindow(Commons.Message msg)
 {
     MessageWindow msgWindow = new MessageWindow(msg.Sender.UserName);
     Statics.MessageWindows.Add(msgWindow);
     SetMessage(msgWindow, msg);
     System.Windows.Forms.Application.Run(msgWindow);
 }
Exemplo n.º 4
0
        public void Delete(int idConvenio)
        {
            using (cooperativaEntities bd = new cooperativaEntities())
            {
                DataTable dtFacturas = new DataTable();
                FacturasImplement oFacturasImplement = new FacturasImplement();
                var listar = (from f in bd.facturas
                              where f.id_convenio == idConvenio
                                select f).ToList();
                Commons oCommons = new Commons();
                dtFacturas=oCommons.convertToTable(listar);

                foreach(DataRow dr in dtFacturas.Rows)
                {
                    int idFactura = int.Parse(dr["id_factura"].ToString());
                    facturas oFacturas = new facturas();
                    oFacturas = oFacturasImplement.Get(idFactura);
                    oFacturas.id_convenio = 0;
                    oFacturasImplement.Update(oFacturas);
                }

                var regis = (from p in bd.convenios
                             where p.id_convenio == idConvenio
                             select p).Single();

                bd.DeleteObject(regis);
                bd.SaveChanges();
            }
        }
Exemplo n.º 5
0
 public static void ProcessMessage(Commons.Message msg,TcpClient tcpClient)
 {
     Message response = new Message();
     switch (msg.Command)
     {
         case Statics.Commands.ADD:
             // List all the users.
             Message ack = new Message();
             ack.Sender = msg.Sender;
             ack.Command = Statics.Commands.USERONLINE;
             foreach(UserWrapper uw in Statics.ExtendedCurrentUsers)
             {
                 ack.To = uw.User.UserName;
                 if (uw.TcpClient.Connected)
                     Message.Send(ack, uw.TcpClient.GetStream());
             }
             Statics.CurrentUsers.Add(msg.Sender);
             Statics.ExtendedCurrentUsers.Add(new UserWrapper(msg.Sender, tcpClient));
             response = new Message();
             response.Command = Statics.Commands.LISTUSERS;
             response.Text = UserInfo.Serialize(Statics.CurrentUsers);
             Message.Send(response, tcpClient.GetStream());
             break;
         case Statics.Commands.SENDMSG:
             UserWrapper userWrapper = (from UserWrapper uw in Statics.ExtendedCurrentUsers where uw.User.UserName.Equals(msg.To) select uw).ToList<UserWrapper>().First();
             Message.Send(msg, userWrapper.TcpClient.GetStream());
             break;
         case Commons.Statics.Commands.USEROFFLINE:
             if (Statics.CurrentUsers.Contains(msg.Sender))
                 Statics.CurrentUsers.Remove(msg.Sender);
             break;
     }
 }
        public DataTable GetByFilterDT(int idBarrio, Boolean SinEstadoActual, int ordenarBy)
        {
            try
            {
                using (cooperativaEntities bd = new cooperativaEntities())
                {
                    var Listar = (from f in bd.facturas
                                  join sm in bd.socios_mediciones on f.id_medicion equals sm.id_medicion
                                  join s in bd.socios on f.id_socio equals s.id_socio
                                 //faltan barrio y demas datos

                                  select new
                                  {
                                      f.id_periodo,
                                      f.id_socio,
                                      s.codigo_socio,
                                      s.nombre,
                                      sm.fecha_lectura,
                                      sm.consumo,
                                      sm.lectura,
                                      fechaAnt = String.Empty,
                                      lecturaAnt = Decimal.Zero

                                  }).ToList();
                    Commons oCommons = new Commons();
                    return oCommons.convertToTable(Listar);
                }

            }
            catch (Exception ex)
            {
                return null;
            }
        }
Exemplo n.º 7
0
 public void WritePacket(Commons.Networking.AsyncConnection connection, Commons.Networking.ByteBuffer packet)
 {
     packet.WriteUInt(0xFFFFFFFF);
     packet.WriteString(objectType);
     packet.WriteUInt(_id);
     packet.WriteLong(0);
 }
Exemplo n.º 8
0
 public void WritePacket(Commons.Networking.AsyncConnection connection, Commons.Networking.ByteBuffer packet)
 {
     byte[] Msg = new byte[]
     {
        0xB8, 0xC4, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
     };
     packet.WriteBytes(Msg);
 }
Exemplo n.º 9
0
 public void ExecutePacket(Commons.Networking.AsyncConnection connection, Commons.Networking.ByteBuffer packet)
 {
     packet.ReadUInt();
     packet.ReadShort();
     string requestdeObjectName = packet.ReadString(); // OmegaServerProxyObjectName
     string signature = packet.ReadString();    // b7a6bba3:8ab55405:d7b5d3e1:5bc541f9
     packet.ReadString();   // Client
     uint objectId = packet.ReadUInt();
     SignatureService.ClientSignatureResponse(connection, requestdeObjectName, objectId, signature);
 }
Exemplo n.º 10
0
 public void SetMessage(MessageWindow messageWindow, Commons.Message message)
 {
     if (messageWindow.InvokeRequired)
     {
         SetMessageCallback callback = new SetMessageCallback(messageWindow.RecievedNewMessage);
         messageWindow.Invoke(callback, message.Text, message.Sender.UserName);
     }
     else
     {
         messageWindow.RecievedNewMessage(message.Text, message.Sender.UserName);
     }
 }
        public DataTable GetAllByIdMoratoria(int idmoratoria)
        {
            DataTable dt = new DataTable();
            using (cooperativaEntities bd = new cooperativaEntities())
            {
                var listado = (from p in bd.detalles_moratoria
                               where p.idmoratoria == idmoratoria
                               select p).ToList();

                Commons oCommons = new Commons();
                dt = oCommons.convertToTable(listado);

                return dt;
            }
        }
Exemplo n.º 12
0
        public DataTable GetAllDT()
        {
            using (cooperativaEntities bd = new cooperativaEntities())
            {
                var listar = (from p in bd.periodos
                              orderby p.id_periodo descending
                              select new
                              {
                                  p.id_periodo,
                                  periodo = p.id_periodo.Substring(4, 5) + "/" + p.id_periodo.Substring(0, 4)
                              }).ToList();

                Commons oCommons = new Commons();
                return oCommons.convertToTable(listar);
            }
        }
        private FECAECabRequest GetCabecera(FacturaTemplate factura, WSFE.Service servicio, WSFE.FEAuthRequest authRequest)
        {
            WSFE.FECAECabRequest cabecera = new FECAECabRequest();
            try
            {

                Commons commonUtilities = new Commons(servicio, authRequest);
                int? id = commonUtilities.GetTipoComprobanteId(factura.Comprobante, factura.TipoComprobante);
                cabecera.CbteTipo = id.Value;
                cabecera.CantReg = 1; //factura.Items.Count(); //Siempre enviamos uno solo. Como mejora a futuro se habla para procesamiento por lotes
                cabecera.PtoVta = commonUtilities.GetPuntoDeVentaId(factura.ComprobanteRelacionado).Value;
            }
            catch (Exception ex)
            {
                LoggerManager.Error("Ha ocurrido un error al generar la cabecera", ex);
            }
            return cabecera;
        }
Exemplo n.º 14
0
 public DataTable GetByProvinciaDT(string Provincia)
 {
     try
     {
         using (cooperativaEntities bd = new cooperativaEntities())
         {
             var Listar = (from p in bd.cod_provincias
                           where p.provincia.StartsWith(Provincia)
                           select p).ToList();
             Commons oCommons = new Commons();
             return oCommons.convertToTable(Listar);
         }
     }
     catch (Exception)
     {
         return null;
     }
 }
Exemplo n.º 15
0
        public decimal CalcularIVA(int idFactura)
        {
            using (cooperativaEntities bd = new cooperativaEntities())
            {
                Commons oCommons = new Commons();
                var detallesByFact = (from d in bd.facturas_detalles
                                      join c in bd.cod_conceptos on d.id_concepto equals c.id_concepto
                                      where d.id_factura == idFactura
                                      select new
                                      {
                                          d.id_factura,
                                          d.id_detalle,
                                          d.id_concepto,
                                          d.idOrden,
                                          d.idTipo,
                                          d.importe,
                                          c.id_formula,
                                          c.orden_concepto,
                                          c.tipo_signo,
                                          c.variable,
                                          c.activo,
                                          c.aplicar_descuento,
                                          c.aplicar_iva,
                                          c.aplicar_recargo,
                                          c.concepto
                                      }).ToList();
                DataTable detallesCalc = oCommons.convertToTable(detallesByFact);
                decimal IVA = 0;
                foreach (DataRow rowDet in detallesCalc.Rows)
                {
                    if(bool.Parse(rowDet["aplicar_iva"].ToString()))
                        IVA = IVA + decimal.Parse(rowDet["importe"].ToString());
                }
                int idSocio = 0;
                FacturasImplement oFacturasImplement = new FacturasImplement();
                idSocio = (int)oFacturasImplement.Get(idFactura).id_socio;
                socios oSocio = new socios();
                SocioImplement oSocioImplement = new SocioImplement();
                oSocio = oSocioImplement.Get(idSocio);
                IVA = IVA * (decimal.Parse(oSocio.iva.ToString())/100);

                return IVA;
            }
        }
        public ParcelTrackingPageViewModel(IParcelTrackingService parcelTrackingService)
        {
            _parcelTrackingService = parcelTrackingService;
            _parcelTrackingService.IsBusyChanged += (source, args) =>
            {
                IsBusy = (args as IsBusyEventArgs).IsBusy;
            };

            TrackingNumber = Settings.LastTrackingNumber;

            TrackCommand = new Command(async() =>
            {
                Settings.LastTrackingNumber = _trackingNumber;

                ParcelTrackingModel parcelTracking = null;
                try
                {
                    parcelTracking = await _parcelTrackingService.Track(_trackingNumber);

                    string title   = parcelTracking.TrackingNumber;
                    string message = $"Tracking: {parcelTracking.TrackingNumber}\n" +
                                     (!String.IsNullOrWhiteSpace(parcelTracking.Status)
                            ? $"Status: {parcelTracking.Status}\n" : "") +
                                     (!String.IsNullOrWhiteSpace(parcelTracking.Division)
                            ? $"Division: {parcelTracking.Division}\n" : "") +
                                     (!String.IsNullOrWhiteSpace(parcelTracking.LastUpdateString)
                            ? $"Last update: {parcelTracking.LastUpdateString}\n" : "") +
                                     (!String.IsNullOrWhiteSpace(parcelTracking.Status)
                            ? $"Notes: {parcelTracking.Notes}" : "");
                    await Application.Current.MainPage.DisplayAlert(title, message, "Ok");
                }
                catch (Exception ex)
                {
                    await Commons.DisplayAlert("Error", ex.Message, "Ok");
                }
            });
        }
Exemplo n.º 17
0
        private void loadUserShipsInPort(long UserID, bool hideMessage = false)
        {
            LOG.Debug("loadUserShipsInPort");
            PlayerShipImport Importer = WGAPI.GetPlayerShips(UserID);

            if (Importer.Status.ToLower().Equals("ok"))
            {
                List <PlayerShip> PersonalShips = new List <PlayerShip>();
                Dictionary <string, List <PlayerShip> > ImportedShips = Importer.Ships;

                foreach (KeyValuePair <string, List <PlayerShip> > ShipID in ImportedShips)
                {
                    foreach (PlayerShip PShip in ShipID.Value)
                    {
                        PersonalShips.Add(PShip);
                    }
                }

                string FileName = Commons.GetPersonalShipsFileName();
                BinarySerialize.WriteToBinaryFile <List <PlayerShip> >(FileName, PersonalShips);

                this.PersonalShips.Clear();
                foreach (PlayerShip PlayerShipData in PersonalShips)
                {
                    this.PersonalShips.Add(PlayerShipData.ID);
                }
                if (hideMessage == false)
                {
                    MessageBox.Show("Your ships have been imported.", "Load Personal Data", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            else
            {
                LOG.Warning("Unable to import personal ships: " + Importer.Status);
                MessageBox.Show("Some error occured during gathering of data. Try again later.", "Connection error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }
        private async void BtnAdd_Click(object sender, RoutedEventArgs e)
        {
            bool isValid = true; // 입력된 값이 모두 만족하는지 판별하는 플래그

            if (GrdData.SelectedItem == null)
            {
                await Commons.ShowMessageAsync("오류", "비활성화할 사용자를 선택하세요");

                // MessageBox.Show("비활성화할 사용자를 선택하세요.");
                return;
            }

            if (isValid)
            {
                try
                {
                    var user = GrdData.SelectedItem as Model.User;
                    user.UserActivated = false; // 사용자 비활성화

                    var result = Logic.DataAccess.SetUser(user);
                    if (result == 0)
                    {
                        await Commons.ShowMessageAsync("오류", "사용자 수정에 실패했습니다");

                        return;
                    }
                    else
                    {
                        NavigationService.Navigate(new UserList());
                    }
                }
                catch (Exception ex)
                {
                    Commons.LOGGER.Error($"예외발생 : {ex}");
                }
            }
        }
Exemplo n.º 19
0
        /// <summary>
        /// @author:wp
        /// @datetime:2016-09-22
        /// @desc:分页查询 带输出
        /// </summary>
        /// <typeparam name="TKey"></typeparam>
        /// <param name="pageIndex">页码</param>
        /// <param name="pageSize">页容量</param>
        /// <param name="whereLambda">条件 lambda表达式</param>
        /// <param name="orderBy">排序 lambda表达式</param>
        /// <returns></returns>
        public List <T> GetListByPageer <TKey>(IQueryable <T> query, int pageIndex, int pageSize, ref int rowCount, List <Expression <Func <T, bool> > > parmList, Expression <Func <T, TKey> > orderByLambda, bool isAsc = true, AspNetPager CtrPagerIndex = null)
        {
            if (query != null)
            {
                if (parmList != null)
                {
                    foreach (var parm in parmList)
                    {
                        query = query.Where(parm);
                    }
                }

                // 分页 一定注意: Skip 之前一定要 OrderBy

                rowCount = query.FutureCount();

                if (CtrPagerIndex != null)
                {
                    CtrPagerIndex.RecordCount      = rowCount;
                    CtrPagerIndex.PageSize         = pageSize;
                    CtrPagerIndex.CurrentPageIndex = pageIndex;
                    Commons.SavaChange(CtrPagerIndex);
                }
                //Commons.SavaChange(new AspNetPagerTool());


                if (isAsc)
                {
                    return(query.OrderBy(orderByLambda).Skip((pageIndex - 1) * pageSize).Take(pageSize).AsNoTracking().ToList());
                }
                else
                {
                    return(query.OrderByDescending(orderByLambda).Skip((pageIndex - 1) * pageSize).Take(pageSize).AsNoTracking().ToList());
                }
            }
            return(null);
        }
Exemplo n.º 20
0
        public int GetNewTestMethodId()
        {
            EntityTestMethod ldt = new EntityTestMethod();
            try
            {
                ldt = (from tbl in objData.tblTestMethods
                       where tbl.IsDelete == false
                       orderby tbl.TestMethodId descending
                       select new EntityTestMethod { TestMethodId = (tbl.TestMethodId + 1) }).FirstOrDefault();
            }
            catch (Exception ex)
            {

                Commons.FileLog("TestMethodBLL - GetNewTestMethodId()", ex);
            }
            if (ldt != null)
            {
                return ldt.TestMethodId;
            }
            else
            {
                return 1;
            }
        }
Exemplo n.º 21
0
        public DataTable GetByNombreDT(string nombre)
        {
            try
            {
                using (cooperativaEntities bd = new cooperativaEntities())
                {
                    var Listar = (from p in bd.cod_calles
                                  where p.calle.StartsWith(nombre)
                                  select new
                                  {
                                    Codigo = p.id_calle,
                                    p.calle,
                                    p.normalizado
                                  }).ToList();
                    Commons oCommons = new Commons();
                    return oCommons.convertToTable(Listar);
                }

            }
            catch (Exception)
            {
                return null;
            }
        }
Exemplo n.º 22
0
        private async void BtnDeactive_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                var user = GrdData.SelectedItem as Model.User;

                if (GrdData.SelectedItem == null || GrdData.SelectedIndex >= Logic.DataAccess.GetUsers().Count())
                {
                    await Commons.ShowMessageAsync("오류", "비활성화할 사용자를 선택하세요.");

                    return;
                }

                user.UserActivated = false;
                Logic.DataAccess.SetUser(user);
                LoadData();
                NavigationService.GoBack();
            }
            catch (Exception ex)
            {
                Commons.LOGGER.Error($"예외발생 BtnDeactive_Click : {ex}");
                throw ex;
            }
        }
        private void BtnEdit_Click(object sender, RoutedEventArgs e)
        {
            bool isValid = true; // 입력된 값이 모두 만족하는지 판별하는 플래그

            LblStoreName.Visibility = LblStoreLocation.Visibility = Visibility.Hidden;

            isValid = IsVaildInput(); // 유효성 체크

            if (isValid)
            {
                // MessageBox.Show("DB입력 처리 완료!");
                CurrentStore.StoreName     = TxtStoreName.Text;
                CurrentStore.StoreLocation = TxtStoreLocation.Text;

                try
                {
                    var result = Logic.DataAccess.SetStore(CurrentStore);
                    Commons.ShowMessageAsync("수정", "수정완료했습니다!");
                    if (result == 0)
                    {
                        // 수정 안됨
                        Commons.LOGGER.Error("AddStore.xaml.cs 창고정보 수정오류 발생");
                        Commons.ShowMessageAsync("오류", "수정시 오류가 발생했습니다");
                        return;
                    }
                    else
                    {
                        NavigationService.Navigate(new StoreList());
                    }
                }
                catch (Exception ex)
                {
                    Commons.LOGGER.Error($"예외발생 : {ex}");
                }
            }
        }
Exemplo n.º 24
0
        public WeightPageForCombinationViewModel(string combination)
        {
            NumberOfAxles = combination.Split(',')
                            .Select((a) => Convert.ToInt32(a))
                            .ToList();

            string imageFile = combination.Replace(',', '_') + ".png";

            ImageSource = ImageSourceHelper.GetFromResource(imageFile);

            PsiTableTruck          = DictionaryToList(_psiTableTruckBase);
            PsiTableTrailerGeneric = DictionaryToList(_psiTableTrailerGenericBase);

            SelectedIndexA = ApplicationPropertiesHelper.GetProperty(nameof(SelectedIndexA), -1);
            SelectedIndexB = ApplicationPropertiesHelper.GetProperty(nameof(SelectedIndexB), -1);
            SelectedIndexC = ApplicationPropertiesHelper.GetProperty(nameof(SelectedIndexC), -1);
            SelectedIndexD = ApplicationPropertiesHelper.GetProperty(nameof(SelectedIndexD), -1);

            HelpCommand = new Command(async() => {
                await Commons.DisplayAlert(AppResources.WeightHelpTitle, AppResources.WeightHelpMessage, "Ok");
            });

            MaxLegalWeight = (NumberOfAxles[2] > 0) ? 67500 : 5500 + GetMaxWeightForAxle(NumberOfAxles[0]) + GetMaxWeightForAxle(NumberOfAxles[1]);
        }
Exemplo n.º 25
0
        private void validateEntry(int idx)
        {
            errorLabel.Text = "";
            if (isshort)
            {
                editShortCode(idx);
            }

            if (isshort && IcnNumber.Length < 10)
            {
                MessageBox.Show(Commons.GetMessageString("TagReprintIcnNumberInvalid"), "Prompt", MessageBoxButtons.OK);
                return;

                if (errorLabel.Text.Length > 0)
                {
                    errorLabel.Text += System.Environment.NewLine + Commons.GetMessageString("TagReprintIcnNumberInvalid");
                }
                else
                {
                    errorLabel.Text = Commons.GetMessageString("TagReprintIcnNumberInvalid");
                }
            }

            if (!isshort && textBoxIcnNumber.Text.Length != 18)
            {
                MessageBox.Show(Commons.GetMessageString("TagReprintIcnNumberInvalid"), "Prompt", MessageBoxButtons.OK);
                if (errorLabel.Text.Length > 0)
                {
                    errorLabel.Text += System.Environment.NewLine + Commons.GetMessageString("TagReprintIcnNumberInvalid");
                }
                else
                {
                    errorLabel.Text = Commons.GetMessageString("TagReprintIcnNumberInvalid");
                }
            }
        }
Exemplo n.º 26
0
        public async Task <ObjectResultModule> LeaguerInfoList([FromBody] LeaguerInfo PageLeaguer)
        {
            if (!Commons.CheckSecret(PageLeaguer.Secret))
            {
                this.ObjectResultModule.StatusCode = 422;
                this.ObjectResultModule.Message    = "Wrong Secret";
                this.ObjectResultModule.Object     = "";
                return(this.ObjectResultModule);
            }
            var userid = _IabpSession.UserId > 0 ? (int)_IabpSession.UserId : 0;

            PageLeaguer.AndAlso(t => !t.IsDelete && t.CreatedBy == userid);
            if (!string.IsNullOrEmpty(PageLeaguer.Name))
            {
                PageLeaguer.AndAlso(t => t.LeaguerName.Contains(PageLeaguer.Name));
            }
            var value = await _LeaguerService.LeaguerInfoList(PageLeaguer);

            this.ObjectResultModule.Object     = value;
            this.ObjectResultModule.Message    = "sucess";
            this.ObjectResultModule.StatusCode = 200;
            #region 操作日志
            var CreateYaeherOperList = new YaeherOperList()
            {
                OperExplain = "LeaguerInfoList",
                OperContent = JsonHelper.ToJson(PageLeaguer),
                OperType    = "LeaguerInfoList",
                CreatedBy   = userid,
                CreatedOn   = DateTime.Now
            };
            var resultLog = await _yaeherOperListService.CreateYaeherOperList(CreateYaeherOperList);

            #endregion

            return(this.ObjectResultModule);
        }
Exemplo n.º 27
0
        private Boolean CheckInput()
        {
            if (txtMa.Text.Trim() == "")
            {
                Commons.Message_Warning("Bạn chưa nhập tên đơn vị");
                txtMa.Focus();
                return(false);
            }

            if (txtMaChuong.Text.Trim() == "")
            {
                Commons.Message_Warning("Bạn chưa nhập mã đơn vị");
                txtMaChuong.Focus();
                return(false);
            }

            if (grlDmLoaiKhoan.EditValue == null)
            {
                Commons.Message_Warning("Bạn chưa chọn loại đơn vị");
                grlDmLoaiKhoan.Focus();
                return(false);
            }
            return(true);
        }
Exemplo n.º 28
0
        public void assertAddedNewMessage()
        {
            test        = ReportsHelper.extent.CreateTest("General Message Test");
            this.extent = ReportsHelper.extent;

            LoginPageSteps             loginPageSteps             = new LoginPageSteps(driver, test);
            StatusPanelPageSteps       statusPanelPageSteps       = new StatusPanelPageSteps(driver, test);
            TelephonyWindowPageSteps   telephonyWindowPageSteps   = new TelephonyWindowPageSteps(driver, test);
            TransactionWindowPageSteps transactionWindowPageSteps = new TransactionWindowPageSteps(driver, test);
            FunctionMenuPageSteps      functionMenuPageSteps      = new FunctionMenuPageSteps(driver, test);
            ChildWindowsPageSteps      childWindowPageSteps       = new ChildWindowsPageSteps(driver, test);

            Commons commons = new Commons(driver, this.test);

            loginPageSteps.loginUsingSeatNo();
            statusPanelPageSteps.selectAdminWork();
            statusPanelPageSteps.selectFacility();
            telephonyWindowPageSteps.telephonyClickRejectAll();
            transactionWindowPageSteps.clickCancel();
            commons.clickYes();
            statusPanelPageSteps.selectMessage();
            statusPanelPageSteps.selectGeneralMessage();
            telephonyWindowPageSteps.telephonyClickRejectAll();
            transactionWindowPageSteps.populateFields();
            transactionWindowPageSteps.clickFirstRecord();
            transactionWindowPageSteps.clickReturn();
            commons.clickOK();
            transactionWindowPageSteps.populateMoreFields();
            telephonyWindowPageSteps.telephonyClickRejectAll();
            transactionWindowPageSteps.clickSendMessageBtn();
            transactionWindowPageSteps.clickSendBtn();
            transactionWindowPageSteps.clickF12EndCall();
            functionMenuPageSteps.selectTransResearch();
            childWindowPageSteps.validateAddedRecords("General Message");
            statusPanelPageSteps.logOut();
        }
Exemplo n.º 29
0
        private async void BtnAdd_Click(object sender, RoutedEventArgs e)//DB에서 고유키를 걸어줘서 더 이상 중복 데이터가 들어가지 않게 해주는 것이다. DB 디자인에서 UserEmail과 UserIdentityNumber에 대해 Unique키 설정. 스크립트 저장을 하고 나서 테이블 새로고침을 해야 나온다. D
        {
            bool isvalid = true;

            if (GrdData.SelectedItem == null)
            {
                await Commons.ShowMessageAsync("오류", "비활성화할 사용자를 선택하세요");//대기된 작업에서 이것이 시행됨

                return;
            }
            if (isvalid)
            {
                try
                {
                    var user = GrdData.SelectedItem as Model.User;
                    user.UserActivated = false;//사용자 비활성화

                    var result = Logic.DataAccess.SetUser(user);
                    if (result == 0)
                    {
                        await Commons.ShowMessageAsync("오류", "사용자 수정에 실패했어요"); //대기된 작업에서 이것이 시행됨

                        return;
                    }
                    else
                    {
                        //정상적 수정됨
                        NavigationService.Navigate(new UserList());
                    }
                }
                catch (Exception ex)//페이지는 메트로 인트로가 아니기 때문에 메시지 박스가 발생하지 않는다.
                {
                    Commons.LOGGER.Error($"예외발생 : {ex}");
                }
            }
        }
Exemplo n.º 30
0
        //Add ActionPlan
        public async Task <JsonResult> Add(AddActionPlanViewModel obj)
        {
            var userprofile = Session["UserProfile"] as UserProfileVM;

            obj.OwnerID = userprofile.User.ID;
            var data = await new ActionPlanDAO().Add(obj);//(item, obj.Subject, obj.Auditor, obj.CategoryID);

            NotificationHub.SendNotifications();
            if (data.ListEmails.Count > 0 && await new SettingDAO().IsSendMail("ADDTASK"))
            {
                string contentForPIC = @"<p><b>*PLEASE DO NOT REPLY* this email was automatically sent from the KPI system.</b></p> 
                                <p>The account <b>" + data.ListEmails.First()[0].ToTitleCase() + "</b> assigned a task to you in KPI Sytem App. </p>" +
                                       "<p>Task name : <b>" + data.ListEmails.First()[3] + "</b></p>" +
                                       "<p>Description : " + data.ListEmails.First()[4] + "</p>" +
                                       "<p>Link: <a href='" + data.QueryString + "'>Click Here</a></p>";

                string contentAuditor = @"<p><b>*PLEASE DO NOT REPLY* this email was automatically sent from the KPI system.</b></p> 
                                <p>The account <b>" + data.ListEmailsForAuditor.First()[0].ToTitleCase() + "</b> created a new task ,assigned you are an auditor in KPI Sytem App. </p>" +
                                        "<p>Task name : <b>" + data.ListEmailsForAuditor.First()[3] + "</b></p>" +
                                        "<p>Description : " + data.ListEmailsForAuditor.First()[4] + "</p>" +
                                        "<p>Link: <a href='" + data.QueryString + "'>Click Here</a></p>";
                Thread thread = new Thread(() =>
                {
                    Commons.SendMail(data.ListEmailsForAuditor.Select(x => x[1]).ToList(), "[KPI System-03] Action Plan (Add Task - Assign Auditor)", contentAuditor, "Action Plan (Add Task - Assign Auditor)");
                });
                Thread thread2 = new Thread(() =>
                {
                    Commons.SendMail(data.ListEmails.Select(x => x[1]).ToList(), "[KPI System-03] Action Plan (Add Task)", contentForPIC, "Action Plan (Add Task)");
                });
                thread.Start();
                thread2.Start();

                return(Json(new { status = data.Status, isSendmail = true, message = data.Message }, JsonRequestBehavior.AllowGet));
            }
            return(Json(new { status = data.Status, isSendmail = true, message = data.Message }, JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 31
0
        private void BtnAdd_Click(object sender, RoutedEventArgs e)
        {
            bool isValid = true; // 입력된 값이 모두 만족하는지 판별하는 플래그

            LblStoreLocation.Visibility = LblStoreLocation.Visibility = Visibility.Hidden;

            var store = new Model.Store();

            isValid = IsValidInput(); // 유효성 체크 (빈값 못넣도록 만들어줌, 필수임)

            if (isValid)
            {
                //MessageBox.Show("DB 입력처리!");
                store.StoreName     = TxtStoreName.Text;
                store.StoreLocation = TxtStoreLocation.Text;

                try
                {
                    var result = Logic.DataAccess.SetStore(store);
                    if (result == 0)
                    {
                        // 수정 안됨
                        Commons.LOGGER.Error("AddStore.xaml.cs 창고 정보 저장 오류 발생");
                        Commons.ShowMessageAsync("오류", "저장시 오류가 발생했습니다");
                    }
                    else
                    {
                        NavigationService.Navigate(new StoreList());
                    }
                }
                catch (Exception ex)
                {
                    Commons.LOGGER.Error($"예외발생 : {ex}");
                }
            }
        }
Exemplo n.º 32
0
        protected override void OnLoad(EventArgs e)
        {
            try
            {
                if (!this.DesignMode)
                {
                    DataTable countryTable = GlobalDataAccessor.Instance.DesktopSession.CountryTable;
                    if (countryTable.Rows.Count > 0)
                    {
                        ArrayList countries = new ArrayList();
                        foreach (DataRow dr in countryTable.Rows)
                        {
                            countries.Add(new CountryData(dr["country_code"].ToString(), dr["country_name"].ToString()));
                        }

                        //Madhu 12/07/2010 fix forbugzilla 10
                        countries.Insert(0, new CountryData("", "Select One"));

                        this.countryComboBox.DataSource    = countries;
                        this.countryComboBox.DisplayMember = "Name";
                        this.countryComboBox.ValueMember   = "Code";
                    }
                }

                //To do: There should be an application wide data structure that holds the country values
                //which will be used to populate the drop down in case the call to DB could not be completed or
                //the call did not yield any rows
            }
            catch (SystemException ex)
            {
                BasicExceptionHandler.Instance.AddException(Commons.GetMessageString("CountryDataFetchError"), ex);
            }


            base.OnLoad(e);
        }
Exemplo n.º 33
0
 /// <summary>
 /// 保存每个手机号每分钟调用短讯发送接口的次数
 /// 针对每一个手机号都有一个自己的Sorted Set
 /// key为 LogPhoneCount:phone
 /// </summary>
 /// <param name="list"></param>
 public void PhoneMinuteCount(List <Count> list)
 {
     lock (this)
     {
         for (int i = 0; i < list.Count; i++)
         {
             string        sortedSetKey = "LogPhoneMinuteCount:" + list[i].phone;
             string        value        = string.Empty;
             long          time         = Commons.ConvertDateTimeInt(list[i].time);
             List <string> listStr      = Redis.GetRangeFromSortedSetByLowestScore(sortedSetKey, time, time);
             if (listStr.Count > 0)
             {
                 string[] str = listStr[0].Split('_');
                 value = (Convert.ToInt32(str[0]) + list[i].count).ToString() + "_" + list[i].time.ToString();
                 Redis.RemoveItemFromSortedSet(sortedSetKey, listStr[0]);
             }
             else
             {
                 value = list[i].count.ToString() + "_" + list[i].time.ToString();
             }
             Redis.AddItemToSortedSet(sortedSetKey, value, time);
         }
     }
 }
Exemplo n.º 34
0
        private void simpleButton_save_Click(object sender, EventArgs e)
        {
            try
            {
                Server  dbServer = new Server(new ServerConnection(Commons.GetByKey("serverName"), Commons.GetByKey("userDatabase"), ""));
                Restore restore  = new Restore();
                restore.Database = "SMO";  // your database name

                // define options
                restore.Action = RestoreActionType.Database;
                restore.Devices.AddDevice(@"C:\SMOTest.bak", DeviceType.File);
                restore.PercentCompleteNotification = 10;
                restore.ReplaceDatabase             = true;

                // define a callback method to show progress
                restore.PercentComplete += new PercentCompleteEventHandler(res_PercentComplete);

                // execute the restore
                restore.SqlRestore(dbServer);
            }
            catch (Exception ex)
            {
            }
        }
Exemplo n.º 35
0
        protected void dgvReligion_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            try
            {
                DataTable ldt = new DataTable();
                EditBindCategory();
                if (e.CommandName == "EditReligion")
                {
                    //this.programmaticModalPopupEdit.Show();

                    int         linIndex         = Convert.ToInt32(e.CommandArgument);
                    GridViewRow gvr              = (GridViewRow)((Control)e.CommandSource).NamingContainer;
                    LinkButton  lnkReligionCode  = (LinkButton)gvr.FindControl("lnkReligionCode");
                    string      lstrReligionCode = lnkReligionCode.Text;
                    txtEditReligionCode.Text = lstrReligionCode;
                    ldt = mobjReligionBLL.GetReligionForEdit(lstrReligionCode);
                    FillControls(ldt);
                }
            }
            catch (Exception ex)
            {
                Commons.FileLog("frmAnaesthetistMaster -  dgvReligion_RowCommand(object sender, GridViewCommandEventArgs e)", ex);
            }
        }
Exemplo n.º 36
0
        private Boolean CheckInput()
        {
            if (txtTenDonVi.Text.Trim() == "")
            {
                Commons.Message_Warning("Bạn chưa nhập tên đơn vị");
                txtTenDonVi.Focus();
                return(false);
            }

            if (txtMaDonVi.Text.Trim() == "")
            {
                Commons.Message_Warning("Bạn chưa nhập mã đơn vị");
                txtMaDonVi.Focus();
                return(false);
            }

            if (cboDmNganHang.EditValue == null)
            {
                Commons.Message_Warning("Bạn chưa chọn loại đơn vị");
                cboDmNganHang.Focus();
                return(false);
            }
            return(true);
        }
Exemplo n.º 37
0
 //Term Mode
 private void cmbTerm_SelectedIndexChanged(System.Object sender, System.EventArgs e)
 {
     try
     {
         int year_selected = int.Parse(cmbYearTerm.SelectedItem.ToString());
         if (cmbTerm.SelectedIndex == 0)
         {
             //Term 1 : Month 1, 2, 3 : 1/1 - 31/3
             StartTemp = new System.DateTime(year_selected, 1, 1);
             EndTemp   = StartTemp.AddMonths(3).AddDays(-1);
         }
         else if (cmbTerm.SelectedIndex == 1)
         {
             //Term 2 : Month 4, 5, 6 : 1/4 - 30/6
             StartTemp = new System.DateTime(year_selected, 4, 1);
             EndTemp   = StartTemp.AddMonths(3).AddDays(-1);
         }
         else if (cmbTerm.SelectedIndex == 2)
         {
             //Term 3 : Month 7, 8, 9 : 1/7 - 30/9
             StartTemp = new System.DateTime(year_selected, 7, 1);
             EndTemp   = StartTemp.AddMonths(3).AddDays(-1);
         }
         else if (cmbTerm.SelectedIndex == 3)
         {
             //Term 4 : Month 10, 11, 12 : 1/10 - 31/12
             StartTemp = new System.DateTime(year_selected, 10, 1);
             EndTemp   = StartTemp.AddMonths(3).AddDays(-1);
         }
         SetValue();
     }
     catch (Exception ex)
     {
         Commons.Message_Error(ex);
     }
 }
Exemplo n.º 38
0
 private void workPhoneAreaCode_Leave(object sender, EventArgs e)
 {
     if (workPhoneAreaCode.Text.Length == 0)
     {
         if (workPhoneNumber.Text.Length > 0)
         {
             MessageBox.Show(Commons.GetMessageString("WorkAreaCodeNotEntered"));
         }
         //If work phone was set as primary change the primary to home or cell
         //depending on which one has numbers entered
         if (radioButtonWorkPhone.Checked)
         {
             radioButtonWorkPhone.Checked = false;
             if (homePhoneAreaCode.Text.Length > 0 && homePhoneNumber.Text.Length > 0)
             {
                 radioButtonHomePhone.Checked = true;
             }
             else if (cellPhoneAreaCode.Text.Length > 0 && cellPhoneNumber.Text.Length > 0)
             {
                 radioButtonCellPhone.Checked = true;
             }
         }
     }
 }
Exemplo n.º 39
0
 public void Embed(Commons.Container container, byte[] message)
 {
 }
        // Retorna una DT de Socios con los medidores no cargados
        public DataTable GetEstadosMedidores()
        {
            try
            {
                using (cooperativaEntities bd = new cooperativaEntities())
                {

                    var Listar = (from s in bd.socios
                                  join sc in bd.socios_conexion on s.id_socio equals sc.id_Socio
                                  join sm in bd.socios_mediciones on s.id_socio equals sm.id_socio
                                  join ces in bd.cod_estados_socios on s.estado equals ces.id_estado_socio
                                  where (sc.medidor != "") && ces.facturar == true && sm.lectura == 0
                                  select new
                                  {
                                      s.id_socio,
                                      s.nombre,
                                      sm.lectura

                                  }).ToList();

                    Commons oCommons = new Commons();
                    return oCommons.convertToTable(Listar);
                }

            }
            catch (Exception)
            {
                return null;
            }
        }
Exemplo n.º 41
0
        private void gvPayments_CellMouseEnter(object sender, DataGridViewCellEventArgs e)
        {
            if (e.ColumnIndex != colReceiptNumber.Index || e.RowIndex < 0)
            {
                return;
            }
            tooltipPanel.Visible = false;

            DataGridViewRow           row         = gvPayments.Rows[e.RowIndex];
            LayawayHistoryPaymentInfo paymentInfo = row.Tag as LayawayHistoryPaymentInfo;

            if (paymentInfo == null || paymentInfo.TenderDataDetails.Count == 0)
            {
                return;
            }

            tooltipPanel.Controls.Clear();
            tooltipPanel.ColumnCount = 2;
            tooltipPanel.RowCount    = paymentInfo.TenderDataDetails.Count + 1;
            tooltipPanel.Height      = (paymentInfo.TenderDataDetails.Count + 2) * 20;
            tooltipPanel.Width       = 275;

            tooltipPanel.Controls.Add(new Label()
            {
                Text = "Amount"
            });
            tooltipPanel.Controls.Add(new Label()
            {
                Text = "Tender Type"
            });

            foreach (TenderData tenderData in paymentInfo.TenderDataDetails)
            {
                string tenderDescription = Commons.GetTenderDescription(tenderData);
                tooltipPanel.Controls.Add(new Label()
                {
                    Text = tenderData.TenderAmount.ToString("c")
                });
                tooltipPanel.Controls.Add(new Label()
                {
                    Text = tenderDescription, AutoSize = true, AutoEllipsis = true
                });
            }

            tooltipPanel.ColumnStyles[0].SizeType = SizeType.Percent;
            tooltipPanel.ColumnStyles[0].Width    = 30;

            tooltipPanel.ColumnStyles[1].SizeType = SizeType.Percent;
            tooltipPanel.ColumnStyles[1].Width    = 70;

            foreach (RowStyle rowStyle in tooltipPanel.RowStyles)
            {
                rowStyle.SizeType = SizeType.Absolute;
                rowStyle.Height   = 20;
            }

            Rectangle cellPostition = gvPayments.GetCellDisplayRectangle(e.ColumnIndex, e.RowIndex, true);

            tooltipPanel.Location = new Point(gvPayments.Location.X + cellPostition.Left, gvPayments.Location.Y + cellPostition.Bottom);
            tooltipPanel.Visible  = true;
        }
 public Asignar_rol_a_usuario()
 {
     InitializeComponent();
     Commons.getInstance().cargarComboBox("Roles", "nombre", comboBoxRoles);
 }
Exemplo n.º 43
0
        //static Lib.Commons p = new Lib.Commons();


        static void Main(String[] args)
        {
            string weather = string.Empty;

            Task.Run(async() => {
                weather = await Helper.Helper.GetWeatherByCity("Bangalore,IN");
            }).Wait();


            Commons.Init();
            int choice;

            do
            {
                if (!string.IsNullOrEmpty(weather))
                {
                    Console.WriteLine($"Temperature: {weather} Deg");
                }
                Console.Write("\n-------------MENU--------------");
                Console.Write("\n 1. Add Students");
                Console.Write("\n 2. Display Students");
                Console.Write("\n 3. Update Student detals");
                Console.Write("\n 4. Serach Student details");
                Console.Write("\n 5. Highest Marks");
                Console.Write("\n 6. Exit");
                Console.Write("\n----------------------------");


                Console.Write("\n Enter your choice: ");
                var tempChoice = Console.ReadLine();
                if (int.TryParse(tempChoice, out choice))
                {
                    switch (choice)
                    {
                    case 1:
                        AddStudent();
                        Console.WriteLine("\n Students Added!!");
                        break;

                    case 2:
                        Console.WriteLine("The Student Details are: ");
                        DisplayStudents();
                        break;

                    case 3:
                        UpdateStudent();
                        Console.WriteLine("\n Students updated!!");
                        break;

                    case 4:
                        SearchStudent();
                        break;

                    case 5:
                        HighestAverageStudent();
                        break;

                    case 6:
                        Environment.Exit(0);
                        break;

                    default:
                        Console.WriteLine("\n Incorrect choice");
                        break;
                    }
                    Commons.SaveToFile();
                }

                //hello test
            } while (choice != 6);
        }
Exemplo n.º 44
0
        private void BtnExportPdf_Click(object sender, RoutedEventArgs e)
        {
            SaveFileDialog saveDialog = new SaveFileDialog();

            saveDialog.Filter   = "PDF File(*.pdf)|*.pdf";
            saveDialog.FileName = "";
            if (saveDialog.ShowDialog() == true)
            {
                // PDF 변환
                try
                {
                    // 0. PDF 사용 폰트 설정
                    string   nanumPath    = Path.Combine(Environment.CurrentDirectory, $"NanumGothic.ttf"); // 폰트경로
                    BaseFont nanumBase    = BaseFont.CreateFont(nanumPath, BaseFont.IDENTITY_H, BaseFont.EMBEDDED);
                    var      nanumTitle   = new iTextSharp.text.Font(nanumBase, 20f);                       // 20 타이틀용 나눔폰트
                    var      nanumContent = new iTextSharp.text.Font(nanumBase, 12f);                       // 12 내용 나눔폰트

                    // iTextSharp.text.Font font = new iTextSharp.text.Font(iTextSharp.text.Font.FontFamily.HELVETICA, 12);
                    string pdfFilePath = saveDialog.FileName;

                    // 1.PDF 생성

                    iTextSharp.text.Document pdfDoc = new Document(PageSize.A4);



                    // 2.PDF 내용 만들기
                    Paragraph title    = new Paragraph("부경대 재고관리시스템(SMS)\n", nanumTitle);
                    Paragraph subtitle = new Paragraph($"사용자리스트 exported : {DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}\n\n", nanumContent);

                    PdfPTable pdfTable = new PdfPTable(GrdData.Columns.Count);
                    pdfTable.WidthPercentage = 100;

                    // 그리드 헤더 작업
                    foreach (DataGridColumn column in GrdData.Columns)
                    {
                        PdfPCell cell = new PdfPCell(new Phrase(column.Header.ToString(), nanumContent));
                        cell.HorizontalAlignment = Element.ALIGN_CENTER;
                        pdfTable.AddCell(cell);
                    }

                    // 각 셀 사이즈 조정
                    float[] columnsWidth = new float[] { 7f, 15f, 10f, 15f, 27f, 12f, 10f };
                    pdfTable.SetWidths(columnsWidth);

                    // 그리드 Row 작업
                    foreach (var item in GrdData.Items)
                    {
                        if (item is Model.User)
                        {
                            var temp = item as Model.User;
                            // UserId
                            PdfPCell cell = new PdfPCell(new Phrase(temp.UserID.ToString(), nanumContent));
                            cell.HorizontalAlignment = Element.ALIGN_RIGHT;
                            pdfTable.AddCell(cell);
                            // UserIdentityNumber
                            cell = new PdfPCell(new Phrase(temp.UserIdentityNumber.ToString(), nanumContent));
                            cell.HorizontalAlignment = Element.ALIGN_LEFT;
                            pdfTable.AddCell(cell);
                            // UserSurName
                            cell = new PdfPCell(new Phrase(temp.UserSurname.ToString(), nanumContent));
                            cell.HorizontalAlignment = Element.ALIGN_LEFT;
                            pdfTable.AddCell(cell);
                            // UserName
                            cell = new PdfPCell(new Phrase(temp.UserName.ToString(), nanumContent));
                            cell.HorizontalAlignment = Element.ALIGN_LEFT;
                            pdfTable.AddCell(cell);
                            // UserEmail
                            cell = new PdfPCell(new Phrase(temp.UserEmail.ToString(), nanumContent));
                            cell.HorizontalAlignment = Element.ALIGN_LEFT;
                            pdfTable.AddCell(cell);
                            // UserAdmin
                            cell = new PdfPCell(new Phrase(temp.UserAdmin.ToString(), nanumContent));
                            cell.HorizontalAlignment = Element.ALIGN_LEFT;
                            pdfTable.AddCell(cell);
                            // UserActivated
                            cell = new PdfPCell(new Phrase(temp.UserActivated.ToString(), nanumContent));
                            cell.HorizontalAlignment = Element.ALIGN_LEFT;
                            pdfTable.AddCell(cell);
                        }
                    }

                    // 3.PDF 파일 생성
                    using (FileStream stream = new FileStream(pdfFilePath, FileMode.OpenOrCreate))
                    {
                        PdfWriter.GetInstance(pdfDoc, stream);
                        pdfDoc.Open();
                        // 2번에서 만든 내용 추가
                        pdfDoc.Add(title);
                        pdfDoc.Add(subtitle);
                        pdfDoc.Add(pdfTable);
                        pdfDoc.Close();
                        stream.Close(); // 안해도됨(선택)
                    }

                    Commons.ShowMessageAsync("PDF변환", "PDF 익스포트 성공했습니다");
                }
                catch (Exception ex)
                {
                    Commons.LOGGER.Error($"예외발생 BtnExportPdf_Click : {ex}");
                }
            }
        }
Exemplo n.º 45
0
        public int ObtenerLecturaAnterior(int idFactura)
        {
            int _LectAnt = 0;
            using (cooperativaEntities bd = new cooperativaEntities())
            {
                Commons oCommons = new Commons();

                FacturasImplement oFacturasImplement = new FacturasImplement();
                facturas oFactura = new facturas();

                oFactura = oFacturasImplement.Get(idFactura);

                var facturaAnterior = (from f in bd.facturas
                                       join m in bd.socios_mediciones on f.id_medicion equals m.id_medicion
                                       where f.id_factura < idFactura && f.id_socio == oFactura.id_socio
                                       orderby f.id_factura descending
                                       select new
                                       {
                                           f.id_factura,
                                           m.lectura
                                       }).Take(1).ToList();

                if (facturaAnterior.Count>0)
                    _LectAnt = (int)facturaAnterior[0].lectura;

            }
            return _LectAnt;
        }
Exemplo n.º 46
0
 private void txtCuotas_KeyPress(object sender, KeyPressEventArgs e)
 {
     Commons oCommons = new Commons();
     oCommons.ValidarNumeroEntero(sender, e);
 }
Exemplo n.º 47
0
        public decimal CalcularRecargo(int idFactura)
        {
            using (cooperativaEntities bd = new cooperativaEntities())
            {
                Commons oCommons = new Commons();

                MySqlCommand _comando = new MySqlCommand(String.Format(
                "call GetTotalRecargoByFactura('{0}')", idFactura), dbConectorMySql.ObtenerConexion());

                MySqlDataReader _reader = _comando.ExecuteReader();
                DataTable detallesCalc = new DataTable();
                detallesCalc.Load(_reader);
                decimal Recargo = 0;
                Recargo = decimal.Parse(detallesCalc.Rows[0][0].ToString());

                /*var detallesByFact = (from d in bd.facturas_detalles
                                      join c in bd.cod_conceptos on d.id_concepto equals c.id_concepto
                                      where d.id_factura == idFactura
                                      select new
                                      {
                                          d.id_factura,
                                          d.id_detalle,
                                          d.id_concepto,
                                          d.idOrden,
                                          d.idTipo,
                                          d.importe,
                                          c.id_formula,
                                          c.orden_concepto,
                                          c.tipo_signo,
                                          c.variable,
                                          c.activo,
                                          c.aplicar_descuento,
                                          c.aplicar_iva,
                                          c.aplicar_recargo,
                                          c.concepto
                                      }).ToList();
                DataTable detallesCalc = oCommons.convertToTable(detallesByFact);

                foreach (DataRow rowDet in detallesCalc.Rows)
                {
                    if (bool.Parse(rowDet["aplicar_recargo"].ToString()))
                        Recargo = Recargo + decimal.Parse(rowDet["importe"].ToString());
                }*/
               /* periodos oPeriodo = new periodos();
                PeriodosImplement oPeriososImplement = new PeriodosImplement();

                FacturasImplement oFacturasImplement = new FacturasImplement();
                oPeriodo = oPeriososImplement.Get(oFacturasImplement.Get(idFactura).id_periodo.ToString());*/
                TimeSpan diferencia;
                DateTime fecha_primer_venc=new DateTime();
                fecha_primer_venc = DateTime.Parse(detallesCalc.Rows[0][1].ToString());
                if (fecha_primer_venc < DateTime.Today)
                {
                    diferencia = DateTime.Today - DateTime.Parse(fecha_primer_venc.ToString());
                }
                else {
                    diferencia = DateTime.Today - DateTime.Today;
                }
                cod_conceptos oCod_conceptos = new cod_conceptos();
                ConceptoImplement oConceptoImplement = new ConceptoImplement();
                oCod_conceptos = oConceptoImplement.Get(18);

                decimal? days = diferencia.Days*oCod_conceptos.variable;
                decimal resultado = 0;
                if (days >= 0) {
                    resultado = (decimal)days;
                }

                int idSocio = 0;
                idSocio = int.Parse(detallesCalc.Rows[0][2].ToString());
                socios oSocio = new socios();
                SocioImplement oSocioImplement = new SocioImplement();
                oSocio = oSocioImplement.Get(idSocio);

                tarifas oTarifa = new tarifas();
                TarifaImplement oTarifaImplement = new TarifaImplement();
                oTarifa = oTarifaImplement.Get(oSocio.id_socio);

                Recargo = Recargo * resultado;
                DateTime fecha_segundo_venc = new DateTime();
                fecha_segundo_venc = DateTime.Parse(detallesCalc.Rows[0][3].ToString());
                if (fecha_segundo_venc > DateTime.Today)
                {
                    if (oTarifa.cargo_fijo > Recargo) //esto lo hago segun la marca en recargo en tabla tarifas?
                    {
                        Recargo = (decimal)oTarifa.cargo_fijo;
                    }
                }
                return Recargo;
            }
        }
        private WSFE.FECAEDetRequest[] GetDetalles(FacturaTemplate factura, WSFE.Service servicio, WSFE.FEAuthRequest authRequest)
        {
            WSFE.FECAEDetRequest[] fedetreq = new WSFE.FECAEDetRequest[1];

            try
            {
                WSFE.FECAEDetRequest detalle = new FECAEDetRequest();
                List<WSFE.AlicIva> alicuota_iva = new List<AlicIva>();

                Commons commonsUtilities = new Commons(servicio, authRequest);

                int tipo_comprobante = commonsUtilities.GetTipoComprobanteId(factura.Comprobante, factura.TipoComprobante).Value;
                int ptoVta = factura.PuntoDeVenta;
                int conceptoTipo = commonsUtilities.GetTipoConceptoId(factura.Concepto).Value;
                int documetoTipo = commonsUtilities.GetTipoDocumentoId(factura.TipoDocumento).Value;

                detalle.CbteDesde = commonsUtilities.GetComprobanteProximoAAtutorizar(ptoVta, tipo_comprobante) + 1; //numero de comprobante desde
                detalle.CbteHasta = detalle.CbteDesde; //numero de comprobante hasta
                detalle.CbteFch = factura.FechaFactura.ToString("yyyyMMdd");
                detalle.Concepto = conceptoTipo;
                detalle.DocTipo = documetoTipo;
                detalle.DocNro = factura.Cuit;
                detalle.MonId = "PES";//Siempre pesos
                detalle.MonCotiz = 1;//Cotizacion de la moneda es siempre 1 porque es pesos

                if (factura.Concepto.Equals("S"))
                {
                    detalle.FchServDesde = factura.FechaDesde.ToString("yyyyMMdd");
                    detalle.FchServHasta = factura.FechaHasta.ToString("yyyyMMdd");
                    detalle.FchVtoPago = factura.FechaVencimiento.ToString("yyyyMMdd");
                }

                double importeSinIVA = 0;
                double totalIVA = 0;

                //Sumamos y calculamos
                //Como observacion hay que aclarar que el tema de los decimales es bastante complicado y pueden existir
                //situaciones donde la AFIP rechace las solicitudes por redondeos que se efectuan de distinta manera
                foreach (FacturaItemsTemplate item in factura.GetItems())
                {
                    importeSinIVA += item.Unitario;
                    totalIVA += (item.Unitario * (item.TasaIVA / 100));

                    WSFE.AlicIva iva = new AlicIva();
                    iva.BaseImp = item.Unitario;
                    iva.Importe = (item.Unitario * (item.TasaIVA / 100));
                    iva.Id = commonsUtilities.GetTipoIVAId(item.TasaIVA);
                    alicuota_iva.Add(iva);
                }

                detalle.ImpIVA = Math.Round(totalIVA, 2);
                detalle.ImpNeto = Math.Round(importeSinIVA, 2);
                detalle.ImpTotal = detalle.ImpIVA + detalle.ImpNeto;
                detalle.ImpTrib = 0.0;
                detalle.Iva = alicuota_iva.GroupBy(x => x.Id).Select(x => new WSFE.AlicIva
                {
                    Id = x.Key,
                    Importe = Math.Round(x.Sum(i => i.Importe), 2),
                    BaseImp = Math.Round(x.Sum(i => i.BaseImp), 2)
                }).ToArray();
                fedetreq[0] = detalle;
            }
            catch (Exception ex)
            {
                LoggerManager.Error("Ha ocurrido un error al generar el detalle", ex);
            }

            return fedetreq;
        }
 /// <summary>
 /// Инициализация загрузчика
 /// </summary>
 /// <param name="configuration">Конфигурация среды</param>
 public override void Init(Commons.Collections.ExtendedProperties configuration)
 {
     this.domainName = (String)configuration["domain"];
 }
Exemplo n.º 50
0
 public void Embed(Commons.Container container, byte[] message)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 51
0
 public byte[] Extract(Commons.Container container, Commons.Key key)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 52
0
        void ProcessMessage(Commons.Message msg, NetworkStream ns)
        {
            Commons.Message response = new Commons.Message();

            switch (msg.Command)
            {
                case Commons.Statics.Commands.LISTUSERS:
                    // List all the users.
                    Statics.CurrentUsers = Commons.UserInfo.Deserialize(msg.Text);
                    break;
                case Commons.Statics.Commands.SENDMSG:
                    //Statics.MessageQueue.Add(msg);
                    if (Statics.MessageWindows.Count > 0)
                    {
                        List<string> tags = (from MessageWindow mw in Statics.MessageWindows select mw.Tag.ToString()).ToList<string>();
                        if (!tags.Contains(msg.Sender.UserName))
                        {
                            MessageWindow msgWindow = new MessageWindow(msg.Sender.UserName);
                            msgWindow.Show();
                            Statics.MessageWindows.Add(msgWindow);
                        }
                        else
                        {
                            MessageWindow msw = (MessageWindow)(from MessageWindow mw in Statics.MessageWindows where mw.Tag.ToString().Equals(msg.Sender.UserName) select mw).ToList<MessageWindow>().First<MessageWindow>();
                            SetMessage(msw, msg);
                        }
                    }
                    else
                    {
                        OpenNewWindow(msg);
                    }
                    break;
                case Commons.Statics.Commands.USERONLINE:
                    if (!Statics.CurrentUsers.Contains(msg.Sender))
                        Statics.CurrentUsers.Add(msg.Sender);
                    break;
                case Commons.Statics.Commands.USEROFFLINE:
                    if (Statics.CurrentUsers.Contains(msg.Sender))
                        Statics.CurrentUsers.Remove(msg.Sender);
                    break;
            }
        }
Exemplo n.º 53
0
 public MainForm()
 {
     InitializeComponent();
     aux = new Commons();
 }
Exemplo n.º 54
0
 public DataTable GetByBarrioDT(string Barrio)
 {
     try
     {
         using (cooperativaEntities bd = new cooperativaEntities())
         {
             var Listar = (from p in bd.cod_barrios
                           where p.barrio.StartsWith(Barrio)
                           select p).ToList();
             Commons oCommons = new Commons();
             return oCommons.convertToTable(Listar);
         }
     }
     catch (Exception)
     {
         return null;
     }
 }
Exemplo n.º 55
0
 public MainController(Form parentForm)
 {
     this.parentForm = parentForm;
     comm            = new Commons();
     getView();
 }
Exemplo n.º 56
0
        public DataTable GetAllDT()
        {
            using (cooperativaEntities bd = new cooperativaEntities())
            {
                var Listar = (from p in bd.cod_conceptos
                              where p.activo.Value
                              select new
                              {
                                p.id_concepto,
                                p.concepto,
                                p.variable
                              }).ToList();

                Commons oCommons = new Commons();
                return oCommons.convertToTable(Listar);
            }
        }
        private void aceptar_Click(object sender, EventArgs e)
        {
            // Busco al usuario
            DataGridViewRow row = Commons.getInstance().getSelectedRow(dgvUsuarios);

            if (row == null)
            {
                MessageBox.Show("No se ha seleccionado ningun usuario");
            }
            else
            {
                string nombre   = row.Cells[0].Value.ToString();
                string apellido = row.Cells[1].Value.ToString();
                string dni      = row.Cells[2].Value.ToString();

                System.Data.SqlClient.SqlDataReader reader;
                string query = "SELECT * FROM JUST_DO_IT.BuscarUsuario ('" + nombre + "','" + apellido + "'," + dni + ") AS id";
                string idUsuario;
                try
                {
                    reader = Server.getInstance().query(query);
                    reader.Read();
                    idUsuario = reader["id"].ToString();
                    reader.Close();
                }
                catch (Exception ex1)
                {
                    MessageBox.Show(ex1.Message);
                    return;
                }



                // Busco al rol

                if (comboBoxRoles.Text == "")
                {
                    MessageBox.Show("No ingresó un rol");
                    return;
                }

                else
                {
                    string nombreRol = comboBoxRoles.Text;
                    idRol = Rol.obtenerID(nombreRol);
                }


                //Asigno Rol - Usuario
                query = "EXEC JUST_DO_IT.asignarRolAUsuario " + idRol + "," + idUsuario;
                try
                {
                    Server.getInstance().realizarQuery(query);
                    MessageBox.Show("El rol se asignó satisfactoriamente");
                }
                catch (Exception ex1)
                {
                    MessageBox.Show(ex1.Message);
                }

                this.Hide();
                new Vistas_Inicio.Inicio_Admin().Show();
            }
        }
Exemplo n.º 58
0
 public override void Init(Commons.Collections.ExtendedProperties configuration)
 {
     //nothing to configure
 }
 private void EditGunBookRecord_Load(object sender, EventArgs e)
 {
     this.NavControlBox.Owner = this;
     gunBookData = GlobalDataAccessor.Instance.DesktopSession.GunData;
     gunItemData = GlobalDataAccessor.Instance.DesktopSession.GunItemData;
     if (gunBookData != null && gunBookData.Rows.Count > 0)
     {
         gunCACCCode        = Utilities.GetStringValue(gunBookData.Rows[0]["cat_code"]);
         currentGunNo.Text  = Utilities.GetStringValue(gunBookData.Rows[0]["gun_number"]);
         originalGunNo.Text = Utilities.GetStringValue(gunBookData.Rows[0]["original_gun_number"]);
         newGunNo.Text      = Utilities.GetStringValue(gunBookData.Rows[0]["new_gun_number"]);
         status.Text        = Utilities.GetStringValue(gunBookData.Rows[0]["status_cd"]);
         statusDate.Text    = Utilities.GetDateTimeValue(gunBookData.Rows[0]["status_date"]).ToString("d", DateTimeFormatInfo.InvariantInfo);
         gunBound.Text      = Utilities.GetStringValue(gunBookData.Rows[0]["gun_bound"]);
         pageRecord.Text    = Utilities.GetStringValue(gunBookData.Rows[0]["gun_page"]) + "/" + Utilities.GetStringValue(gunBookData.Rows[0]["record_number"]);
         manufacturer.Text  = Utilities.GetStringValue(gunBookData.Rows[0]["manufacturer"]);
         model.Text         = Utilities.GetStringValue(gunBookData.Rows[0]["model"]);
         serialNumber.Text  = Utilities.GetStringValue(gunBookData.Rows[0]["serial_number"]);
         caliber.Text       = Utilities.GetStringValue(gunBookData.Rows[0]["caliber"]);
         type.Text          = Utilities.GetStringValue(gunBookData.Rows[0]["gun_type"]);
         importer.Text      = Utilities.GetStringValue(gunBookData.Rows[0]["importer"]);
         icnDocType         = Utilities.GetStringValue(gunBookData.Rows[0]["icn_doc_type"]);
         icn.Text           = Utilities.IcnGenerator(Utilities.GetIntegerValue(gunBookData.Rows[0]["icn_store"]),
                                                     Utilities.GetIntegerValue(gunBookData.Rows[0]["icn_year"]),
                                                     Utilities.GetIntegerValue(gunBookData.Rows[0]["icn_doc"]),
                                                     Utilities.GetStringValue(gunBookData.Rows[0]["icn_doc_type"]),
                                                     Utilities.GetIntegerValue(gunBookData.Rows[0]["icn_item"]),
                                                     Utilities.GetIntegerValue(gunBookData.Rows[0]["icn_sub_item"]));
         //acquisition data
         acquireCustNumber          = Utilities.GetStringValue(gunBookData.Rows[0]["acquire_customer_number"]);
         acquisitionCustomerNo.Text = acquireCustNumber;
         acquireTransactionType     = Utilities.GetStringValue(gunBookData.Rows[0]["acquire_transaction_type"]);
         acquisitionType.Text       = acquireTransactionType;
         acquireCustFirstName       = Utilities.GetStringValue(gunBookData.Rows[0]["acquire_first_name"]);
         acquireCustLastName        = Utilities.GetStringValue(gunBookData.Rows[0]["acquire_last_name"]);
         acquireCustMiddleName      = Utilities.GetStringValue(gunBookData.Rows[0]["acquire_middle_initial"]);
         acquisitionName.Text       = acquireCustFirstName + " " + acquireCustMiddleName + " " + acquireCustLastName;
         acquisitionTicket.Text     = Utilities.GetStringValue(gunBookData.Rows[0]["acquire_document_number"]);
         acquireCustomerAddress1    = Utilities.GetStringValue(gunBookData.Rows[0]["acquire_address"]);
         acquisitionAddress1.Text   = acquireCustomerAddress1;
         acquireCustomerCity        = Utilities.GetStringValue(gunBookData.Rows[0]["acquire_city"]);
         acquireCustomerState       = Utilities.GetStringValue(gunBookData.Rows[0]["acquire_state"]);
         acquireCustomerZipcode     = Utilities.GetStringValue(gunBookData.Rows[0]["acquire_postal_code"]);
         acquisitionAddress2.Text   = acquireCustomerCity + "," + acquireCustomerState + " " + acquireCustomerZipcode;
         acquisitionDate.Text       = Utilities.GetDateTimeValue(gunBookData.Rows[0]["acquire_date"]).ToShortDateString();
         acquireCustIDType          = Utilities.GetStringValue(gunBookData.Rows[0]["acquire_id_type"]);
         acquireCustIDNumber        = Utilities.GetStringValue(gunBookData.Rows[0]["acquire_id_number"]);
         acquireCustIDAgency        = Utilities.GetStringValue(gunBookData.Rows[0]["acquire_id_agency"]);
         acquisitionID.Text         = acquireCustIDType + " " + acquireCustIDAgency + " " + acquireCustIDNumber;
         //disposition data
         dispositionCustNumber       = Utilities.GetStringValue(gunBookData.Rows[0]["disposition_customer_number"]);
         dispositionCustomerNo.Text  = dispositionCustNumber;
         dispTransactionType         = Utilities.GetStringValue(gunBookData.Rows[0]["disposition_transaction_type"]);
         dispositionType.Text        = dispTransactionType;
         dispositionCustLastName     = Utilities.GetStringValue(gunBookData.Rows[0]["disposition_last_name"]);
         dispositionCustFirstName    = Utilities.GetStringValue(gunBookData.Rows[0]["disposition_first_name"]);
         dispositionCustMiddleName   = Utilities.GetStringValue(gunBookData.Rows[0]["disposition_middle_initial"]);
         dispositionName.Text        = dispositionCustFirstName + " " + dispositionCustMiddleName + " " + dispositionCustLastName;
         dispositionTicket.Text      = Utilities.GetStringValue(gunBookData.Rows[0]["disposition_document_number"]);
         dispositionCustomerAddress1 = Utilities.GetStringValue(gunBookData.Rows[0]["disposition_address"]);
         dispositionAddress1.Text    = dispositionCustomerAddress1;
         dispositionCustomerCity     = Utilities.GetStringValue(gunBookData.Rows[0]["disposition_city"]);
         dispositionCustomerState    = Utilities.GetStringValue(gunBookData.Rows[0]["disposition_state"]);
         dispositionCustomerZipcode  = Utilities.GetStringValue(gunBookData.Rows[0]["disposition_postal_code"]);
         dispositionAddress2.Text    = dispositionCustomerCity + "," + dispositionCustomerState + " " + dispositionCustomerZipcode;
         dispositionDate.Text        = Utilities.GetDateTimeValue(gunBookData.Rows[0]["disposition_date"]).ToShortDateString();
         dispositionCustIDType       = Utilities.GetStringValue(gunBookData.Rows[0]["disposition_id_type"]);
         dispositionCustIDAgency     = Utilities.GetStringValue(gunBookData.Rows[0]["disposition_id_agency"]);
         dispositionCustIDNumber     = Utilities.GetStringValue(gunBookData.Rows[0]["disposition_id_number"]);
         dispositionID.Text          = dispositionCustIDType + " " + dispositionCustIDAgency + " " + dispositionCustIDNumber;
         string gunStatus = Utilities.GetStringValue((gunBookData.Rows[0]["status_cd"]));
         if (gunStatus == "VO" || gunStatus == "PS")
         {
             labelErrMessage.Text = Commons.GetMessageString("GunEditError");
             DisableActions();
         }
         if (string.IsNullOrEmpty(dispositionCustNumber))
         {
             DispositionReplace.Enabled = false;
             DispositionEdit.Enabled    = false;
         }
         if (!SecurityProfileProcedures.CanUserModifyResource("EDIT GUN BOOK", GlobalDataAccessor.Instance.DesktopSession.LoggedInUserSecurityProfile, CashlinxPawnSupportSession.Instance) &&
             !SecurityProfileProcedures.CanUserModifyResource("EDIT RESTRICTED GUN BOOK FIELDS", GlobalDataAccessor.Instance.DesktopSession.LoggedInUserSecurityProfile, CashlinxPawnSupportSession.Instance))
         {
             firearmDescEdit.Enabled    = false;
             AcquisitionEdit.Enabled    = false;
             AcquisitionReplace.Enabled = false;
             DispositionEdit.Enabled    = false;
             DispositionReplace.Enabled = false;
         }
         if (string.IsNullOrEmpty(acquireCustNumber))
         {
             AcquisitionEdit.Enabled    = false;
             AcquisitionReplace.Enabled = false;
         }
         if (acquireTransactionType == "T" || acquireTransactionType == "C")
         {
             AcquisitionEdit.Enabled    = false;
             AcquisitionReplace.Enabled = false;
         }
         if (dispTransactionType == "T" || dispTransactionType == "C")
         {
             DispositionReplace.Enabled = false;
             DispositionEdit.Enabled    = false;
         }
     }
     else
     {
         labelErrMessage.Text = "Gun Book data not found";
         DisableActions();
     }
 }
        public DataTable GetByIdSocioDT(int idSocio)
        {
            try
            {

                using (cooperativaEntities bd = new cooperativaEntities())
                {
                    var Listar = (from f in bd.facturas
                                  join sm in bd.socios_mediciones on f.id_medicion equals sm.id_medicion
                                  where f.id_socio == idSocio
                                  select new
                                  {
                                      f.id_periodo,
                                      sm.fecha_lectura,
                                      sm.consumo,
                                      sm.lectura,
                                      fechaAnt = (from f2 in bd.facturas
                                                  join sm2 in bd.socios_mediciones on f2.id_medicion equals sm2.id_medicion
                                                  where f2.id_socio == idSocio & sm2.fecha_lectura < sm.fecha_lectura
                                                  orderby sm2.fecha_lectura descending
                                                  select new
                                                  {
                                                      sm2.fecha_lectura
                                                  }).First(),
                                      lecturaAnt = (from f2 in bd.facturas
                                                    join sm2 in bd.socios_mediciones on f2.id_medicion equals sm2.id_medicion
                                                    where f2.id_socio == idSocio & sm2.fecha_lectura < sm.fecha_lectura
                                                    orderby sm2.fecha_lectura descending
                                                    select new
                                                    {
                                                        sm2.lectura
                                                    }).First()

                                  }).ToList();

                    Commons oCommons = new Commons();
                    return oCommons.convertToTable(Listar);
                }

            }
            catch (Exception)
            {
                return null;
            }
        }