public int InsereRaio(int idPesquisa, string point, string distancia)
 {
     ObjectParameter pIdPesquisa = new ObjectParameter("pIdPesquisa", idPesquisa);
     ObjectParameter pointParameter = new ObjectParameter("pPonto", point);
     ObjectParameter distanceParameter = new ObjectParameter("pDistancia", distancia);
     return base.ExecuteFunction("InsereRaio", pIdPesquisa, pointParameter, distanceParameter);
 }
        public int Actualiza(int pIntIdExpediente, int pIntIdProyecto, String pStrDescripcion, String pStrEspecificaciones,
            Decimal pDecValorReferencial, String pStrTipoEjecutor, String pStrNomEjecutor, String pStrApeEjecutor, String pStrRazonSocialEjecutor,
            String pStrNomContacto, String pStrApeContaco, String pStrEmailContacto,
            String pStrTelfContacto, String pStrDireccionContacto, String pStrNomSupervisor,
            String pStrApeSupervisor, String pStrTelfSupervisor, String pStrEmailSupervisor,
            int pIntIdEjecutor, int pIntIdContacto, int pIntIdSupervisor, List<DocumentoExpedienteTecnicoOP> pLstDocumentos)
        {
            int intResultado = -999;

            try
            {
                ObrasPublicasEntities objContext = new ObrasPublicasEntities();

                ObjectParameter objResult = new ObjectParameter("pIntIdExp_out", typeof(int));

                objContext.sp_gop_upd_exp(pIntIdExpediente, pIntIdProyecto, pStrDescripcion, pStrEspecificaciones, pDecValorReferencial,
                   pStrTipoEjecutor, pStrNomEjecutor, pStrApeEjecutor, pStrRazonSocialEjecutor, pStrNomContacto,
                   pStrApeContaco, pStrEmailContacto, pStrTelfContacto, pStrDireccionContacto, pStrNomSupervisor, pStrApeSupervisor,
                   pStrTelfSupervisor, pStrEmailSupervisor, pIntIdEjecutor, pIntIdContacto,pIntIdSupervisor, objResult);

                var lstDocumentos = objContext.OP_DOCUMENTO_EXPEDIENTE_TECNICO.Where(doc => doc.coExpediente == pIntIdExpediente).ToList();

                foreach (OP_DOCUMENTO_EXPEDIENTE_TECNICO objDoc in lstDocumentos)
                {
                    objContext.OP_DOCUMENTO_EXPEDIENTE_TECNICO.DeleteObject(objDoc);
                }

                if (pLstDocumentos != null)
                {
                    foreach (DocumentoExpedienteTecnicoOP objDocumento in pLstDocumentos)
                    {
                        OP_DOCUMENTO_EXPEDIENTE_TECNICO objDocumentoExpTec = new OP_DOCUMENTO_EXPEDIENTE_TECNICO();
                        objDocumentoExpTec.coExpediente = pIntIdExpediente;
                        objDocumentoExpTec.feEmision = objDocumento.FechaEmision;
                        objDocumentoExpTec.noTipoDocExpTec = objDocumento.TipoDocumento;
                        objDocumentoExpTec.nuNroDOcumento = objDocumento.NroDocumento;
                        objDocumentoExpTec.txDescripcion = objDocumento.Descripcion;
                        objDocumentoExpTec.txRutaArchivo = objDocumento.RutaArchivo;
                        objDocumentoExpTec.nomArchivo = objDocumento.NomArchivo;
                        objContext.AddToOP_DOCUMENTO_EXPEDIENTE_TECNICO(objDocumentoExpTec);
                    }
                }
                objContext.SaveChanges();

                int intIdExpediente = Convert.ToInt32(objResult.Value.ToString());

                if (intIdExpediente > 0)
                {
                    intResultado = 1;
                }
                else{
                    intResultado = intIdExpediente;
                }
            }
            catch (Exception ex)
            {

            }
            return intResultado;
        }
示例#3
0
        public override OperationObject execute(DataSloj.SmartSoftwareBazaEntities entities)
        {
            System.Data.Objects.ObjectParameter idIstorijaKupovinePar = new System.Data.Objects.ObjectParameter("id_istorija_kupovine", System.Type.GetType("System.Int32"));

            if (this.IstorijaKupovineDataSelect != null && this.ListaKupljeneOpremaDataSelect != null)
            {
                int?idKupca = (this.IstorijaKupovineDataSelect.Kupac == null ? 0 : this.IstorijaKupovineDataSelect.Kupac.id_korisnici);

                entities.DodajUIstorijuKupovine(idIstorijaKupovinePar, this.IstorijaKupovineDataSelect.datum_prodaje, this.IstorijaKupovineDataSelect.prodavac.id_korisnici, idKupca == 0 ? null : idKupca, this.IstorijaKupovineDataSelect.ukupna_cena_kupovine, this.IstorijaKupovineDataSelect.broj_iskoriscenih_popust_poena);

                int idIstorijeKupovine = Convert.ToInt32(idIstorijaKupovinePar.Value);

                foreach (var item in this.ListaKupljeneOpremaDataSelect)
                {
                    entities.DodajUIstorijuKupovineOprema(item.id_oprema, item.prodataKolicina, item.cena, item.popust_na_cenu, item.ukupna_cena_artikla, idIstorijeKupovine);
                }
            }
            //ovde dole treba da stavimo return base.execute();
            //ali za to mora da napravmo gore select u base klasi
            OperationObject opObj = new OperationObject();

            opObj.Success = true;
            opObj.Niz     = new DbItemKupljenaOpremaSaParametrima[5];
            return(opObj);
        }
示例#4
0
        private void Button_Click_1(object sender, System.Windows.RoutedEventArgs e)
        {
            //string connectionString = "data source=АЛЕКСЕЙ-ПК;initial catalog=myDataBase;persist security info=True;user id=human;password=human;MultipleActiveResultSets=True;";
            //SqlConnection connDBPageOptions = new SqlConnection(connectionString);

            //try
            //{
            //    conn.Open();
            //}
            //catch (SqlException se)
            //{
            //    Console.WriteLine("Ошибка подключения:{0}", se.Message);
            //}
            //Console.WriteLine("Соедение успешно произведено");
            
            using( DBPageOptionsEntities dbPageOptions = new DBPageOptionsEntities() )
            {
                ObjectParameter lenParameter = new ObjectParameter("Len", typeof(int));
                dbPageOptions.Len(lenParameter);
                int len = Convert.ToInt32(lenParameter.Value);

                if (len != 0)
                {
                    dbPageOptions.Delete();
                }
                
                dbPageOptions.Insert(TBox_0.Text, "Text");
                dbPageOptions.Insert(TBox_1.Text, "Request");
                dbPageOptions.Insert(CBox_0.SelectedItem.ToString(), "Service");
                dbPageOptions.Insert(CBox_1.SelectedItem.ToString(), "Service");

                dbPageOptions.SaveChanges();
            }
        }
示例#5
0
        // GET api/userevents/5
        public ReturnValue Get(int id)
        {
            if (id < 0)
            {
                throw new HttpResponseException(HttpStatusCode.NotFound);
            }

            ReturnValue returnValue = new ReturnValue();

            try
            {
                ObjectParameter TotalCount = new ObjectParameter("TotalCount", typeof(int));
                returnValue.value = entity.UserEventGetList(id, TotalCount).ToList<UserEventGetList_Result>();

                returnValue.totalcount = (int)TotalCount.Value;
                returnValue.code = 0;
                returnValue.msg = "succes";
            }
            catch
            {
                throw new HttpResponseException(HttpStatusCode.InternalServerError);
            }

            return returnValue;
        }
示例#6
0
 public bool sendSMS(string shortcode, string msg, string msisdn, string operador)
 {
     ObjectParameter id = new ObjectParameter("id", typeof(int));
     var oper = operador == "movistar" ? "MOVPERU" : (operador == "claro" ? "CLAROPERU" : (operador == "comcel" ? operador.ToUpper() : "TELCEL"));
     var id_operator = (from op in _repository.tbl_operator where op.name == oper select op.id_operator).First();
     var id_sc = (from s in _repository.tbl_sms_sc where (s.sc == shortcode) && (s.id_operator == id_operator) select s.id_sc).First();
     try
     {
         if (operador == "claro")
         {
             ClaroSMS.sendClaroPeru(msisdn, msg, shortcode);
             _repository.sp_inject_mt((new Random().Next(9999)).ToString(), 3100, Int64.Parse(msisdn), msg, "", int.Parse(id_sc.ToString()), "t");
             return true;
         }
         else
         {
             _repository.sp_inject_mt((new Random().Next(9999)).ToString(), 3100, Int64.Parse(msisdn), msg, "", int.Parse(id_sc.ToString()), "t");
             return true;
         }
     }
     catch (Exception ex)
     {
         return false;
     }
 }
        public RespuestaSP SP_GuardarTransferencia(SG_TRANSFERENCIAS transferencia, int ID_USR)
        {
            RespuestaSP result = new RespuestaSP();
            ExecuteManager(uow =>
            {
                var context = (CityTruckContext)uow.Context;
                ObjectParameter p_res = new ObjectParameter("p_res", typeof(String));
                context.P_SG_GUARDAR_TRANFERENCIA(transferencia.ID_TRANSFERENCIA,transferencia.ID_CAJA_ORIGEN,transferencia.ID_CAJA_DESTINO,transferencia.FECHA,transferencia.CONCEPTO,transferencia.IMPORTE_BS,transferencia.OBSERVACION, ID_USR, p_res);
                try
                {
                    int result_id = Int32.Parse(p_res.Value.ToString());
                    if (result_id > 0)
                    {
                        result.success = true;
                        result.msg = "Proceso Ejecutado Correctamente";
                        result.id = result_id;
                    }
                    else
                    {
                        result.success = false;
                        result.msg = p_res.Value.ToString();
                        result.id = -1;
                    }
                }
                catch (FormatException e)
                {
                    result.success = false;
                    result.msg = p_res.Value.ToString();
                    result.id = -1;
                }

            });
            return result;
        }
        public List<Disbursement> CreateDisbursementBySRF(User createdBy, int stationeryRetrievalFormId)
        {
            try
            {
                ObjectParameter message = new ObjectParameter("Message", typeof(string));

                int errorCode = context.CreateDisbursementsBySRFId(stationeryRetrievalFormId,
                                                                   createdBy.UserID, message);

                if (errorCode == -1)
                    throw new Exceptions.StationeryRetrievalException(message.Value.ToString());
                else
                {
                    return
                        FindDisbursementByCriteria(new DisbursementSearchDTO()
                            {
                                StationeryRetrievalFormID = stationeryRetrievalFormId
                            });
                }
            }
            catch (Exception e)
            {
                throw e;
            }
        }
示例#9
0
        public static void SetUserSessions(string qcb_stUsrName)
        {
            try
            {
                SUContext db = new SUContext();
                UserSessionVM userSession = new UserSessionVM();
                //For geting user id
                var getUserId = from userId in db.Users
                             where userId.LoginName== qcb_stUsrName
                             select new {userId.LoginName, userId.UserId,userId.Name, userId.CanBeGM, userId.IsAdmin };
                foreach (var item in getUserId)
                {
                    userSession.UserId = item.UserId;
                    userSession.LoginName = item.LoginName;
                    userSession.UserName = item.Name;
                    userSession.CanBeGM = item.CanBeGM;
                    userSession.IsAdmin = item.IsAdmin;
                }
                using (SUContext context = new SUContext())
                {
                    //userSession.UserRights = context.sp_GetSecAttribs(qcb_stUsrName).ToList();
                    var token = new ObjectParameter("f_uidSessionToken", typeof(string));
                    //var result = context.sp_SessCreateToken(qcb_stUsrName, token);

                    if (token.Value != null)
                        userSession.UserSessionToken = (string)token.Value;

                    HttpContext.Current.Session["UserSession"] = userSession;
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
示例#10
0
        /// <summary>
        /// Metodo para registrar un nuevo pedido
        /// </summary>
        /// <returns></returns>
        public bool Insert()
        {
            try
            {
                //Objeto para recuperar el resultado
                System.Data.Objects.ObjectParameter output = new System.Data.Objects.ObjectParameter("pIDPEDIDO", typeof(int));

                using (var db = new DBEntities())
                {
                    //Ejecución del metodo para agregar el pedido
                    db.SP_INSERT_PEDIDO1(FechaPedido, FechaEntrega, Direccion, Cliente.Id, EstadoPedido.IdEstado, Ciudad, Pais, output);

                    //Conversion del valor del objeto output a Int
                    int idResultado = Convert.ToInt32(output.Value);

                    //Asignar el id del pedido generado al campo correspondiente
                    this.IdPedido = idResultado;

                    return(true);
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
                return(false);
            }
        }
示例#11
0
        public RespuestaSP SP_GrabarIngreso(SG_INGRESOS ing, int ID_USR)
        {
            RespuestaSP result = new RespuestaSP();
            ExecuteManager(uow =>
            {
                //var manager = new SG_INGRESOSManager(uow);
                var context = (CityTruckContext)uow.Context;
                ObjectParameter p_res = new ObjectParameter("p_res", typeof(String));
                context.P_SG_GUARDAR_INGRESOS(ing.ID_INGRESO, ing.FECHA, ing.CONCEPTO, ing.ID_CAJA, ing.IMPORTE, ID_USR, ing.ID_AMORTIZACION,p_res);

                try
                {
                    int result_id = Int32.Parse(p_res.Value.ToString());
                    if (result_id > 0)
                    {
                        result.success = true;
                        result.msg = "Proceso Ejecutado Correctamente";
                        result.id = result_id;
                    }
                    else
                    {
                        result.success = false;
                        result.msg = p_res.Value.ToString();
                        result.id = -1;
                    }
                }
                catch (FormatException e)
                {
                    result.success = false;
                    result.msg = p_res.Value.ToString();
                    result.id = -1;
                }
            });
            return result;
        }
        public virtual int addHeadimg(string imgPath, ObjectParameter imgID)
        {
            var imgPathParameter = imgPath != null ?
                new ObjectParameter("imgPath", imgPath) :
                new ObjectParameter("imgPath", typeof(string));

            return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction("addHeadimg", imgPathParameter, imgID);
        }
示例#13
0
 public string AddCountryDal(string f  , string Country, string isdcode, string Indiacalling, string countrycode, string currency, string impnotice, string importantnotice)
 {
     string Msg = string.Empty;
     ObjectParameter Opmsg = new ObjectParameter("Msg", typeof(string));
     int t = inv.Add_CountryInsert_tab(f, Country, isdcode, Indiacalling, countrycode, currency, impnotice, importantnotice, Opmsg);
     Msg = Convert.ToString(Opmsg.Value);
     return Msg;
 }
示例#14
0
        public virtual ObjectResult<string> pacjenciMiastoLista2(string parametr, ObjectParameter listaPacjentow)
        {
            var parametrParameter = parametr != null ?
                new ObjectParameter("parametr", parametr) :
                new ObjectParameter("parametr", typeof(string));

            return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction<string>("pacjenciMiastoLista2", parametrParameter, listaPacjentow);
        }
示例#15
0
     public virtual int spGetUserID(string userName, ObjectParameter userId)
     {
         var userNameParameter = userName != null ?
             new ObjectParameter("userName", userName) :
             new ObjectParameter("userName", typeof(string));
 
         return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction("spGetUserID", userNameParameter, userId);
     }
示例#16
0
        public virtual ObjectResult<sp_delete_sitetype_dependants_Result> sp_delete_sitetype_dependants(Nullable<long> typeID, ObjectParameter success, ObjectParameter errMsg)
        {
            var typeIDParameter = typeID.HasValue ?
                new ObjectParameter("typeID", typeID) :
                new ObjectParameter("typeID", typeof(long));

            return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction<sp_delete_sitetype_dependants_Result>("sp_delete_sitetype_dependants", typeIDParameter, success, errMsg);
        }
示例#17
0
        public virtual ObjectResult<sp_reset_event_derivatives_Result> sp_reset_event_derivatives(Nullable<long> eventID, ObjectParameter success, ObjectParameter errMsg)
        {
            var eventIDParameter = eventID.HasValue ?
                new ObjectParameter("eventID", eventID) :
                new ObjectParameter("eventID", typeof(long));

            return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction<sp_reset_event_derivatives_Result>("sp_reset_event_derivatives", eventIDParameter, success, errMsg);
        }
示例#18
0
 public static Invoice_PO GetInvoicePOByPOId(APCEntities APCContext, int poId)
 {
     ObjectParameter[] listParameter = new ObjectParameter[1];
     listParameter[0] = new ObjectParameter("POId", poId);
     if (APCContext.Invoice_PO.Where("it.PO.Id= @POId", listParameter).Count() > 0)
         return APCContext.Invoice_PO.Where("it.PO.Id= @POId", listParameter).First();
     return null;
 }
示例#19
0
        public virtual int ilePacjentow(string miasto, ObjectParameter liczba)
        {
            var miastoParameter = miasto != null ?
                new ObjectParameter("miasto", miasto) :
                new ObjectParameter("miasto", typeof(string));

            return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction("ilePacjentow", miastoParameter, liczba);
        }
     public virtual int aspnet_Applications_CreateApplication(string applicationName, ObjectParameter applicationId)
     {
         var applicationNameParameter = applicationName != null ?
             new ObjectParameter("ApplicationName", applicationName) :
             new ObjectParameter("ApplicationName", typeof(string));
 
         return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction("aspnet_Applications_CreateApplication", applicationNameParameter, applicationId);
     }
示例#21
0
     public virtual int InsertLanguage(ObjectParameter newID, string name)
     {
         var nameParameter = name != null ?
             new ObjectParameter("name", name) :
             new ObjectParameter("name", typeof(string));
 
         return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction("InsertLanguage", newID, nameParameter);
     }
示例#22
0
 static decimal FindSupplierIncomesForPeriodOfTime(string name, DateTime startDate, DateTime endDate)
 {
     using (NorthwindEntities nwDb = new NorthwindEntities())
     {
         var outputParameter = new ObjectParameter("result", typeof(decimal));
         nwDb.FindTotalSupplierIncomes(name,startDate,endDate, outputParameter);
         return decimal.Parse(outputParameter.Value.ToString());
     }
 }
示例#23
0
 public int AuthenticateUser()
 {
     mcpnetEntities_dev db = new mcpnetEntities_dev();
     ObjectParameter output = new ObjectParameter("UserID", typeof(Int32));
     ClassicEncryption enc = new ClassicEncryption();
     db.uspAuthenticateUser(this.UserName, enc.EncryptForLogin(this.Password), output);
     this.UserID = (int)output.Value;
     return this.UserID;
 }
示例#24
0
 public string insertcompany(string f, long cmpid , string CompanyName, string Address, string ManagingDirector, string ContactNo, string CustSupportNo,
 string PunchLine, string EmailID, string WebSite, string bankdetails, string panno, string servicetax, string loginusercode)
 {
     string Msg = string.Empty;
       ObjectParameter opmg = new ObjectParameter("Msg" , typeof(string));
     int t =  inv.InsertCompanyProfile_Insert(f, cmpid , CompanyName, "", Address, ManagingDirector, ContactNo, CustSupportNo, PunchLine,
       EmailID, WebSite, bankdetails, panno, servicetax, loginusercode,opmg);
       Msg = Convert.ToString(opmg.Value);
       return Msg;
 }
示例#25
0
        /* 
         * Metodo
         * Descripcion: Consulta el identificador de un pedido
         * Entrada: void
         * Salida: int
         */
        public int ConsultarIdentificadorPedido()
        {
            ObjectParameter iD_Pedido = new ObjectParameter("ID_Pedido", typeof(int));

            using (DB_AcmeEntities contexto = new DB_AcmeEntities())
            {
                contexto.ConsultarIdentificadorPedido(iD_Pedido);
            }

            return ((int)iD_Pedido.Value);
        }
        public string challanoutotherstableentry(string challanno, string cdate, string sno, string itemtype,
                         string itemname, string Imeino, string executivenameto, string executivename, string branchcode, string partnername)
        {
            string Msg = String.Empty;

            ObjectParameter obmg = new ObjectParameter("Msg", typeof(string));
            inv.challanoutothersproc_Insert("Insert", challanno, cdate, sno, itemtype, itemname, Imeino,
                                             executivenameto, executivename, 0, branchcode, partnername, "NOT ACTIVE", obmg);
            Msg = Convert.ToString(obmg.Value);
            return Msg;
        }
示例#27
0
  public string createuser(string f, string date, string Branchcode, string partnername, string User_Code, string UserType,
 string UserName, string password, string newpassword, string address, string mobileno, string emailid, string rolesetting, string valueassign)
  {
      string Msg = string.Empty;
      ObjectParameter opmg = new ObjectParameter("Msg", typeof(string));
      inv.UserNameInsert(f, date, Branchcode, partnername, User_Code, UserType, UserName, password, newpassword,
            address, mobileno, emailid, rolesetting, valueassign,"", opmg);
      Msg = Convert.ToString(opmg.Value);
      return Msg;
      // return 1;
  }
     /// <summary>
     /// No Metadata Documentation available.
     /// </summary>
     /// <param name="filterTerm">No Metadata Documentation available.</param>
     /// <param name="sortIndex">No Metadata Documentation available.</param>
     /// <param name="sortDirection">No Metadata Documentation available.</param>
     /// <param name="startRowNum">No Metadata Documentation available.</param>
     /// <param name="endRowNum">No Metadata Documentation available.</param>
     /// <param name="totalRowsCount">No Metadata Documentation available.</param>
     /// <param name="filteredRowsCount">No Metadata Documentation available.</param>
     public ObjectResult<pr_SearchPerson_Result> pr_SearchPerson(global::System.String filterTerm, Nullable<global::System.Int32> sortIndex, global::System.String sortDirection, Nullable<global::System.Int32> startRowNum, Nullable<global::System.Int32> endRowNum, ObjectParameter totalRowsCount, ObjectParameter filteredRowsCount)
     {
         ObjectParameter filterTermParameter;
         if (filterTerm != null)
         {
             filterTermParameter = new ObjectParameter("FilterTerm", filterTerm);
         }
         else
         {
             filterTermParameter = new ObjectParameter("FilterTerm", typeof(global::System.String));
         }
 
         ObjectParameter sortIndexParameter;
         if (sortIndex.HasValue)
         {
             sortIndexParameter = new ObjectParameter("SortIndex", sortIndex);
         }
         else
         {
             sortIndexParameter = new ObjectParameter("SortIndex", typeof(global::System.Int32));
         }
 
         ObjectParameter sortDirectionParameter;
         if (sortDirection != null)
         {
             sortDirectionParameter = new ObjectParameter("SortDirection", sortDirection);
         }
         else
         {
             sortDirectionParameter = new ObjectParameter("SortDirection", typeof(global::System.String));
         }
 
         ObjectParameter startRowNumParameter;
         if (startRowNum.HasValue)
         {
             startRowNumParameter = new ObjectParameter("StartRowNum", startRowNum);
         }
         else
         {
             startRowNumParameter = new ObjectParameter("StartRowNum", typeof(global::System.Int32));
         }
 
         ObjectParameter endRowNumParameter;
         if (endRowNum.HasValue)
         {
             endRowNumParameter = new ObjectParameter("EndRowNum", endRowNum);
         }
         else
         {
             endRowNumParameter = new ObjectParameter("EndRowNum", typeof(global::System.Int32));
         }
 
         return base.ExecuteFunction<pr_SearchPerson_Result>("pr_SearchPerson", filterTermParameter, sortIndexParameter, sortDirectionParameter, startRowNumParameter, endRowNumParameter, totalRowsCount, filteredRowsCount);
     }
示例#29
0
        /* 
         * Metodo
         * Descripcion: Autentica a un vendedor 
         * Entrada: string, string
         * Salida: bool
         */
        public bool AutenticarVendedor(string nombreUsuario, string contrasenia)
        {
            ObjectParameter resultado = new ObjectParameter("Resultado", typeof(String));

            using (DB_AcmeEntities contexto = new DB_AcmeEntities())
            {
                contexto.AutenticarVendedor(nombreUsuario, contrasenia, resultado);
            }

            return ((bool)resultado.Value);
        }
     /// <summary>
     /// No Metadata Documentation available.
     /// </summary>
     /// <param name="optBrandCodes">No Metadata Documentation available.</param>
     /// <param name="startMonth">No Metadata Documentation available.</param>
     /// <param name="startYear">No Metadata Documentation available.</param>
     /// <param name="endMonth">No Metadata Documentation available.</param>
     /// <param name="endYear">No Metadata Documentation available.</param>
     public ObjectResult<TotalSalesTeam> IR_SM_TotalSalesTeam(global::System.String optBrandCodes, Nullable<global::System.Int32> startMonth, Nullable<global::System.Int32> startYear, Nullable<global::System.Int32> endMonth, Nullable<global::System.Int32> endYear)
     {
         ObjectParameter optBrandCodesParameter;
         if (optBrandCodes != null)
         {
             optBrandCodesParameter = new ObjectParameter("optBrandCodes", optBrandCodes);
         }
         else
         {
             optBrandCodesParameter = new ObjectParameter("optBrandCodes", typeof(global::System.String));
         }
 
         ObjectParameter startMonthParameter;
         if (startMonth.HasValue)
         {
             startMonthParameter = new ObjectParameter("startMonth", startMonth);
         }
         else
         {
             startMonthParameter = new ObjectParameter("startMonth", typeof(global::System.Int32));
         }
 
         ObjectParameter startYearParameter;
         if (startYear.HasValue)
         {
             startYearParameter = new ObjectParameter("startYear", startYear);
         }
         else
         {
             startYearParameter = new ObjectParameter("startYear", typeof(global::System.Int32));
         }
 
         ObjectParameter endMonthParameter;
         if (endMonth.HasValue)
         {
             endMonthParameter = new ObjectParameter("endMonth", endMonth);
         }
         else
         {
             endMonthParameter = new ObjectParameter("endMonth", typeof(global::System.Int32));
         }
 
         ObjectParameter endYearParameter;
         if (endYear.HasValue)
         {
             endYearParameter = new ObjectParameter("endYear", endYear);
         }
         else
         {
             endYearParameter = new ObjectParameter("endYear", typeof(global::System.Int32));
         }
 
         return base.ExecuteFunction<TotalSalesTeam>("IR_SM_TotalSalesTeam", optBrandCodesParameter, startMonthParameter, startYearParameter, endMonthParameter, endYearParameter);
     }
示例#31
0
        public ReturnValue create([FromBody]RequestValue value)
        {
            if (value == null)
            {
                throw new HttpResponseException(HttpStatusCode.BadRequest);
            }

            SuggestRegister suggestRegister = JsonConvert.DeserializeObject<SuggestRegister>(Convert.ToString(value.data));

            try
            {
                ObjectParameter userSN = new ObjectParameter("UserSN", typeof(long));
                ObjectParameter gUID = new ObjectParameter("GUID", typeof(string));
                ObjectParameter hashPhone = new ObjectParameter("HashPhone", typeof(string));
                ObjectParameter deviceID = new ObjectParameter("DeviceID", typeof(string));
                ObjectParameter pushKey = new ObjectParameter("PushKey", typeof(string));
                ObjectParameter createDate = new ObjectParameter("CreateDate", typeof(DateTime));
                ObjectParameter updateDate = new ObjectParameter("UpdateDate", typeof(DateTime));

                // User SN 정보 조회
                entity.UserGetInfoByToken(value.token, userSN, gUID, hashPhone, deviceID, pushKey, createDate, updateDate);

                // 제안등록
                ObjectParameter suggestSN = new ObjectParameter("SuggestSN", typeof(long));
                entity.SuggestCreate(suggestSN, (long)userSN.Value, (string)hashPhone.Value, suggestRegister.categorysn, suggestRegister.itemsn);

                // 비공개 대상 등록
                foreach (string hashphone in suggestRegister.privateuser)
                {
                    entity.PrivateUserCreate((long)suggestSN.Value, hashphone);
                }

                returnValue.error = 0;
                returnValue.message = "ok";

                long suggestsn = (long)suggestSN.Value;
                returnValue.data = new
                {
                    suggestsn
                };
            }
            catch (InvalidCastException)
            {
                returnValue.error = 100;
                returnValue.message = "USER_NOT_FOUND";
            }
            catch (Exception ex)
            {
                entity.ErrorLogCreate(HttpRequestMessageHelper.GetClientIpAddress(Request), Request.RequestUri.AbsoluteUri, ex.Source, ex.TargetSite.Name, ex.Message, ex.StackTrace, JsonConvert.SerializeObject(value));
                throw new HttpResponseException(HttpStatusCode.InternalServerError);
            }

            return returnValue;
        }
示例#32
0
 public static int GetUserId(string userName)
 {
     int userId;
     using (FmEntities context = new FmEntities())
     {
         var userIdParam = new ObjectParameter("UserID", typeof(int));
         var result = context.spGetUserID(userName, userIdParam);
         userId = (int)userIdParam.Value;
     }
     return userId;
 }
示例#33
0
        public override OperationObject execute(SmartSoftwareBazaEntities entities)
        {
            System.Data.Objects.ObjectParameter rez = new System.Data.Objects.ObjectParameter("ukupnoZaradjeno", System.Type.GetType("System.Double"));

            entities.IstorijaKupovineUkupnoZaradjeno(rez);

            double ukupnoZaradjeno = Convert.ToDouble(rez.Value);

            Object[] niz = new Object[1];
            niz[0] = ukupnoZaradjeno;
            OperationObject opObj = new OperationObject();

            opObj.Niz     = niz;
            opObj.Success = true;
            return(opObj);
        }
示例#34
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Global Gl = new Global();

            Gl.SetCompetitionCode("");
            AthleticsEntities1 AthlEnt = new AthleticsEntities1();

            string CurrentUserID;
            string CurrCompCode;
            Int32  AccessLevelInt;
            Int32  CanEnterScores;

            if (Session["CurrentUserName"] != null)
            {
                CurrentUserID = Session["CurrentUserName"].ToString();
            }
            else
            {
                CurrentUserID = "";
            }
            CurrCompCode = "";
            System.Data.Objects.ObjectParameter CurrAccessLevel    = new System.Data.Objects.ObjectParameter("CurrentAccessLevel", "0");
            System.Data.Objects.ObjectParameter CurrCanEnterScores = new System.Data.Objects.ObjectParameter("CanEnterScores", "0");

            AthlEnt.GetAccessLevel(CurrentUserID, CurrCompCode, CurrAccessLevel, CurrCanEnterScores);
            AccessLevelInt = Convert.ToInt32(CurrAccessLevel.Value);
            CanEnterScores = Convert.ToInt32(CurrCanEnterScores.Value);

            //--AccessLevel
            //--
            //--0 = Queries Only
            //--1 = Club Representative
            //--2 = Administrator
            //--3 = Selected Competition Only
            //
            //--    CanEnterScores 0 = No, 1 = Yes

            if ((AccessLevelInt == 1) || (AccessLevelInt == 2))
            {
                NewCompetition.Visible = true;
            }
            else
            {
                NewCompetition.Visible = false;
            }
        }
示例#35
0
        public override OperationObject execute(SmartSoftwareBazaEntities entities)
        {
            System.Data.Objects.ObjectParameter rez = new System.Data.Objects.ObjectParameter("ukupnoZaradjeno", System.Type.GetType("System.Double"));

            if (this.IstorijaKupovineDataSelect != null)
            {
                entities.IstorijaKupovineZaradjenoDanas(this.IstorijaKupovineDataSelect.datumDanas, this.IstorijaKupovineDataSelect.datumSutra, rez);
            }

            double ukupnoZaradjeno = Convert.ToDouble(rez.Value);

            Object[] niz = new Object[1];
            niz[0] = ukupnoZaradjeno;
            OperationObject opObj = new OperationObject();

            opObj.Niz     = niz;
            opObj.Success = true;
            return(opObj);
        }
        public override OperationObject execute(SmartSoftwareBazaEntities entities)
        {
            System.Data.Objects.ObjectParameter idRezervacijePar = new System.Data.Objects.ObjectParameter("idRezervacije", System.Type.GetType("System.Int32"));

            entities.DodajRezervacije(DataSelectOpremaRezervacija.imeNaRezervacija, DataSelectOpremaRezervacija.datum_rezervacije, DataSelectOpremaRezervacija.datum_isteka_rezervacije, idRezervacijePar);

            int id = Convert.ToInt32(idRezervacijePar.Value);


            foreach (var rezervacijaItem in DataSelectRezervacijaNiz)
            {
                entities.InsertRezervacijeOprema(rezervacijaItem.id_oprema, id, rezervacijaItem.kolicina_rezervisane_opreme);
            }

            OperationObject opObj = new OperationObject();

            opObj.Success = true;
            return(opObj);
        }
示例#37
0
        public override OperationObject execute(SmartSoftwareBazaEntities entities)
        {
            System.Data.Objects.ObjectParameter rez = new System.Data.Objects.ObjectParameter("brojProdateOpremeDanas", System.Type.GetType("System.Int32"));


            if (this.IstorijaKupovineDataSelect != null)
            {
                entities.IstorijaKupovineUkupnoProdanoOpremeDanas(this.IstorijaKupovineDataSelect.datumDanas, this.IstorijaKupovineDataSelect.datumSutra, rez);
            }

            int prodatoOpremeDanas = rez.Value == null ?  0 : Convert.ToInt32(rez.Value);

            Object[] niz = new Object[1];
            niz[0] = prodatoOpremeDanas;
            OperationObject opObj = new OperationObject();

            opObj.Niz     = niz;
            opObj.Success = true;
            return(opObj);
        }
        public ServiceResponse Save(OfflineBookViewModel models)
        {
            try
            {
                int    confirmTicketstatus = 24;
                var    model     = models;
                long   masterpnr = 0;
                string bookingref;
                using (var ts = new TransactionScope(TransactionScopeOption.Required))
                {
                    ATLTravelPortal.Areas.Airline.Repository.GeneralProvider generalProvider = new GeneralProvider();
                    var  agent = generalProvider.GetAgents(model.UserDetail.AgentId);
                    bool isByPassDealByBranch      = generalProvider.GetBranchSettings(agent.BranchOfficeId, 12);
                    bool isByPassDealByDistrubutor = generalProvider.GetDistributorSettings(agent.DistributorId, 13);

                    System.Data.Objects.ObjectParameter BranchaDeal     = new System.Data.Objects.ObjectParameter("Amount", 0);
                    System.Data.Objects.ObjectParameter DistributorDeal = new System.Data.Objects.ObjectParameter("Amount", 0);

                    var    currency        = generalProvider.GetCurrencyByCode("NPR");
                    double totalFareAmount = models.PNRDetails[0].PassengerDetail[0].FareDetail.SellingBaseFare + models.PNRDetails[0].PassengerDetail[0].FareDetail.SellingFSC - models.PNRDetails[0].PassengerDetail[0].FareDetail.DiscountAmount;

                    var branchDealAmount = _entity.Air_GetBranchDeal
                                               (agent.DistributorId,
                                               model.PNRDetails[0].SegmentDetail.FirstOrDefault().AirlineId, model.PNRDetails[0].SegmentDetail.FirstOrDefault().DepartCityId,
                                               model.PNRDetails[0].SegmentDetail.FirstOrDefault().ArrivalCityId, false, totalFareAmount, currency.CurrencyId, model.PNRDetails[0].SegmentDetail.FirstOrDefault().BIC, BranchaDeal);


                    var distributorDealAmount = _entity.Air_GetBranchDeal
                                                    (agent.AgentId,
                                                    model.PNRDetails[0].SegmentDetail.FirstOrDefault().AirlineId, model.PNRDetails[0].SegmentDetail.FirstOrDefault().DepartCityId,
                                                    model.PNRDetails[0].SegmentDetail.FirstOrDefault().ArrivalCityId, false, totalFareAmount + (double)BranchaDeal.Value + branchDealAmount, currency.CurrencyId, model.PNRDetails[0].SegmentDetail.FirstOrDefault().BIC, DistributorDeal);



                    var mpnrDetail = new TBO_MasterPNRs
                    {
                        SessionId         = model.UserDetail.SessionId.ToString(),
                        AgentId           = model.UserDetail.AgentId,
                        ServiceProviderId = 5,
                        Prefix            = model.PNRDetails[0].PassengerDetail[0].Prefix.ToString(),
                        FirstName         = model.PNRDetails[0].PassengerDetail[0].FirstName.ToUpper(),
                        MiddleName        = model.PNRDetails[0].PassengerDetail[0].MiddleName,
                        LastName          = model.PNRDetails[0].PassengerDetail[0].LastName.ToUpper(),
                        TicketStatusId    = confirmTicketstatus,
                        Email             = "*****@*****.**",
                        Phone             = model.PNRDetails[0].PassengerDetail[0].Phone,
                        Address           = "104 Level 1 The Chamber, Mumbai",
                        CreatedBy         = model.UserDetail.AppUserId,
                        CreatedDate       = DateTime.UtcNow,
                        IssuedDate        = DateTime.UtcNow,
                        DispatchedDate    = null,
                        //  BookingReference = "AH" + RandomGenerator.GenerateRandomAlphanumeric()
                        isBranchByPassDeal      = isByPassDealByBranch,
                        isDistributorByPassDeal = isByPassDealByDistrubutor
                    };

                    _entity.AddToTBO_MasterPNRs(mpnrDetail);
                    _entity.SaveChanges();

                    mpnrDetail.BookingReference = "AH" + RandomGenerator.GenerateRandomAlphanumeric() + mpnrDetail.MPNRId;
                    _entity.ApplyCurrentValues(mpnrDetail.EntityKey.EntitySetName, mpnrDetail);
                    _entity.SaveChanges();


                    masterpnr  = mpnrDetail.MPNRId;
                    bookingref = mpnrDetail.BookingReference;

                    foreach (var pnrData in model.PNRDetails)
                    {
                        var pnrDetail = new TBO_PNRs
                        {
                            MPNRId         = mpnrDetail.MPNRId,
                            BookingId      = 0,
                            TicketStatusId = confirmTicketstatus,
                            RecLoc         = pnrData.PNR.ToUpper(),
                            // BookingSource = pnrData.BookingSource,
                        };

                        _entity.AddToTBO_PNRs(pnrDetail);
                        _entity.SaveChanges();

                        var sectorDetail = new TBO_PNRsectors
                        {
                            MPNRId            = mpnrDetail.MPNRId,
                            PNRId             = pnrDetail.PNRId,
                            PlatingCarrierId  = pnrData.SegmentDetail.FirstOrDefault().AirlineId,
                            DepartCityId      = pnrData.SegmentDetail.FirstOrDefault().DepartCityId,
                            DepartDate        = pnrData.SegmentDetail.FirstOrDefault().DepartDate.Value,
                            DepartTime        = pnrData.SegmentDetail.FirstOrDefault().DepartTime.Value,
                            DestinationCityId = pnrData.SegmentDetail.Last().ArrivalCityId,
                            ArriveDate        = pnrData.SegmentDetail.LastOrDefault().ArrivalDate.Value,
                            ArriveTime        = pnrData.SegmentDetail.FirstOrDefault().ArrivalTime.Value,
                            StartTerminal     = pnrData.SegmentDetail.FirstOrDefault().StartTerminal,
                            EndTerminal       = pnrData.SegmentDetail.LastOrDefault().EndTerminal,
                        };
                        _entity.AddToTBO_PNRsectors(sectorDetail);
                        _entity.SaveChanges();

                        foreach (var seg in pnrData.SegmentDetail)
                        {
                            var segmentDetail = new TBO_PNRsegments
                            {
                                MPNRId           = mpnrDetail.MPNRId,
                                PNRId            = pnrDetail.PNRId,
                                SectorId         = sectorDetail.SectorId,
                                AirlineId        = seg.AirlineId,
                                FlightNumber     = seg.FlightNumber,
                                DepartCityId     = seg.DepartCityId,
                                DepartDate       = seg.DepartDate.Value,
                                DepartTime       = seg.DepartTime.Value,
                                ArrivalCityId    = seg.ArrivalCityId,
                                ArrivalDate      = seg.ArrivalDate.Value,
                                ArrivalTime      = seg.ArrivalTime.Value,
                                BIC              = seg.BIC,
                                StartTerminal    = seg.StartTerminal,
                                EndTerminal      = seg.EndTerminal,
                                AirlineRefNumber = seg.AirlineRefNumber.ToUpper(),
                                VndRemarks       = seg.VndRemarks,
                                FlightDuration   =
                                    String.IsNullOrEmpty(seg.Duration)
                                        ? (seg.FlightDuration.Hours.ToString() + ":" +
                                           seg.FlightDuration.Minutes.ToString())
                                        : seg.Duration,
                                Baggage   = Baggage.No.ToString(),
                                FareBasis = null,
                                FlightKey = null,
                                NVB       = null,
                                NVA       = null
                            };

                            _entity.AddToTBO_PNRsegments(segmentDetail);
                            _entity.SaveChanges();
                        }

                        foreach (var paxData in pnrData.PassengerDetail)
                        {
                            var paxDetail = new TBO_Passengers();
                            paxDetail.PNRId      = pnrDetail.PNRId;
                            paxDetail.MPNRId     = mpnrDetail.MPNRId;
                            paxDetail.Prefix     = paxData.Prefix.ToString();
                            paxDetail.FirstName  = paxData.FirstName.ToUpper();
                            paxDetail.MiddleName = paxData.MiddleName;
                            paxDetail.LastName   = paxData.LastName.ToUpper();
                            paxDetail.Gender     = "N/A";
                            if (!string.IsNullOrEmpty(paxData.DOB.Trim()))
                            {
                                paxDetail.DOB = Convert.ToDateTime(paxData.DOB);
                            }
                            paxDetail.Nationality     = paxData.NationalityId;
                            paxDetail.Country         = paxData.PassportIssuedCountryId;
                            paxDetail.PassportNumber  = paxData.PassportNumber;
                            paxDetail.PassportExpDate = paxData.PassportExpDate;

                            paxDetail.Phone           = paxData.Phone;
                            paxDetail.Email           = "*****@*****.**";
                            paxDetail.PassengerTypeId = (int)paxData.PaxType;
                            paxDetail.FFAirline       = paxData.FrequentFlyerAirlineCode != null ? (int?)_entity.Airlines.Where(
                                x => x.AirlineCode == paxData.FrequentFlyerAirlineCode).
                                                        Select(y => y.AirlineId).FirstOrDefault()
                                    : null;
                            paxDetail.FFNumber       = paxData.FrequentFlyerNo != "" ? paxData.FrequentFlyerNo : null;
                            paxDetail.DOCA           = "2nd Floor, Buddha Complex, Swayambhu, Kathmandu, Nepal";
                            paxDetail.SSR            = paxData.Meal != null ? paxData.Meal.Code : null;
                            paxDetail.SSRDescription =
                                paxData.Meal != null
                                    ? paxData.Meal.Description = paxData.Meal.Code
                                    : null;
                            paxDetail.SeatName        = paxData.Seat != null ? paxData.Seat.Code : null;
                            paxDetail.SeatDescription =
                                paxData.Seat != null ? paxData.Seat.Description : null;
                            paxDetail.UpdatedBy   = 1;
                            paxDetail.UpdatedDate = DateTime.UtcNow;

                            _entity.AddToTBO_Passengers(paxDetail);
                            _entity.SaveChanges();

                            var fareDetail = new TBO_PNRTickets
                            {
                                PNRId            = pnrDetail.PNRId,
                                MPNRId           = mpnrDetail.MPNRId,
                                PassengerId      = paxDetail.PassengerId,
                                TicketNumber     = paxData.FareDetail.TicketNumber.ToUpper(),
                                AdditionalTxnFee = paxData.FareDetail.SellingAdditionalTxnFee,
                                AirlineTransFee  = paxData.FareDetail.AirlineTransFee,
                                BaseFare         = paxData.FareDetail.SellingBaseFare,
                                Tax               = paxData.FareDetail.SellingTax,
                                OtherCharges      = paxData.FareDetail.SellingOtherCharges,
                                ServiceTax        = paxData.FareDetail.SellingServiceTax,
                                MarkupAmount      = paxData.FareDetail.MarkupAmount,
                                CommissionAmount  = 0,
                                DiscountAmount    = paxData.FareDetail.CommissionAmount,
                                Currency          = "NPR",
                                FSC               = paxData.FareDetail.SellingFSC,
                                TicketStatusId    = confirmTicketstatus,
                                TktId             = paxData.FareDetail.TicketId,
                                TourCode          = paxData.FareDetail.TourCode,
                                ValidatingAirline = paxData.FareDetail.ValidatingAirline,
                                Remarks           = paxData.FareDetail.Remarks,
                                CorporateCode     = paxData.FareDetail.CorporateCode,
                                EndorseMent       = paxData.FareDetail.Endorsement,
                                //value with Rounding
                                SellingAdditionalTxnFee =
                                    Math.Ceiling(paxData.FareDetail.SellingAdditionalTxnFee),
                                SellingAirlineTransFee =
                                    Math.Ceiling(paxData.FareDetail.SellingAirlineTransFee),
                                SellingBaseFare     = Math.Ceiling(paxData.FareDetail.SellingBaseFare),
                                SellingTax          = Math.Ceiling(paxData.FareDetail.SellingTax),
                                SellingOtherCharges =
                                    Math.Ceiling(paxData.FareDetail.SellingOtherCharges),
                                SellingServiceTax =
                                    Math.Ceiling(paxData.FareDetail.SellingServiceTax),
                                SellingFSC            = Math.Ceiling(paxData.FareDetail.SellingFSC),
                                BranchDealAmount      = (double)BranchaDeal.Value,
                                DistrubutorDealAmount = (double)DistributorDeal.Value
                            };

                            _entity.AddToTBO_PNRTickets(fareDetail);
                            _entity.SaveChanges();
                        }
                    }

                    ts.Complete();
                }
                IssueTicket(masterpnr, model.UserDetail.AppUserId);

                _entity.SaveChanges();
                _entity.Air_UpdateTicketStatusId(masterpnr, "ISSUEPNR", false, model.UserDetail.AppUserId);

                _response = new ServiceResponse("Record successfully created!! \n Your Booking Reference No is :" + bookingref, MessageType.Success, true, "Save");


                return(_response);
            }
            catch (Exception ex)
            {
                _response = new ServiceResponse(ex.Message, MessageType.Exception, false, "Save");
                return(_response);
            }
        }
示例#39
0
        protected void Page_Load(object sender, EventArgs e)
        {
            CopyEventsFromPrevComp.Visible = false;  //DEBUG

            if (Session["CurrentUserName"] == null)
            {
                CurrentUserID = "";
            }
            else
            {
                CurrentUserID = Session["CurrentUserName"].ToString();
            }
            CurrCompCode = gl.GetCompetitionCode();
            string CompCodeText = Request.QueryString.Get("Code");

            NewCompetition = false;
            if ((CompCodeText != "") && (CompCodeText != null))
            {
                gl.SetCompetitionCode(CompCodeText);
                CurrCompCode = CompCodeText;
                if (CurrCompCode == "NYTT")
                {
                    NewCompetition = true;
                }
            }

            System.Data.Objects.ObjectParameter CurrAccessLevel    = new System.Data.Objects.ObjectParameter("CurrentAccessLevel", "0");
            System.Data.Objects.ObjectParameter CurrCanEnterScores = new System.Data.Objects.ObjectParameter("CanEnterScores", "0");

            AthlEnt.GetAccessLevel(CurrentUserID, CurrCompCode, CurrAccessLevel, CurrCanEnterScores);
            AccessLevelint = Convert.ToInt32(CurrAccessLevel.Value);
            CanEnterScores = Convert.ToInt32(CurrCanEnterScores.Value);

            //--AccessLevel
            //--
            //--0 = Queries Only
            //--1 = Club Representative
            //--2 = Administrator
            //--3 = Selected Competition Only
            //
            //--    CanEnterScores 0 = No, 1 = Yes

            if (IsPostBack)
            {
                Message.Text = "";
                DateTime DateValue;
                string   ValinnV   = Convert.ToString(Vellir.SelectedValue);
                string   InnslDags = Dagsetning.Text;
                if (ValinnV != GamliVollur.Text)
                {
                    MotADO ado = new MotADO();

                    ado.GeymaVallarupplys(ValinnV);
                    Stadur.Text     = ado.ValinnStadur;
                    UtiEdaInni.Text = ado.ValidUtiInni;

                    if (UtiEdaInni.Text == "0")
                    {
                        UtiEdaInni.Text = "Utanhúss";
                    }
                    if (UtiEdaInni.Text == "1")
                    {
                        UtiEdaInni.Text = "Innanhúss";
                    }
                    if (UtiEdaInni.Text == "2")
                    {
                        UtiEdaInni.Text = "Utan- eða Innanhúss";
                    }


                    GamliVollur.Text = ValinnV.ToString();
                }


                if (InnslDags != GamlaDags.Text)
                {
                    string[] separators = { ".", "/", " " };
                    string[] words      = InnslDags.Split(separators, StringSplitOptions.RemoveEmptyEntries);
                    if (words[0].Length == 1)
                    {
                        words[0] = "0" + words[0];
                    }
                    if (words[1].Length == 1)
                    {
                        words[1] = "0" + words[1];
                    }
                    if (words[2].Length == 1)
                    {
                        words[2] = "200" + words[2];
                    }
                    else if (words[2].Length == 2)
                    {
                        words[2] = "20" + words[2];
                    }

                    InnslDags = words[0] + "." + words[1] + "." + words[2];
                    // if (words[0].Length >
                    if (InnslDags.Length == 8)
                    {
                        InnslDags = InnslDags.Substring(0, 2) + "." + InnslDags.Substring(2, 2) + "." + InnslDags.Substring(4, 4);
                        HeitiMots.Focus();
                    }
                    else
                    if (InnslDags.Length == 7)
                    {
                        InnslDags = "0" + InnslDags.Substring(0, 1) + "." + InnslDags.Substring(1, 2) + "." + InnslDags.Substring(3, 4);
                    }
                    else
                    if (InnslDags.Length == 6)
                    {
                        InnslDags = InnslDags.Substring(0, 2) + "." + InnslDags.Substring(2, 2) + ".20" + InnslDags.Substring(4, 2);
                    }
                    else
                    if (InnslDags.Length == 5)
                    {
                        InnslDags = "0" + InnslDags.Substring(0, 1) + "." + InnslDags.Substring(1, 2) + ".20" + InnslDags.Substring(3, 2);
                    }
                    else
                    if (InnslDags.Length == 4)
                    {
                        InnslDags = InnslDags.Substring(0, 2) + "." + InnslDags.Substring(2, 2) + "." + DateTime.Now.ToString("yyyy");
                    }
                    else
                    if (InnslDags.Length == 3)
                    {
                        InnslDags = "0" + InnslDags.Substring(0, 1) + "." + InnslDags.Substring(1, 2) + "." + DateTime.Now.ToString("yyyy");
                    }
                    else
                    if (InnslDags.Length == 2)
                    {
                        InnslDags = InnslDags + "." + DateTime.Now.ToString("MM.yyyy");
                    }
                    else
                    if (InnslDags.Length == 1)
                    {
                        InnslDags = "0" + InnslDags + "." + DateTime.Now.ToString("MM.yyyy");
                    }

                    if (!DateTime.TryParse(InnslDags, out DateValue))
                    {
                        Message.Text = "Dagsetning " + InnslDags + " er ekki í lagi.";
                    }
                    else
                    {
                        InnslDags = DateValue.ToShortDateString();
                        NoOfDays  = 1;
                    }
                    Dagsetning.Text = InnslDags;
                    GamlaDags.Text  = InnslDags;
                    HeitiMots.Focus();
                }
                if (CompetitionDate2.Text != "")
                {
                    if (!DateTime.TryParse(CompetitionDate2.Text, out DateValue))
                    {
                        Message.Text = "Dagsetning 2 " + CompetitionDate2.Text + " er ekki í lagi.";
                    }
                    else
                    {
                        AthlComp.Date2 = DateValue;
                        NoOfDays       = 2;
                    }
                }
                else
                {
                    AthlComp.Date2        = Convert.ToDateTime("1753-01-01 00:00:00.000");
                    CompetitionDate3.Text = "";
                    CompetitionDate4.Text = "";
                }
                if (CompetitionDate3.Text != "")
                {
                    if (!DateTime.TryParse(CompetitionDate3.Text, out DateValue))
                    {
                        Message.Text = "Dagsetning 3 " + CompetitionDate3.Text + " er ekki í lagi.";
                    }
                    else
                    {
                        AthlComp.Date3 = DateValue;
                        NoOfDays       = 3;
                    }
                }
                else
                {
                    AthlComp.Date3        = Convert.ToDateTime("1753-01-01 00:00:00.000");
                    CompetitionDate4.Text = "";
                }
                if (CompetitionDate4.Text != "")
                {
                    if (!DateTime.TryParse(CompetitionDate4.Text, out DateValue))
                    {
                        Message.Text = "Dagsetning 4 " + CompetitionDate4.Text + " er ekki í lagi.";
                    }
                    else
                    {
                        AthlComp.dagsetning4 = DateValue;
                        NoOfDays             = 4;
                    }
                }
                else
                {
                    AthlComp.dagsetning4 = Convert.ToDateTime("1753-01-01 00:00:00.000");
                }
                AthlComp.tegundstigakeppni = gl.TryConvertStringToInt32(TegundStigakeppni.SelectedValue.ToString());
            }
            else  //Not Postback - Page Load
            {
                //AccessLevelText = Session["CurrentAccessLevel"].ToString();
                //if ((AccessLevelText == "0") || (AccessLevelText == "") || (AccessLevelText == null))
                if ((AccessLevelint != 1) && (AccessLevelint != 2)) //Access is NOT Club Repesentative and NOT Administrator, Competition Creator or CompetitionUpdateAccess = Administrator
                {
                    //NewCompetitorButton.Visible = false;
                    //YourCompetitors.Visible = false;
                    //AddNewCompetitorsBtn.Visible = false;
                    SetupEvents.Visible = false;
                    //  Vista.Visible = false;
                    HeitiMots.ReadOnly         = true;
                    EnsktHeiti.ReadOnly        = true;
                    Dagsetning.ReadOnly        = true;
                    Vellir.Enabled             = false;
                    Stadur.ReadOnly            = true;
                    UtiEdaInni.ReadOnly        = true;
                    Motshaldari.ReadOnly       = true;
                    Yfirdomari.ReadOnly        = true;
                    SkranGjaldPrGrein.ReadOnly = true;
                    SkranGjPrBodhl.ReadOnly    = true;
                    SkranGjPrGreinU18.ReadOnly = true;
                    SkranGjPrBodhlU18.ReadOnly = true;
                    CompStatus.Enabled         = false;
                    TegundStigakeppni.Enabled  = false;
                    ReiknaIAAFStig.Enabled     = false;
                    ReiknaUnglStig.Enabled     = false;
                    Message.Text  = "Þú hefur ekki leyfi til að breyta uppsetningu mótsins";
                    Vista.Visible = false;
                }
                else
                {
                    Message.Text = "";
                }

                if ((gl.GetCompetitionCode() != "") && (gl.GetCompetitionCode() != "NYTT") && (NewCompetition == false))
                {
                    {
                        //SetupEvents.Visible = true;

                        CompetitionCode.Text = gl.GetCompetitionCode();
                        //CompCode2.Text = CompetitionCode.Text;
                        //CompCode4.Text = CompetitionCode.Text;
                        //CompCode7.Text = CompetitionCode.Text;

                        AthleticCompetitionCRUD AthlCompCRUD = new AthleticCompetitionCRUD();
                        AthlComp        = AthlCompCRUD.GetCompetitionRec(gl.GetCompetitionCode());
                        HeitiMots.Text  = AthlComp.Name;
                        EnsktHeiti.Text = AthlComp.ensktheitiamoti;
                        Dagsetning.Text = AthlComp.Date.ToShortDateString();
                        gl.SetGlobalValue("CompetitionName", AthlComp.Name);
                        gl.SetGlobalValue("EnglishCompetitionName", AthlComp.ensktheitiamoti);
                        UtiEdaInni.Text = AthlComp.OutdoorsOrIndoors.ToString();
                        gl.SetOutdoorsOrIndoors(UtiEdaInni.Text);

                        Int16 VenueIndex = 0;
                        System.Data.Objects.ObjectParameter Indx = new System.Data.Objects.ObjectParameter("Indx", typeof(Int32));

                        AthlEnt.IndexCompetitionVenue(AthlComp.keppnisvollur, Indx);
                        if (Int16.TryParse(Indx.Value.ToString(), out VenueIndex) == false)
                        {
                            VenueIndex = 0;
                        }
                        //VenueIndex = ReturnIndexOfVenue(AthlComp.keppnisvollur);

                        if (VenueIndex > 0)
                        {
                            Vellir.SelectedIndex = VenueIndex;
                        }

                        Stadur.Text = AthlComp.Location;
                        if (UtiEdaInni.Text == "0")
                        {
                            UtiEdaInni.Text = "Utanhúss";
                        }
                        if (UtiEdaInni.Text == "1")
                        {
                            UtiEdaInni.Text = "Innanhúss";
                        }

                        CompStatus.SelectedIndex        = AthlComp.Staða_móts;
                        TegundStigakeppni.SelectedValue = AthlComp.tegundstigakeppni.ToString();
                        Motshaldari.Text       = AthlComp.Organizer;
                        Yfirdomari.Text        = AthlComp.Judge;
                        Motsstjori.Text        = AthlComp.Director;
                        SkranGjaldPrGrein.Text = string.Format("{0:N2}", AthlComp.skraningargjaldprgrein);     //AthlComp.skraningargjaldprgrein.ToString();
                        SkranGjPrBodhl.Text    = string.Format("{0:N2}", AthlComp.Skráningargjld_f__boðhlaup); //.ToString();
                        SkranGjPrGreinU18.Text = string.Format("{0:N2}", AthlComp.Skráningargj__yngri_en_18_ára);
                        SkranGjPrBodhlU18.Text = string.Format("{0:N2}", AthlComp.Skráningargj__f_boðhl_y_18_ára);
                        //if (AthlComp.Reikna_unglingastig == 1)
                        //{
                        //    ReiknaUnglStig.Text = "Já";
                        //}
                        //else
                        //{
                        //    ReiknaUnglStig.Text = "Nei";
                        //}
                        ReiknaUnglStig.SelectedValue = AthlComp.Reikna_unglingastig.ToString();
                        //if (AthlComp.Reikna_IAAF_stig == 1)
                        //{
                        //    ReiknaIAAFStig.Text = "Já";
                        //}
                        //else
                        //{
                        //    ReiknaIAAFStig.Text = "Nei";
                        //}
                        ReiknaIAAFStig.SelectedValue = AthlComp.Reikna_IAAF_stig.ToString();

                        gl.SetCompetitionCode(AthlComp.Code);
                        gl.SetCompetitionName(AthlComp.Name);
                        gl.SetCompetionYear(AthlComp.Date.Year);
                        if (AthlComp.keppnisvollur != "")
                        {
                            gl.SetCompetitionVenue(AthlComp.keppnisvollur + ", " + AthlComp.Location);
                        }
                        else
                        {
                            gl.SetCompetitionVenue(AthlComp.Location);
                        }

                        Int32    NoOfDates = 0;
                        ListItem newItem   = new ListItem();
                        newItem       = new ListItem();
                        newItem.Text  = "Allir dagar";
                        newItem.Value = "%";
                        //AthleticsEntities1 AthlEnt = new AthleticsEntities1();
                        var DatesInCompetition = AthlEnt.ReturnCompetitionEventDates(gl.GetCompetitionCode());
                        foreach (var result in DatesInCompetition)
                        {
                            NoOfDates     = NoOfDates + 1;
                            newItem       = new ListItem();
                            newItem.Text  = Convert.ToString(result);       // "Dagur 1"; // Convert.ToString(result.Dags);
                            newItem.Value = Convert.ToString(result) + "%"; // "D1%"; // Convert.ToString(result.Dags) + "%";
                        }
                        if (AthlComp.Date2 > Convert.ToDateTime("1900.01.01"))
                        {
                            CompetitionDate2.Visible = true;
                            CompetitionDate2.Text    = AthlComp.Date2.ToString("dd.MM.yyyy", CultureInfo.InvariantCulture);
                        }
                        if (AthlComp.Date3 > Convert.ToDateTime("1900.01.01"))
                        {
                            CompetitionDate3.Visible = true;
                            CompetitionDate3.Text    = AthlComp.Date3.ToString("dd.MM.yyyy", CultureInfo.InvariantCulture);
                        }
                        if (AthlComp.dagsetning4 > Convert.ToDateTime("1900.01.01"))
                        {
                            CompetitionDate4.Visible = true;
                            CompetitionDate4.Text    = AthlComp.dagsetning4.ToString("dd.MM.yyyy", CultureInfo.InvariantCulture);
                        }
                    }
                    HeitiMots.Focus();
                }
                else
                {
                    string SelNafn;
                    SelNafn                        = gl.GetSelNafn();
                    SetupEvents.Visible            = false;
                    CopyEventsFromPrevComp.Visible = false;
                    UpdateEventSetup.Visible       = false;
                    CompStatus.SelectedIndex       = 1;
                    Vista.Text                     = "Stofna";
                }
            }
        }
示例#40
0
        protected void Button1_Click1(object sender, EventArgs e)
        {
            AthleticsEntities1      AthlEnt = new AthleticsEntities1();
            string                  line;
            AthleticCompetitionCRUD AthlCRUD2 = new AthleticCompetitionCRUD();

            HttpFileCollection File_Collection = Request.Files;
            string             BibNos          = "";
            string             RunnerLanes     = "";
            Global             gl    = new Global();
            string             Times = "";
            Int32  LineNo            = 0;
            Int32  CurrentHeatNo     = 1;
            string ImportedHeatNo    = "";
            string ImportedWind      = "";

            WindReading      = 0;
            EventLineNo.Text = Request.QueryString.Get("EventLineNo");
            AthlEvent        = AthlCRUD2.GetCompetitionEvent(CompCode.Text, Convert.ToInt32(EventLineNo.Text));
            Int32 TrackEventNoForLynx = AthlEvent.Númer_hlaupagreinar_f__Lynx + 1000;

            WindReadingRequired = AthlEvent.krefstvindmaelis;

            foreach (string File_Uploader in File_Collection)
            {
                HttpPostedFile Posted_File         = File_Collection[File_Uploader];
                string         FileNameWithoutPath = "";
                Int32          LastSlashPos        = 0;
                for (int ix = 0; ix < Posted_File.FileName.Length; ix++)
                {
                    if (Posted_File.FileName.Substring(ix, 1) == @"\")
                    {
                        LastSlashPos = ix;
                    }
                }
                if (LastSlashPos > 0)
                {
                    FileNameWithoutPath = Posted_File.FileName.Substring(LastSlashPos + 1);
                }
                else
                {
                    FileNameWithoutPath = Posted_File.FileName;
                }
                if (FileNameWithoutPath.Substring(0, 3) == LifFilePrefix.Text)
                {
                    if (Posted_File.ContentLength > 0)
                    {
                        System.IO.StreamReader file = new System.IO.StreamReader(Posted_File.InputStream);
                        while ((line = file.ReadLine()) != null)
                        {  //Example: 5,0,1,"100M Karla R1 w:-0,1",-1.0,M/S S,,,,100,18:34:25.1698  - Með vindi
                           //Example: 2,2,1,60M S15 R1,,,,,,60,10:01:00.4149                        - Án vinds

                            string[] Fields = line.Split(',');
                            if (LineNo == 0)
                            {
                                string EventNameText = Fields[3]; //Example: "60m p12 R2" or "100M S13 R1/2" or "4X100M S13"
                                string HeatText      = EventNameText.Split(' ').Last();
                                if (HeatText.StartsWith("R"))
                                {
                                    string[] HeatTextArr = HeatText.Split('/');
                                    HeatText      = HeatTextArr[0].Substring(1);
                                    CurrentHeatNo = gl.TryConvertStringToInt32(HeatText);
                                }
                                else
                                {
                                    CurrentHeatNo = 1;
                                }
                                if (WindReadingRequired == 1)
                                {
                                    if (Fields.Length == 12)
                                    {
                                        WindReading = gl.TryConvertStringToDecimal(Fields[5]);
                                    }
                                    else
                                    {
                                        WindReading = gl.TryConvertStringToDecimal(Fields[4]);
                                    }
                                    //WindReading = gl.TryConvertStringToDecimal(Fields[4]);
                                    WindReading = WindReading / 10;
                                }
                                else
                                {
                                    WindReading = 0;
                                }
                            }
                            else
                            {
                                Int32 Rank       = 0;
                                bool  SuccessFul = Int32.TryParse(Fields[0], out Rank);
                                if (SuccessFul)
                                {
                                    BibNos      = BibNos + "," + Fields[1];
                                    Times       = Times + "," + Fields[6];
                                    RunnerLanes = RunnerLanes + "," + Fields[2];
                                }
                                else
                                {
                                    BibNos      = BibNos + "," + Fields[1];
                                    Times       = Times + "," + Fields[0];
                                    RunnerLanes = RunnerLanes + "," + Fields[2];
                                }
                                //6,2,2,60m p12 R2,-1.0,M/S W,,,,60,11:39:33.7908
                                //1,179,4,Finnsson,Birnir Vagn,UFA,8.942,UFA,8.942,,,11:39:33.791,,,,8.942,8.942
                                //2,4,5,Eysteinsson,Dagur,AFTURE,9.266,AFTURE,0.324,,,11:39:33.791,,,,0.324,0.324
                                //3,156,3,Olafsson,Karl Hakon,IR,9.702,IR,0.436,,,11:39:33.791,,,,0.436,0.436
                                //4,142,2,Ingolfsson,Ari,HST,10.242,HST,0.540,,,11:39:33.791,,,,0.540,0.540
                                //DNS,188,6,Sigurdarson,Starkadur,UFA,,UFA,,,,11:39:33.791,,,,,
                                //DNS,125,7,Khorchai,Jens Johnny,HSK-SELFOS,,HSK-SELFOS,,,,11:39:33.791,,,,,
                            }
                            LineNo = LineNo + 1;
                        }
                        file.Close();

                        if (BibNos.Substring(0, 1) == ",")
                        {
                            BibNos      = BibNos.Substring(1);
                            Times       = Times.Substring(1);
                            RunnerLanes = RunnerLanes.Substring(1);
                        }
                        //TextBox1.Text = BibNos;
                        //TextBox2.Text = Times;

                        System.Data.Objects.ObjectParameter MsgOut = new System.Data.Objects.ObjectParameter("MessageOut", typeof(string));
                        AthlEnt.UpdateTimesInTrackEvent(CompCode.Text, Convert.ToInt32(EventLineNo.Text), BibNos, Times, RunnerLanes, CurrentHeatNo, WindReading, MsgOut);
                        if (MsgOut.Value.ToString() == "")
                        {
                            Int32 EventTypeInteger = 1;
                            AthlEnt.UpdateOrderAndPointsByResults(CompCode.Text, Convert.ToInt32(EventLineNo.Text), EventTypeInteger);

                            if ((AthlEvent.thrautargrein == 1) && (AthlEvent.nanaritegundargreining != 7))
                            {
                                AthlEnt.ProcessMultiEventCompetitors(CompCode.Text, Convert.ToInt32(EventLineNo.Text));
                                Int32 LineNoOfMultiEv = 0;
                                System.Data.Objects.ObjectParameter LineNoOfMultiEvParameter = new System.Data.Objects.ObjectParameter("LineNoOfMultiEvent", "0");
                                //AthlEntities.ReturnNoOfHeatsInEvent(CompCode, EventLin, OutNoOfHeats);
                                AthlEnt.ReturnLineNumberOfMultiEvent(CompCode.Text, Convert.ToInt32(EventLineNo.Text), LineNoOfMultiEvParameter);
                                LineNoOfMultiEv = Convert.ToInt32(LineNoOfMultiEvParameter.Value);
                                AthlEnt.UpdateOrderAndPointsByResults(CompCode.Text, LineNoOfMultiEv, 2);
                            }
                            if ((AthlEvent.stigagrein == 1) && (AthlCompetitionRec.tegundstigakeppni == 5))
                            {
                                AthlEnt.CalculatePointsInEvent(CompCode.Text, Convert.ToInt32(EventLineNo.Text));
                            }
                            Response.Redirect("UpdateEventResults.aspx?Event=" + EventLineNo.Text);
                        }
                        else
                        {
                            string msg = MsgOut.Value.ToString();
                            Response.Write("<script>alert('" + msg + "')</script>");
                        }
                    }
                }
                else
                {
                    string msg = string.Format("Þú verður að velja .lif skrá sem byrjar á {0}", LifFilePrefix.Text);
                    Response.Write("<script>alert('" + msg + "')</script>");
                }
            }
        }