public JsonResult GetAllProfile()
        {
            BL_Profile Blobj         = new BL_Profile();
            Profile    AddServiceMod = new Profile();

            AddServiceMod.dsgrid = Blobj.GetAllProfile();


            List <Profile> search = new List <Profile>();

            foreach (DataRow dr in AddServiceMod.dsgrid.Tables[0].Rows)
            {
                search.Add(new Profile
                {
                    ProfileID        = dr["ProfileID"].ToString(),
                    Name             = dr["Name"].ToString(),
                    PrintAs          = dr["PrintAs"].ToString(),
                    GeneralCharges   = dr["GeneralCharges"].ToString(),
                    EmergencyCharges = dr["EmergencyCharges"].ToString(),
                });
            }
            return(new JsonResult {
                Data = search, JsonRequestBehavior = JsonRequestBehavior.AllowGet
            });
        }
        public ActionResult DeleteProfile(int ProfileID)
        {
            string del = "";

            ProfileID = Convert.ToInt32(Request.Form["ProfileID"]);
            BL_Profile Bl_obj = new BL_Profile();

            if (Bl_obj.DeleteProfile(ProfileID))
            {
                del = "Profile Deleted Successfully  ";
            }

            return(Json(del, JsonRequestBehavior.AllowGet));
        }
        public JsonResult GetAllTestMaster()
        {
            BL_Profile Blobj         = new BL_Profile();
            Profile    AddServiceMod = new Profile();

            AddServiceMod.dsgrid = Blobj.GetAllTestMaster();


            List <Profile> search = new List <Profile>();

            foreach (DataRow dr in AddServiceMod.dsgrid.Tables[0].Rows)
            {
                search.Add(new Profile
                {
                    TestID   = dr["TestID"].ToString(),
                    TestName = dr["TestName"].ToString(),
                });
            }
            return(new JsonResult {
                Data = search, JsonRequestBehavior = JsonRequestBehavior.AllowGet
            });
        }
        public ActionResult Profile(Profile obj, FormCollection fc)
        {
            BL_Profile _BL_Profile = new BL_Profile();

            try
            {
                if (_BL_Profile.CheckProfile(obj.ProfileID, obj.Name))
                {
                    if (obj.Panel == null)
                    {
                        obj.Panel = "false";
                    }
                    else
                    {
                        obj.Panel = fc["Panel"].ToString();
                    }


                    if (obj.ProfileID == null)
                    {
                        obj.ProfileID = "";
                    }
                    else
                    {
                        obj.ProfileID = fc["ProfileID"].ToString();
                    }


                    obj.TestID = fc["tabletestid"].ToString();

                    obj.TestName = fc["TestName"].ToString();

                    if (obj.Name != null)
                    {
                        obj.Name = fc["Name"].ToString();
                    }
                    else
                    {
                        obj.Name = "";
                    }

                    if (obj.PrintAs != "" || obj.PrintAs != null)
                    {
                        obj.PrintAs = fc["PrintAs"].ToString();
                    }
                    else
                    {
                        obj.PrintAs = "";
                    }

                    if (obj.ForGender != "" || obj.ForGender != null)
                    {
                        obj.ForGender = fc["ForGender"].ToString();
                    }
                    else
                    {
                        obj.ForGender = "";
                    }

                    if (obj.Client != "" || obj.Client != null)
                    {
                        obj.Client = fc["Client"].ToString();
                    }
                    else
                    {
                        obj.Client = "";
                    }

                    if (obj.HMSCode != "" || obj.HMSCode != null)
                    {
                        obj.HMSCode = fc["HMSCode"].ToString();
                    }
                    else
                    {
                        obj.HMSCode = "";
                    }

                    if (obj.Discount != "" || obj.Discount != null)
                    {
                        obj.Discount = fc["Discount"].ToString();
                    }
                    else
                    {
                        obj.Discount = "";
                    }

                    //obj.Discount = "0";


                    if (obj.GeneralCharges != "" || obj.GeneralCharges != null)
                    {
                        obj.GeneralCharges = fc["GeneralCharges"].ToString();
                    }
                    else
                    {
                        obj.GeneralCharges = "0.00";
                    }

                    if (obj.EmergencyCharges != "" || obj.EmergencyCharges != null)
                    {
                        obj.EmergencyCharges = fc["EmergencyCharges"].ToString();
                    }
                    else
                    {
                        obj.EmergencyCharges = "0.00";
                    }

                    if (obj.Commission != "" || obj.Commission != null)
                    {
                        obj.Commission = fc["Commission"].ToString();
                    }
                    else
                    {
                        obj.Commission = "0.00";
                    }


                    if (obj.CommissionRs != "" || obj.CommissionRs != null)
                    {
                        obj.CommissionRs = fc["CommissionRs"].ToString();
                    }
                    else
                    {
                        obj.CommissionRs = "";
                    }
                    if (Blobj.Save(obj))
                    {
                        if (Convert.ToInt32(obj.ProfileID) > 0)
                        {
                            ModelState.Clear();
                            ViewData["flag"] = "Done";
                            TempData["Msg"]  = "Profile Updated Successfully ";
                            return(RedirectToAction("Profile", "Profile"));
                        }
                        else
                        {
                            ModelState.Clear();
                            ViewData["flag"] = "Done";
                            TempData["Msg"]  = "Profile Saved Successfully ";
                            return(RedirectToAction("Profile", "Profile"));
                        }
                    }
                }
                else
                {
                    TempData["msg"] = "Profile Already Exist's";
                }
                return(RedirectToAction("Profile", "Profile"));
            }

            catch (Exception ex)
            {
                return(RedirectToAction("Profile", "Profile"));
            }
        }