示例#1
0
 //[HttpGet]
 //public JsonResult GetEmployeeRatings()
 //{
 //    NuPortalDBService.NuPortalService Dbservice = new NuPortalDBService.NuPortalService();
 //    Dbservice.Url = Constants.DBService;
 //    try
 //    {
 //        string jsonString = Dbservice.SelectGridInfo(Convert.ToInt32(Session["EmpId"]), 25);
 //        if (jsonString != string.Empty)
 //            return Json(jsonString, JsonRequestBehavior.AllowGet);
 //    }
 //    catch (Exception ex)
 //    {
 //        return Json(Common_Library.Constants.JsonError, JsonRequestBehavior.AllowGet);
 //    }
 //    finally
 //    {
 //        Dbservice = null;
 //    }
 //    return Json(Common_Library.Constants.JsonError, JsonRequestBehavior.AllowGet);
 //}
 public JsonResult AutoCompleteEmployee(string EmpName)
 {
     try
     {
         Dictionary <string, string> oItems = new Dictionary <string, string>();
         NuPortalEmpService.NuPortalEmployeeService empService = new NuPortalEmpService.NuPortalEmployeeService();
         empService.Url = Constants.EmpService;
         DataTable dtAutoComplete = JsonConvert.DeserializeObject <DataTable>(empService.ManagerAutoComplete(Convert.ToInt32(Session["CompanyId"]),
                                                                                                             EmpName, Convert.ToInt32(Session["EmpId"]), 3));
         if (dtAutoComplete != null && dtAutoComplete.Rows.Count > 0)
         {
             for (int i = 0; i < dtAutoComplete.Rows.Count; i++)
             {
                 oItems.Add(dtAutoComplete.Rows[i]["EmpId"].ToString(), dtAutoComplete.Rows[i]["FirstName"].ToString());
             }
         }
         return(Json(oItems.ToList()));
     }
     catch (Exception ex)
     {
         GeneralFunctions genFun = new GeneralFunctions();
         genFun.LogError(ControllerContext.HttpContext, ex.Message, ex.TargetSite.Name,
                         Convert.ToString(ControllerContext.RouteData.Values["action"]),
                         Convert.ToString(ControllerContext.RouteData.Values["controller"]));
         genFun = null;
         return(null);
     }
 }
示例#2
0
 public JsonResult SaveOppReason(int OppId, string Reason, int Operation)
 {
     NuPortalEmpService.NuPortalEmployeeService empService = new NuPortalEmpService.NuPortalEmployeeService();
     empService.Url = Constants.EmpService;
     try
     {
         string jsonString = empService.ManagerAutoComplete(OppId, Reason, Convert.ToInt32(Session["EmpId"]), Operation);
         if (jsonString != string.Empty)
         {
             return(Json(jsonString, JsonRequestBehavior.AllowGet));
         }
     }
     catch (Exception ex)
     {
         GeneralFunctions genFun = new GeneralFunctions();
         genFun.LogError(ControllerContext.HttpContext, ex.Message, ex.TargetSite.Name,
                         Convert.ToString(ControllerContext.RouteData.Values["action"]),
                         Convert.ToString(ControllerContext.RouteData.Values["controller"]));
         genFun = null;
         return(Json(Common_Library.Constants.JsonError, JsonRequestBehavior.AllowGet));
     }
     finally
     {
         empService = null;
     }
     return(Json(Common_Library.Constants.JsonError, JsonRequestBehavior.AllowGet));
 }
        public JsonResult AutoComplete(string Name, int Operation, string IdVal, string NameVal)
        {
            Dictionary <string, string> oItems = new Dictionary <string, string>();

            NuPortalEmpService.NuPortalEmployeeService empService = new NuPortalEmpService.NuPortalEmployeeService();
            empService.Url = Constants.EmpService;
            DataTable dtAutoComplete = JsonConvert.DeserializeObject <DataTable>(empService.ManagerAutoComplete(Convert.ToInt32(Session["CompanyId"]), Name, 0, Operation));

            if (dtAutoComplete != null && dtAutoComplete.Rows.Count > 0)
            {
                for (int i = 0; i < dtAutoComplete.Rows.Count; i++)
                {
                    oItems.Add(dtAutoComplete.Rows[i][IdVal].ToString(), dtAutoComplete.Rows[i][NameVal].ToString());
                }
            }
            return(Json(oItems.ToList()));
        }
示例#4
0
        public JsonResult AutoCompleteResources(int Project, string EmpName)
        {
            Dictionary <string, string> oItems = new Dictionary <string, string>();

            NuPortalEmpService.NuPortalEmployeeService empService = new NuPortalEmpService.NuPortalEmployeeService();
            empService.Url = Constants.EmpService;
            DataTable dtAutoComplete = JsonConvert.DeserializeObject <DataTable>(empService.ManagerAutoComplete(Project, EmpName, 0, 2));

            if (dtAutoComplete != null && dtAutoComplete.Rows.Count > 0)
            {
                for (int i = 0; i < dtAutoComplete.Rows.Count; i++)
                {
                    oItems.Add(dtAutoComplete.Rows[i]["EmpId"].ToString(), dtAutoComplete.Rows[i]["FirstName"].ToString());
                }
            }


            return(Json(oItems.ToList()));
        }