public ActionResult GetAppointment_List(string action) { AppointmentList responce = new AppointmentList(); try { string query = "Exec spAppointment '','','','','','','','','','','','" + action + "'"; DataSet ds = d.BindDataset(query); List <Appointment_details> lst = new List <Appointment_details>(); if (ds.Tables[0].Rows.Count > 0) { for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { Appointment_details v = new Appointment_details(); v.Id = int.Parse(ds.Tables[0].Rows[i]["Id"].ToString()); v.Name = ds.Tables[0].Rows[i]["Name"].ToString(); v.Contact = ds.Tables[0].Rows[i]["Contact"].ToString(); v.Address = ds.Tables[0].Rows[i]["Address"].ToString(); v.PinCode = int.Parse(ds.Tables[0].Rows[i]["Pin_Code"].ToString()); v.Brand = ds.Tables[0].Rows[i]["Brand"].ToString(); v.Product_Name = ds.Tables[0].Rows[i]["Product_name"].ToString(); v.D_Of_P = ds.Tables[0].Rows[i]["D_OF_P"].ToString(); v.Serial_No = ds.Tables[0].Rows[i]["Serial_NO"].ToString(); v.Price = int.Parse(ds.Tables[0].Rows[i]["price"].ToString()); v.Problem = ds.Tables[0].Rows[i]["problem"].ToString(); v.Warranty_Status = ds.Tables[0].Rows[i]["Warranty_status"].ToString(); v.status = bool.Parse(ds.Tables[0].Rows[i]["Appoint_status"].ToString()); v.Appnt_Date = ds.Tables[0].Rows[i]["Appointment_Date"].ToString(); v.Engineer_Name = ds.Tables[0].Rows[i]["Eng_Name"].ToString(); lst.Add(v); } responce.data = lst; responce.Description = "Data Found"; } } catch (Exception e) { responce.Description = e.Message; } return(Json(responce)); }
public ActionResult Assign_Engineer(Appointment_details a) { AppointmentList responce = new AppointmentList(); try { string query = "Exec spAppointment '" + a.Id + "','','','','','','','','','','" + a.Engineer_id + "','AssignEngineer'"; DataSet ds = d.BindDataset(query); if (ds.Tables[0].Rows.Count > 0) { responce.Description = ds.Tables[0].Rows[0][0].ToString(); if (responce.Description == "OK") { responce.Description = "Engineer Assigned Successfully"; } } } catch (Exception e) { responce.Description = e.Message; } return(Json(responce)); }