Exemplo n.º 1
0
    public static string ObtenerListaAlmacenDestino()
    {
        CConexion ConexionBaseDatos = new CConexion();
        string    respuesta         = ConexionBaseDatos.ConectarBaseDatosSqlServer();
        JObject   oRespuesta        = new JObject();
        CUsuario  Usuario           = new CUsuario();

        Usuario.LlenaObjeto(Convert.ToInt32(HttpContext.Current.Session["IdUsuario"]), ConexionBaseDatos);

        if (respuesta == "Conexion Establecida")
        {
            JObject Modelo = new JObject();
            Modelo.Add("Opciones", CJson.ObtenerListaAlmacenDestino(Convert.ToInt32(HttpContext.Current.Session["IdUsuario"]), ConexionBaseDatos));
            Modelo.Add("ValorDefault", "0");
            Modelo.Add("DescripcionDefault", "Elegir una opción...");
            oRespuesta.Add(new JProperty("Error", 0));
            oRespuesta.Add(new JProperty("Modelo", Modelo));
        }
        else
        {
            oRespuesta.Add(new JProperty("Error", 1));
            oRespuesta.Add(new JProperty("Descripcion", "No hay conexion a Base de Datos"));
        }
        ConexionBaseDatos.CerrarBaseDatosSqlServer();
        return(oRespuesta.ToString());
    }
Exemplo n.º 2
0
    public static string ObtenerFormaEditarCuentaBancaria(int IdCuentaBancaria)
    {
        CConexion ConexionBaseDatos         = new CConexion();
        string    respuesta                 = ConexionBaseDatos.ConectarBaseDatosSqlServer();
        int       puedeEditarCuentaBancaria = 0;
        JObject   oRespuesta                = new JObject();
        JObject   oPermisos                 = new JObject();
        CUsuario  Usuario = new CUsuario();

        if (Usuario.TienePermisos(new string[] { "puedeEditarCuentaBancaria" }, ConexionBaseDatos) == "")
        {
            puedeEditarCuentaBancaria = 1;
        }
        oPermisos.Add("puedeEditarCuentaBancaria", puedeEditarCuentaBancaria);

        if (respuesta == "Conexion Establecida")
        {
            JObject Modelo = new JObject();
            Modelo = CCuentaBancaria.ObtenerCuentaBancaria(Modelo, IdCuentaBancaria, ConexionBaseDatos);
            Modelo.Add("TipoMonedas", CJson.ObtenerJsonTipoMoneda(Convert.ToInt32(Modelo["IdTipoMoneda"].ToString()), ConexionBaseDatos));
            Modelo.Add("TipoBancos", CBanco.ObtenerJsonBanco(Convert.ToInt32(Modelo["IdBanco"].ToString()), ConexionBaseDatos));
            Modelo.Add(new JProperty("Permisos", oPermisos));
            oRespuesta.Add(new JProperty("Error", 0));
            oRespuesta.Add(new JProperty("Modelo", Modelo));
            ConexionBaseDatos.CerrarBaseDatosSqlServer();
        }
        else
        {
            oRespuesta.Add(new JProperty("Error", 1));
            oRespuesta.Add(new JProperty("Descripcion", "No hay conexion a Base de Datos"));
        }
        return(oRespuesta.ToString());
    }
 //分页查询(会议室查询不分权限,按申请时间降序)
 public ActionResult Find(int start, int limit, string idStr)
 {
     IQueryable<MeetingRoomDTO> list = from r in ctx.ReqMeetingRooms
                                    join s in ctx.SignFlows on
                                        new { r.FormNo, IsCurrent = 1 } equals new { s.FormNo, s.IsCurrent }
                                        into t
                                       from x in t.DefaultIfEmpty()
                                       orderby r.PreStartTime descending
                                       select new MeetingRoomDTO
                                    {
                                        FormNo = r.FormNo,
                                        EmpId = r.EmpId,
                                        EmpName = r.Employee.Name,
                                        PreStartTime = r.PreStartTime,
                                        PreEndTime = r.PreEndTime,
                                        RoomName = r.RoomName,
                                        IsNeedProjector = r.IsNeedProjector,
                                        Cause = r.Cause,
                                        StatusId = r.StatusId,
                                        CheckEmpId = x.CheckEmpId
                                    };
     //IQueryable<ReqVehicleMains> list = from r in ctx.ReqVehicleMains select r;
     CJson CJson = new CJson();
     string json = CJson.ToJsonString("totalCount:" + list.Count() + ",data", list.Skip(start).Take(limit).ToList());
     return Content(json);
 }
Exemplo n.º 4
0
        public string GetTransaction(string exAttribute)
        {
            string InputValue = CXmlPara.CreatePara(exAttribute);

            ServiceREF.GeneralLedgerService.CTransaction item = gl_service.GetTransaction(InputValue);
            return(CJson.SerializeObject(item));
        }
Exemplo n.º 5
0
 //分页查询
 public ActionResult Find(int start, int limit, string idStr)
 {
     IQueryable<ExamQuestion> list = from r in ctx.ExamQuestions select r;
     CJson CJson = new CJson();
     string json = CJson.ToJsonString("totalCount:" + list.Count() + ",data", list.Skip(start).Take(limit).ToList());
     return Content(json);
 }
Exemplo n.º 6
0
    public static string ObtenerFormaAgregarEmpresa()
    {
        CConexion ConexionBaseDatos = new CConexion();
        string    respuesta         = ConexionBaseDatos.ConectarBaseDatosSqlServer();
        JObject   oRespuesta        = new JObject();
        JObject   oPermisos         = new JObject();
        CUsuario  Usuario           = new CUsuario();

        Usuario.LlenaObjeto(Convert.ToInt32(HttpContext.Current.Session["IdUsuario"]), ConexionBaseDatos);

        if (respuesta == "Conexion Establecida")
        {
            JObject Modelo = new JObject();
            Modelo.Add("Paises", CJson.ObtenerJsonPaises(ConexionBaseDatos));
            Modelo.Add(new JProperty("Permisos", oPermisos));
            oRespuesta.Add(new JProperty("Error", 0));
            oRespuesta.Add(new JProperty("Modelo", Modelo));
        }
        else
        {
            oRespuesta.Add(new JProperty("Error", 1));
            oRespuesta.Add(new JProperty("Descripcion", "No hay conexion a Base de Datos"));
        }
        ConexionBaseDatos.CerrarBaseDatosSqlServer();
        return(oRespuesta.ToString());
    }
Exemplo n.º 7
0
        public string GetCurrency(string InputValue)
        {
            string strInputValue = CreatePara(InputValue);

            ServiceREF.Cash.CCurrency message = service.GetCurrency(strInputValue);
            return(CJson.SerializeObject(message));
        }
Exemplo n.º 8
0
        public string UpdateCurrency(string InputValue)
        {
            string strInputValue = CreatePara(InputValue);

            ServiceREF.Cash.CApplicationMessage message = service.UpdateCurrency(strInputValue);
            return(CJson.SerializeObject(message));
        }
Exemplo n.º 9
0
 //分页查询
 public ActionResult Find(int start, int limit)
 {
     IQueryable<DocNo> list = from r in ctx.DocNos orderby r.OrderNo descending select r;
     CJson CJson = new CJson();
     string json = CJson.ToJsonString("totalCount:" + list.Count() + ",data", list.Skip(start).Take(limit).ToList());
     return Content(json);
 }
Exemplo n.º 10
0
    public static string ObtenerFormaEditarCuentaContable(int IdCuentaContable)
    {
        CConexion ConexionBaseDatos         = new CConexion();
        string    respuesta                 = ConexionBaseDatos.ConectarBaseDatosSqlServer();
        int       puedeEditarCuentaContable = 0;
        JObject   oRespuesta                = new JObject();
        JObject   oPermisos                 = new JObject();
        CUsuario  Usuario = new CUsuario();

        if (Usuario.TienePermisos(new string[] { "puedeEditarCuentaContable" }, ConexionBaseDatos) == "")
        {
            puedeEditarCuentaContable = 1;
        }
        oPermisos.Add("puedeEditarCuentaContable", puedeEditarCuentaContable);

        if (respuesta == "Conexion Establecida")
        {
            JObject Modelo = new JObject();
            Modelo = CCuentaContable.ObtenerCuentaContable(Modelo, IdCuentaContable, ConexionBaseDatos);
            Modelo.Add("Divisiones", CJson.ObtenerJsonDivision(Convert.ToInt32(Modelo["IdDivision"].ToString()), ConexionBaseDatos));
            Modelo.Add("TipoCompras", CJson.ObtenerJsonTipoCompra(Convert.ToInt32(Modelo["IdTipoCompra"].ToString()), ConexionBaseDatos));
            Modelo.Add("Sucursales", CSucursal.ObtenerSucursales(Convert.ToInt32(Modelo["IdSucursal"].ToString()), ConexionBaseDatos));
            Modelo.Add(new JProperty("Permisos", oPermisos));
            oRespuesta.Add(new JProperty("Error", 0));
            oRespuesta.Add(new JProperty("Modelo", Modelo));
            ConexionBaseDatos.CerrarBaseDatosSqlServer();
        }
        else
        {
            oRespuesta.Add(new JProperty("Error", 1));
            oRespuesta.Add(new JProperty("Descripcion", "No hay conexion a Base de Datos"));
        }
        return(oRespuesta.ToString());
    }
Exemplo n.º 11
0
        public static string GetPersonRole(string exAttribute)
        {
            string InputValue = CXmlPara.CreatePara(exAttribute);

            ServiceREF.CoreService.CPersonRole item = core_service.GetPersonRole(InputValue);
            return(CJson.SerializeObject(item));
        }
Exemplo n.º 12
0
    override public string ToString()
    {
        string json = CJson.Stringify(objeto);

        json = json.Replace(@"\", "");
        return(json);
    }
Exemplo n.º 13
0
        public string GetObjectName(string exAttribute, string inputType)
        {
            string ret        = "";
            string InputValue = CXmlPara.CreatePara(new CPara[] { }, exAttribute);

            switch (inputType)
            {
            case "1":
                ServiceREF.CustomerService.CustomerService cus_service = new ServiceREF.CustomerService.CustomerService();
                ServiceREF.CustomerService.CCustomer       cus         = cus_service.GetCustomer(InputValue);
                ret = CJson.SerializeObject(cus);
                break;

            case "2":
                ServiceREF.VendorService.VendorService ven_service = new ServiceREF.VendorService.VendorService();
                ServiceREF.VendorService.CVendor       ven         = ven_service.GetVendor(InputValue);
                ret = CJson.SerializeObject(ven);
                break;

            case "3":
                ServiceREF.GeneralLedgerService.CEmployee emp = gl_service.GetEmployee(InputValue);
                ret = CJson.SerializeObject(emp);
                break;
            }
            return(ret);
        }
Exemplo n.º 14
0
        public string Update(string InputValue)
        {
            string strInputValue        = CreatePara(InputValue);
            CApplicationMessage message = service.UpdateItem(strInputValue);

            return(CJson.SerializeObject(message));
        }
Exemplo n.º 15
0
    public static string ObtenerFormaConsultarCliente(int pIdCliente)
    {
        CConexion ConexionBaseDatos  = new CConexion();
        string    respuesta          = ConexionBaseDatos.ConectarBaseDatosSqlServer();
        int       puedeEditarCliente = 0;
        JObject   oRespuesta         = new JObject();
        JObject   oPermisos          = new JObject();
        CUsuario  Usuario            = new CUsuario();

        if (Usuario.TienePermisos(new string[] { "puedeEditarCliente" }, ConexionBaseDatos) == "")
        {
            puedeEditarCliente = 1;
        }
        oPermisos.Add("puedeEditarCliente", puedeEditarCliente);

        if (respuesta == "Conexion Establecida")
        {
            JObject Modelo = new JObject();
            Modelo = CJson.ObtenerJsonCliente(Modelo, pIdCliente, ConexionBaseDatos);
            Modelo.Add(new JProperty("Permisos", oPermisos));
            oRespuesta.Add(new JProperty("Error", 0));
            oRespuesta.Add(new JProperty("Modelo", Modelo));
        }
        else
        {
            oRespuesta.Add(new JProperty("Error", 1));
            oRespuesta.Add(new JProperty("Descripcion", "No hay conexion a Base de Datos"));
        }
        ConexionBaseDatos.CerrarBaseDatosSqlServer();
        return(oRespuesta.ToString());
    }
Exemplo n.º 16
0
        public string GetCustomer(string InputValue)
        {
            string    strInputValue = CreatePara(InputValue);
            CCustomer customer      = service.GetCustomer(strInputValue);

            return(CJson.SerializeObject(customer));
        }
Exemplo n.º 17
0
        public string Update(string inputValue)
        {
            string InputValue = CXmlPara.CreatePara(inputValue);

            ServiceREF.InventoryService.CApplicationMessage message = iv_service.UpdateTransfer(InputValue);
            return(CJson.SerializeObject(message));
        }
Exemplo n.º 18
0
        public string UpdateTransaction(string exAttribute)
        {
            string _inputValue = CXmlPara.CreatePara(exAttribute);

            ServiceREF.GeneralLedgerService.CApplicationMessage message = gl_service.UpdateTransaction(_inputValue);
            return(CJson.SerializeObject(message));
        }
Exemplo n.º 19
0
        public string GetCustomerList(string funcPara)
        {
            string       InputValue  = CreatePara(funcPara);
            COutputValue outputValue = new COutputValue();

            CCustomer[] list = service.GetCustomerList(InputValue, ref outputValue);
            return(CJson.SerializeObject(list));
        }
    public static string BuscarNombreProyecto(string pNombreProyecto)
    {
        //Abrir Conexion
        CConexion ConexionBaseDatos = new CConexion();
        string    respuesta         = ConexionBaseDatos.ConectarBaseDatosSqlServer();
        CJson     jsonNumeroFactura = new CJson();

        jsonNumeroFactura.StoredProcedure.CommandText = "sp_ProyectoFacturaProveedor_Consultar_Nombre";
        jsonNumeroFactura.StoredProcedure.Parameters.AddWithValue("@pNombreProyecto", pNombreProyecto);
        return(jsonNumeroFactura.ObtenerJsonString(ConexionBaseDatos));
    }
Exemplo n.º 21
0
        public string GetNextRefNo(string exAttribute)
        {
            string InputValue = CXmlPara.CreatePara(new CPara[] {
                new CPara("RefDate", DateTime.Now.ToString("yyyy-MM-dd"))
            },
                                                    exAttribute
                                                    );
            CRefNo refno = core_service.GetNextRefNo(InputValue);

            return(CJson.SerializeObject(refno));
        }
Exemplo n.º 22
0
    public static string BuscarTraspaso(string pTraspaso)
    {
        //Abrir Conexion
        CConexion ConexionBaseDatos = new CConexion();
        string    respuesta         = ConexionBaseDatos.ConectarBaseDatosSqlServer();
        CJson     jsonTraspaso      = new CJson();

        jsonTraspaso.StoredProcedure.CommandText = "sp_Traspaso_Consultar_FiltroPorTraspaso";
        jsonTraspaso.StoredProcedure.Parameters.AddWithValue("@pTraspaso", pTraspaso);
        return(jsonTraspaso.ObtenerJsonString(ConexionBaseDatos));
    }
Exemplo n.º 23
0
    public static string BuscarIVA(string pIVA)
    {
        //Abrir Conexion
        CConexion ConexionBaseDatos = new CConexion();
        string    respuesta         = ConexionBaseDatos.ConectarBaseDatosSqlServer();
        CJson     jsonIVA           = new CJson();

        jsonIVA.StoredProcedure.CommandText = "sp_IVA_Consultar_FiltroPorIVA";
        jsonIVA.StoredProcedure.Parameters.AddWithValue("@pIVA", pIVA);
        return(jsonIVA.ObtenerJsonString(ConexionBaseDatos));
    }
Exemplo n.º 24
0
    public static string BuscarSubCuentaContable(string pSubCuentaContable)
    {
        //Abrir Conexion
        CConexion ConexionBaseDatos     = new CConexion();
        string    respuesta             = ConexionBaseDatos.ConectarBaseDatosSqlServer();
        CJson     jsonSubCuentaContable = new CJson();

        jsonSubCuentaContable.StoredProcedure.CommandText = "sp_SubCuentaContable_Consultar_FiltroPorSubCuentaContable";
        jsonSubCuentaContable.StoredProcedure.Parameters.AddWithValue("@pSubCuentaContable", pSubCuentaContable);
        return(jsonSubCuentaContable.ObtenerJsonString(ConexionBaseDatos));
    }
Exemplo n.º 25
0
    public static string BuscarUnidadCompraVenta(string pUnidadCompraVenta)
    {
        //Abrir Conexion
        CConexion ConexionBaseDatos     = new CConexion();
        string    respuesta             = ConexionBaseDatos.ConectarBaseDatosSqlServer();
        CJson     jsonUnidadCompraVenta = new CJson();

        jsonUnidadCompraVenta.StoredProcedure.CommandText = "sp_UnidadCompraVenta_Consultar_FiltroPorUnidadCompraVenta";
        jsonUnidadCompraVenta.StoredProcedure.Parameters.AddWithValue("@pUnidadCompraVenta", pUnidadCompraVenta);
        return(jsonUnidadCompraVenta.ObtenerJsonString(ConexionBaseDatos));
    }
Exemplo n.º 26
0
    public static string BuscarGrupoEmpresarial(string pGrupoEmpresarial)
    {
        //Abrir Conexion
        CConexion ConexionBaseDatos    = new CConexion();
        string    respuesta            = ConexionBaseDatos.ConectarBaseDatosSqlServer();
        CJson     jsonGrupoEmpresarial = new CJson();

        jsonGrupoEmpresarial.StoredProcedure.CommandText = "sp_GrupoEmpresarial_Consultar_FiltroPorGrupoEmpresarial";
        jsonGrupoEmpresarial.StoredProcedure.Parameters.AddWithValue("@pGrupoEmpresarial", pGrupoEmpresarial);
        return(jsonGrupoEmpresarial.ObtenerJsonString(ConexionBaseDatos));
    }
Exemplo n.º 27
0
    //Validaciones
    //private static string ValidarTraspaso(CTraspaso pTraspaso, CConexion pConexion)
    //{
    //    string errores = "";
    //    if (pTraspaso.Traspaso == "")
    //    { errores = errores + "<span>*</span> El campo tipo de venta esta vac&iacute;o, favor de capturarlo.<br />"; }

    //    if (errores != "")
    //    { errores = "<p>Favor de completar los siguientes requisitos:</p>" + errores; }

    //    return errores;
    //}

    public static string BuscarProducto(string pProducto)
    {
        //Abrir Conexion
        CConexion ConexionBaseDatos = new CConexion();
        string    respuesta         = ConexionBaseDatos.ConectarBaseDatosSqlServer();

        CJson jsonTipoProyecto = new CJson();

        jsonTipoProyecto.StoredProcedure.CommandText = "sp_Remision_ConsultarProductoNumeroSerie";
        //jsonTipoProyecto.StoredProcedure.Parameters.AddWithValue("@pNumeroSerie", Convert.ToString(pNumeroSerie));
        return(jsonTipoProyecto.ObtenerJsonString(ConexionBaseDatos));
    }
Exemplo n.º 28
0
    public static string BuscarImpresionDocumento(string pImpresionDocumento)
    {
        //Abrir Conexion
        CConexion ConexionBaseDatos = new CConexion();
        string    respuesta         = ConexionBaseDatos.ConectarBaseDatosSqlServer();

        CJson jsonImpresionTemplate = new CJson();

        jsonImpresionTemplate.StoredProcedure.CommandText = "sp_ImpresionDocumento_Consultar_FiltroPorImpresionDocumento";
        jsonImpresionTemplate.StoredProcedure.Parameters.AddWithValue("@pImpresionDocumento", pImpresionDocumento);
        return(jsonImpresionTemplate.ObtenerJsonString(ConexionBaseDatos));
    }
    public static string BuscarNumeroFacturaAsignar(string pNumeroFacturaAsignar)
    {
        //Abrir Conexion
        CConexion ConexionBaseDatos        = new CConexion();
        string    respuesta                = ConexionBaseDatos.ConectarBaseDatosSqlServer();
        CJson     jsonNumeroFacturaAsignar = new CJson();

        jsonNumeroFacturaAsignar.StoredProcedure.CommandText = "sp_FacturaProveedorSinAsignacionPedido_ConsultarFiltrosGrid";
        jsonNumeroFacturaAsignar.StoredProcedure.Parameters.AddWithValue("@Opcion", 1);
        jsonNumeroFacturaAsignar.StoredProcedure.Parameters.AddWithValue("@pNumeroFacturaAsignar", pNumeroFacturaAsignar);
        return(jsonNumeroFacturaAsignar.ObtenerJsonString(ConexionBaseDatos));
    }
Exemplo n.º 30
0
 public string Update(string InputValue, int refType)
 {
     ServiceREF.InventoryService.CApplicationMessage message = new ServiceREF.InventoryService.CApplicationMessage();
     if (refType == 7)
     {
         message = iv_service.UpdateInward(InputValue);
     }
     else if (refType == 8)
     {
         message = iv_service.UpdateOutward(InputValue);
     }
     return(CJson.SerializeObject(message));
 }
Exemplo n.º 31
0
        public string GetNextRefNo(string pRefType)
        {
            pRefType = pRefType == "" ? "4" : pRefType;
            string InputValue = CXmlPara.CreatePara(new CPara[] {
                new CPara("RefDate", DateTime.Now.ToString("yyyy-MM-dd")),
                new CPara("RefType", pRefType)
            },
                                                    ""
                                                    );
            CRefNo refno = core_service.GetNextRefNo(InputValue);

            return(CJson.SerializeObject(refno));
        }
Exemplo n.º 32
0
    public static string BuscarUsuario(string pUsuario)
    {
        //Abrir Conexion
        CConexion ConexionBaseDatos = new CConexion();
        string    respuesta         = ConexionBaseDatos.ConectarBaseDatosSqlServer();

        CJson jsonUsuario = new CJson();

        jsonUsuario.StoredProcedure.CommandText = "sp_Usuario_Consulta";
        jsonUsuario.StoredProcedure.Parameters.AddWithValue("@Opcion", 13);
        jsonUsuario.StoredProcedure.Parameters.AddWithValue("@pUsuario", pUsuario);
        return(jsonUsuario.ObtenerJsonString(ConexionBaseDatos));
    }
Exemplo n.º 33
0
    public static string BuscarTipoDocumento(string pTipoDocumento)
    {
        //Abrir Conexion
        CConexion ConexionBaseDatos = new CConexion();
        string    respuesta         = ConexionBaseDatos.ConectarBaseDatosSqlServer();

        CJson jsonTipoDocumento = new CJson();

        jsonTipoDocumento.StoredProcedure.CommandText = "spb_TipoDocumento_ConsultarFiltros";
        jsonTipoDocumento.StoredProcedure.Parameters.AddWithValue("Opcion", 2);
        jsonTipoDocumento.StoredProcedure.Parameters.AddWithValue("@pTipoDocumento", pTipoDocumento);
        return(jsonTipoDocumento.ObtenerJsonString(ConexionBaseDatos));
    }
Exemplo n.º 34
0
        //分页查询
        public ActionResult Find(int start, int limit, string idStr, DateTime? startDate, DateTime? endDate)
        {
            int empId;
            IList<int> deptIdList = getAuthedDeptIds("Week", idStr, out empId);
            EmpBasicInfo ebi = Session["ebi"] as EmpBasicInfo;

            IQueryable<WeeklyDTO> list = from r in ctx.Weeklies join s in ctx.SignFlows on
                                        new {r.FormNo,IsCurrent=1} equals new {s.FormNo,s.IsCurrent}
                                        into t
                                         from x in t.DefaultIfEmpty()
                                         where r.StatusId != 0 || r.EmpId == ebi.Id
                                         orderby r.FormNo descending
                                         select new WeeklyDTO
                                         {
                                             FormNo = r.FormNo,
                                             EmpId = r.EmpId,
                                             EmpName = r.Employee.Name,
                                             CreatDate=r.CreatDate,
                                             BeginDate=r.BeginDate,
                                             EndDate=r.EndDate,
                                             Summary = r.Summary,
                                             TxtPlan = r.TxtPlan,
                                             Suggestion = r.Suggestion,
                                             Inspiration = r.Inspiration,
                                             Improve = r.Improve,
                                             StatusId = r.StatusId,
                                             CheckEmpId = x.CheckEmpId
                                         };
            if (empId != 0)
            {
                list = list.Where(r => r.EmpId == empId);
            }
            else
            {
                list = list.Where(r => (from r1 in ctx.EmpDepPositions where deptIdList.ToArray().Contains(r1.DeptId) select r1.EmpId).Contains(r.EmpId));
            }
            if(startDate!=null)
            {
                list = list.Where(r => r.BeginDate >= startDate);
            }
            if(endDate!=null)
            {
                list = list.Where(r => r.EndDate <= endDate);
            }
            CJson CJson = new CJson();
            string json = CJson.ToJsonString("totalCount:" + list.Count() + ",data", list.Skip(start).Take(limit).ToList());
            return Content(json);
        }
Exemplo n.º 35
0
 //分页查询
 public ActionResult Find(int start, int limit,string corpName,string className,string title)
 {
     IQueryable<InfoMarketDTO> list = from r in ctx.InfoMarkets orderby r.InsertDate descending select new InfoMarketDTO { Id = r.Id, CorpName = r.CorpName, ClassName = r.ClassName, Title = r.Title, InfoFrom = r.InfoFrom,EmpId=r.EmpId, Name = r.Employee.Name, InsertDate = r.InsertDate, IsPass=r.IsPass };
     EmpBasicInfo ebi = Session["ebi"] as EmpBasicInfo;
     if(ebi.EmpDepPos.Where(r=>r.PosId>=4).Count()>0)//总监(含)以上级别只显示审核通过的 和 自己添加的
     {
         list = list.Where(r=>r.IsPass==1 || r.EmpId==ebi.Id);
     }
     if(corpName!=null)
     {
         list = list.Where(r => r.CorpName.Contains(corpName));
     }
     if(className!=null)
     {
         list = list.Where(r => r.ClassName.Contains(className));
     }
     if(title!=null)
     {
         list = list.Where(r => r.Title.Contains(title));
     }
     CJson CJson = new CJson();
     string json = CJson.ToJsonString("totalCount:" + list.Count() + ",data", list.Skip(start).Take(limit).ToList());
     return Content(json);
 }
Exemplo n.º 36
0
        //分页查询员工记录
        public ActionResult Find(int start, int limit, int? deptId,string name, int? statusId)
        {
            string idStr = deptId == null ? null : deptId.ToString();
            int empId;
            IList<int> deptIdList = getAuthedDeptIds("EmpProfile", idStr, out empId);
            if(name==null)
            {
                name = "";
            }

            IQueryable<EmpProfileWithDep> list;
            if (statusId != null && statusId>0)
            {
                switch(statusId)
                {
                    case 1://在职
                        list = from r in ctx.Employees where r.Name.Contains(name) && r.LeaveDate == null && ((from r1 in ctx.EmpDepPositions where deptIdList.ToArray().Contains(r1.DeptId) select r1.EmpId).Contains(r.Id) || r.EmpDepPositions.Count == 0) orderby r.JobNo descending select new EmpProfileWithDep { Id = r.Id, JobNo = r.JobNo, Name = r.Name, Dep = r.EmpDepPositions.FirstOrDefault().Depts.Text, TelExt = r.TelExt, Mobile = r.Mobile, IdAddress = r.IdAddress };
                        break;
                    case 2://离职
                        list = from r in ctx.Employees where r.Name.Contains(name) && r.LeaveDate != null && ((from r1 in ctx.EmpDepPositions where deptIdList.ToArray().Contains(r1.DeptId) select r1.EmpId).Contains(r.Id) || r.EmpDepPositions.Count == 0) orderby r.JobNo descending select new EmpProfileWithDep { Id = r.Id, JobNo = r.JobNo, Name = r.Name, Dep = r.EmpDepPositions.FirstOrDefault().Depts.Text, TelExt = r.TelExt, Mobile = r.Mobile, IdAddress = r.IdAddress };
                        break;
                    case 3://试用
                        list = from r in ctx.Employees where r.Name.Contains(name) && r.LeaveDate == null && r.TrialDate <= DateTime.Today && r.DueDate > DateTime.Today && ((from r1 in ctx.EmpDepPositions where deptIdList.ToArray().Contains(r1.DeptId) select r1.EmpId).Contains(r.Id) || r.EmpDepPositions.Count == 0) orderby r.JobNo descending select new EmpProfileWithDep { Id = r.Id, JobNo = r.JobNo, Name = r.Name, Dep = r.EmpDepPositions.FirstOrDefault().Depts.Text, TelExt = r.TelExt, Mobile = r.Mobile, IdAddress = r.IdAddress };
                        break;
                    case 4://实习
                        list = from r in ctx.Employees where r.Name.Contains(name) && r.LeaveDate == null && r.PacticeDate <= DateTime.Today && r.TrialDate > DateTime.Today && ((from r1 in ctx.EmpDepPositions where deptIdList.ToArray().Contains(r1.DeptId) select r1.EmpId).Contains(r.Id) || r.EmpDepPositions.Count == 0) orderby r.JobNo descending select new EmpProfileWithDep { Id = r.Id, JobNo = r.JobNo, Name = r.Name, Dep = r.EmpDepPositions.FirstOrDefault().Depts.Text, TelExt = r.TelExt, Mobile = r.Mobile, IdAddress = r.IdAddress };
                        break;
                    default:
                        list = from r in ctx.Employees where r.Name.Contains(name) && r.LeaveDate == null && ((from r1 in ctx.EmpDepPositions where deptIdList.ToArray().Contains(r1.DeptId) select r1.EmpId).Contains(r.Id) || r.EmpDepPositions.Count == 0) orderby r.JobNo descending select new EmpProfileWithDep { Id = r.Id, JobNo = r.JobNo, Name = r.Name, Dep = r.EmpDepPositions.FirstOrDefault().Depts.Text, TelExt = r.TelExt, Mobile = r.Mobile, IdAddress = r.IdAddress };
                        break;
                }
            }
            else
            {
                list = from r in ctx.Employees where r.Name.Contains(name) && r.LeaveDate == null && ((from r1 in ctx.EmpDepPositions where deptIdList.ToArray().Contains(r1.DeptId) select r1.EmpId).Contains(r.Id) || r.EmpDepPositions.Count == 0) orderby r.JobNo descending select new EmpProfileWithDep { Id = r.Id, JobNo = r.JobNo, Name = r.Name, Dep = r.EmpDepPositions.FirstOrDefault().Depts.Text, TelExt = r.TelExt, Mobile = r.Mobile, IdAddress = r.IdAddress };
            }
            CJson CJson = new CJson();
            string json = CJson.ToJsonString("totalCount:" + list.Count() + ",data", list.Skip(start).Take(limit).ToList());
            return Content(json);
        }
Exemplo n.º 37
0
        //分页查询
        public ActionResult Find(int start, int limit, string idStr)
        {
            int empId;
            IList<int> deptIdList = getAuthedDeptIds("Overtime", idStr, out empId);
            EmpBasicInfo ebi = Session["ebi"] as EmpBasicInfo;

            IQueryable<InviteDTO> list = from r in ctx.ReqInvites
                                           join s in ctx.SignFlows on
                                               new { r.FormNo, IsCurrent = 1 } equals new { s.FormNo, s.IsCurrent }
                                               into t
                                           from x in t.DefaultIfEmpty()
                                           where r.StatusId != 0 || r.EmpId == ebi.Id
                                           orderby r.FormNo descending
                                           select new InviteDTO
                                           {
                                               FormNo = r.FormNo,
                                               EmpId = r.EmpId,
                                               EmpName = r.Employee.Name,
                                               DeptName = r.Depts.Text,
                                               Position = r.Position,
                                               ReqNum = r.ReqNum,
                                               OnDutyDate = r.OnDutyDate,
                                               StatusId = r.StatusId,
                                               CheckEmpId = x.CheckEmpId
                                           };
            if (empId != 0)
            {
                list = list.Where(r => r.EmpId == empId);
            }
            else
            {
                list = list.Where(r => (from r1 in ctx.EmpDepPositions where deptIdList.ToArray().Contains(r1.DeptId) select r1.EmpId).Contains(r.EmpId));
            }
            //IQueryable<ReqVehicleMains> list = from r in ctx.ReqVehicleMains select r;
            CJson CJson = new CJson();
            string json = CJson.ToJsonString("totalCount:" + list.Count() + ",data", list.Skip(start).Take(limit).ToList());
            return Content(json);
        }
Exemplo n.º 38
0
        //分页查询
        public ActionResult Find(int start, int limit, string idStr,string name)
        {
            int empId;
            IList<int> deptIdList = getAuthedDeptIds("Perchase", idStr, out empId);
            EmpBasicInfo ebi = Session["ebi"] as EmpBasicInfo;

            IQueryable<PerchaseDTO> q = from r in ctx.ReqPerchaseMains
                                           join s in ctx.SignFlows on
                                               new { r.FormNo, IsCurrent = 1 } equals new { s.FormNo, s.IsCurrent }
                                               into t
                                        from x in t.DefaultIfEmpty()
                                        where r.StatusId != 0 || r.EmpId == ebi.Id
                                           orderby r.FormNo descending
                                           select new PerchaseDTO
                                           {
                                               FormNo = r.FormNo,
                                               EmpId = r.EmpId,
                                               EmpName = r.Employee.Name,
                                               Cost = r.Cost,
                                               Cause = r.Cause,
                                               StatusId = r.StatusId,
                                               CheckEmpId = x.CheckEmpId
                                           };
            if (empId != 0)
            {
                q = q.Where(r => r.EmpId == empId);
            }
            else
            {
                q = q.Where(r => (from r1 in ctx.EmpDepPositions where deptIdList.ToArray().Contains(r1.DeptId) select r1.EmpId).Contains(r.EmpId));
            }
            if (!string.IsNullOrWhiteSpace(name))
            {
                q = q.Where(r => r.EmpName.Contains(name));
            }
            int totalCnt = q.Count();
            IList<PerchaseDTO> list = q.Skip(start).Take(limit).ToList();
            foreach (var dto in list)
            {
                var subList = from r in ctx.ReqPerchaseSubs where r.FormNo == dto.FormNo select r;
                string goodsName = null;
                foreach (var v in subList)
                {
                    goodsName += v.GoodsName;
                }
                dto.GoodsNames = goodsName;
            }
            //IQueryable<ReqVehicleMains> list = from r in ctx.ReqVehicleMains select r;
            CJson CJson = new CJson();
            string json = CJson.ToJsonString("totalCount:" + totalCnt + ",data", list);
            return Content(json);
        }
Exemplo n.º 39
0
        //分页查询
        public ActionResult Find(int start, int limit, string idStr,string name)
        {
            int empId;
            IList<int> deptIdList = getAuthedDeptIds("Vacation", idStr, out empId);
            EmpBasicInfo ebi = Session["ebi"] as EmpBasicInfo;

            IQueryable<VacationDTO> q = from r in ctx.ReqVacationMains
                                          join s in ctx.SignFlows on
                                              new { r.FormNo, IsCurrent = 1 } equals new { s.FormNo, s.IsCurrent }
                                              into t
                                        from x in t.DefaultIfEmpty()
                                        where r.StatusId != 0 || r.EmpId == ebi.Id
                                           orderby r.FormNo descending
                                           select new VacationDTO
                                          {
                                              FormNo = r.FormNo,
                                              EmpId = r.EmpId,
                                              EmpName = r.Employee.Name,
                                              VacationType = r.VacationType,
                                              DaysCnt=r.DaysCnt,
                                              Cause = r.Cause,
                                              StatusId = r.StatusId,
                                              CheckEmpId = x.CheckEmpId
                                          };
            if (empId != 0)
            {
                q = q.Where(r => r.EmpId == empId);
            }
            else
            {
                q = q.Where(r => (from r1 in ctx.EmpDepPositions where deptIdList.ToArray().Contains(r1.DeptId) select r1.EmpId).Contains(r.EmpId));
            }
            if (!string.IsNullOrWhiteSpace(name))
            {
                q = q.Where(r => r.EmpName.Contains(name));
            }
            int totalCnt = q.Count();
            IList<VacationDTO> list = q.Skip(start).Take(limit).ToList();
            foreach (var dto in list)
            {
                var subList = from r in ctx.ReqVacationSubs where r.FormNo == dto.FormNo select r;
                DateTime dtStart = DateTime.MaxValue;
                DateTime dtEnd = DateTime.MinValue;
                foreach (var v in subList)
                {
                    if (dtStart > v.PreStartTime)
                    {
                        dtStart = v.PreStartTime;
                    }
                    if (dtEnd < v.PreEndTime)
                    {
                        dtEnd = v.PreEndTime;
                    }
                }
                dto.PreStartTime = dtStart;
                dto.PreEndTime = dtEnd;
            }
            //IQueryable<ReqVehicleMains> list = from r in ctx.ReqVehicleMains select r;
            CJson CJson = new CJson();
            string json = CJson.ToJsonString("totalCount:" + totalCnt + ",data", list);
            return Content(json);
        }
Exemplo n.º 40
0
 //公共通讯薄
 public ActionResult GetContactInfo(int? deptId)
 {
     IQueryable<EmpProfileWithDep> list;
     if (deptId != null)
     {
         var d = new DeptController();
         IList<int> deptIdList = d.GetChildDeptIdList((int)deptId);
         list = from r in ctx.Employees where r.LeaveDate == null && Nullable.Equals(r.LeaveDate,null) && (from r1 in ctx.EmpDepPositions where deptIdList.ToArray().Contains(r1.DeptId) select r1.EmpId).Contains(r.Id) orderby r.Name select new EmpProfileWithDep { Id = r.Id, JobNo = r.JobNo, Name = r.Name,Dep = r.EmpDepPositions.FirstOrDefault().Depts.Text, TelExt = r.TelExt, Mobile = r.Mobile, ShortNo = r.ShortNo, IdAddress = r.IdAddress };
     }
     else
     {
         list = from r in ctx.Employees where r.LeaveDate == null && Nullable.Equals(r.LeaveDate, null) orderby r.Name select new EmpProfileWithDep { Id = r.Id, JobNo = r.JobNo, Name = r.Name,Dep = r.EmpDepPositions.FirstOrDefault().Depts.Text, TelExt = r.TelExt, Mobile = r.Mobile, ShortNo = r.ShortNo, IdAddress = r.IdAddress };
     }
     IList<EmpProfileWithDep> epd = list.ToList();
     EmpBasicInfo ebi = Session["ebi"] as EmpBasicInfo;
     if(ebi.EmpDepPos.Where(r=>r.PosId<=4).Count()==0)//不是总监(含)级别,则隐藏其他部门员工手机号
     {
         foreach (var v in epd)
         {
             if(ebi.EmpDepPos.Where(r=>r.DeptId==v.DeptId).Count()==0)
             {
                 v.Mobile = null;
             }
         }
     }
     CJson CJson = new CJson();
     string json = CJson.ToJsonString("totalCount:" + epd.Count() + ",data", epd);
     return Content(json);
 }
Exemplo n.º 41
0
 //分目录查找个人文档,共享文档,通知公告
 public ActionResult Find(int start, int limit, int fileClass, int? pid)
 {
     EmpBasicInfo ebi = Session["ebi"] as EmpBasicInfo;
     IQueryable<File> list;
     if (pid != null)//子目录
     {
         list = from r in ctx.Files where r.Pid == pid select r;
     }
     else if(fileClass==0)//个人文件
     {
         list = from r in ctx.Files where r.FileClass == 0 && r.Pid == null && r.OwnerId ==ebi.Id select r;
     }
     else if (fileClass == 1)//共享文件
     {
         list = from r in ctx.Files where r.FileClass == 1 && r.Pid==null select r;
     }
     else//通知公告
     {
         list = from r in ctx.Files where r.FileClass == 2 && (r.StatusId == 1 || r.OwnerId ==ebi.Id) select r;
     }
     //return Json(list);
     CJson CJson = new CJson();
     string json = CJson.ToJsonString("totalCount:" + list.Count() + ",data", list.OrderByDescending(r=>r.CreatTime).Skip(start).Take(limit).ToList());
     return Content(json);
 }
Exemplo n.º 42
0
 //按登录用户查找授权文档
 public ActionResult GetAuthDoc(int start, int limit, int? fileId)
 {
     EmpBasicInfo ebi = Session["ebi"] as EmpBasicInfo;
     IQueryable<FileAuthed> v;
     if(fileId==null)
     {
         v = from f in ctx.Files
             join af in ctx.FileAuths on f.Id equals af.FileId
             where af.ToId == ebi.Id
             orderby af.AuthDate descending
             select new FileAuthed
             {
                 Id = f.Id,
                 Pid = f.Pid,
                 Name = f.Name,
                 Type = f.Type,
                 RealName = f.RealName,
                 Size = f.Size,
                 CreatTime = af.AuthDate,
                 OwnerId = f.OwnerId,
                 LastUpdaterId = f.LastUpdaterId,
                 StatusId = f.StatusId,
                 FromId = af.FromId,
                 FromName = af.Employee.Name,
                 ToId = af.ToId,
                 AuthType = af.AuthType,
                 AuthLevel = af.AuthLevel
             };
     }
     else
     {
         var pFile = ctx.FileAuths.Single(r => r.FileId == fileId && r.ToId ==ebi.Id);//前期只考虑父子目录授权,祖孙授权暂不考虑
         v = from r in ctx.Files
                 where r.Pid == fileId
                 select new FileAuthed
                 {
                     Id = r.Id,
                     Pid = r.Pid,
                     Name = r.Name,
                     Type = r.Type,
                     RealName = r.RealName,
                     Size = r.Size,
                     CreatTime=r.CreatTime,
                     OwnerId = r.OwnerId,
                     LastUpdaterId = r.LastUpdaterId,
                     StatusId = r.StatusId,
                     FromId = pFile.FromId,
                     ToId = pFile.ToId,
                     AuthType = pFile.AuthType,
                     AuthLevel = pFile.AuthLevel
                 };
     }
     string json;
     CJson CJson = new CJson();
     json = CJson.ToJsonString("totalCount:" + v.Count() + ",data", v.OrderByDescending(r=>r.CreatTime).Skip(start).Take(limit).ToList());
     return Content(json);
 }