コード例 #1
0
        public ActionResult AdminLogin(admin_model ad)
        {
            LoginView responce = new LoginView();

            try
            {
                string  query = "Exec spLogin '" + ad.username + "','" + ad.password + "','AdminLogin'";
                DataSet ds    = d.BindDataset(query);
                if (ds.Tables[0].Rows.Count > 0)
                {
                    responce.Description = ds.Tables[0].Rows[0]["msg"].ToString();
                    if (responce.Description == "Failed")
                    {
                        responce.Description = "Username or password Invalid...!!";
                    }
                    else
                    {
                        Session["Name"]     = ds.Tables[0].Rows[0]["name"].ToString();
                        Session["Username"] = ds.Tables[0].Rows[0]["username"].ToString();
                        Session["LoginAs"]  = ds.Tables[0].Rows[0]["LogAs"].ToString();
                        responce.returnurl  = "/Home/Admin_Index";
                    }
                }
            }
            catch (Exception e)
            {
                responce.Description = e.Message;
            }
            return(Json(responce));
        }
        public ActionResult GetApplinces(string action)
        {
            DataUtility  d        = new DataUtility();
            AllApplinces responce = new AllApplinces();

            try
            {
                string  query             = "Exec spProcut '','','" + action + "'";
                DataSet ds                = d.BindDataset(query);
                List <Applinces_Data> lst = new List <Applinces_Data>();
                if (ds.Tables[0].Rows.Count > 0)
                {
                    for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                    {
                        Applinces_Data v = new Applinces_Data();
                        v.id           = int.Parse(ds.Tables[0].Rows[i]["Id"].ToString());
                        v.Product_Name = ds.Tables[0].Rows[i]["Product_name"].ToString();
                        lst.Add(v);
                    }

                    responce.Data        = lst;
                    responce.Description = "Data Found";
                }
            }
            catch (Exception e)
            {
                responce.Description = e.Message;
            }
            return(Json(responce));
        }
        public ActionResult User_Details(userdata ud)
        {
            DataUtility  du       = new DataUtility();
            User_Details responce = new User_Details();

            try
            {
                string          query = "Exec spCustomer '','" + ud.Email + "','','','','','','SelectByEmail'";
                DataSet         ds    = du.BindDataset(query);
                List <userdata> lst   = new List <userdata>();
                if (ds.Tables[0].Rows.Count > 0)
                {
                    userdata u = new userdata();
                    u.U_ID     = int.Parse(ds.Tables[0].Rows[0]["U_id"].ToString());
                    u.Name     = ds.Tables[0].Rows[0]["Name"].ToString();
                    u.Contact  = ds.Tables[0].Rows[0]["Contact"].ToString();
                    u.Address  = ds.Tables[0].Rows[0]["Address"].ToString();
                    u.Pin_Code = ds.Tables[0].Rows[0]["Pin_Code"].ToString();
                    u.Email    = ds.Tables[0].Rows[0]["Email"].ToString();
                    lst.Add(u);
                    responce.Data = lst;
                }
            }
            catch (Exception e)
            {
                responce.Description = e.Message;
            }

            return(Json(responce));
        }
コード例 #4
0
        public ActionResult Login(userdata ud)
        {
            UserLogin responce = new UserLogin();

            try
            {
                string  query = "Exec spLogin '" + ud.Email + "','" + ud.Password + "','UserLogin'";
                DataSet ds    = d.BindDataset(query);
                if (ds.Tables[0].Rows.Count > 0)
                {
                    responce.Description = ds.Tables[0].Rows[0]["msg"].ToString();
                    if (responce.Description == "Failed")
                    {
                        responce.Description = "Username or Password incorrect!";
                    }
                    else
                    {
                        Session["UName"] = ds.Tables[0].Rows[0]["Name"].ToString();
                        string val = Session["UName"].ToString();
                        Session["Username"] = ds.Tables[0].Rows[0]["Email"].ToString();
                        Session["LoginAs"]  = "User";
                        responce.returnurl  = "/Customer/UserAction/Appointment";
                    }
                }
            }
            catch (Exception e)
            {
                responce.Description = e.Message;
            }
            return(Json(responce));
        }
        public ActionResult enginners_list(string action)
        {
            EngineersD responce = new EngineersD();

            try
            {
                string  query = "EXEC spEngineers '','','','','','','" + action + "'";
                DataSet ds    = d.BindDataset(query);
                List <EngineerDetails> lste = new List <EngineerDetails>();
                if (ds.Tables[0].Rows.Count > 0)
                {
                    for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                    {
                        EngineerDetails v = new EngineerDetails();
                        v.Id           = int.Parse(ds.Tables[0].Rows[i]["Id"].ToString());
                        v.e_name       = ds.Tables[0].Rows[i]["Engineer Name"].ToString();
                        v.contact      = ds.Tables[0].Rows[i]["Phone Number"].ToString();
                        v.gender_id    = int.Parse(ds.Tables[0].Rows[i]["GenderId"].ToString());
                        v.gender       = ds.Tables[0].Rows[i]["Gender"].ToString();
                        v.Exp_id       = int.Parse(ds.Tables[0].Rows[i]["ExpId"].ToString());
                        v.E_Experience = ds.Tables[0].Rows[i]["Experience"].ToString();
                        v.D_OF_J       = ds.Tables[0].Rows[i]["D_OF_J"].ToString();
                        lste.Add(v);
                    }
                    responce.data        = lste;
                    responce.Description = "Data Found";
                }
            }
            catch (Exception e)
            {
                responce.Description = e.Message;
            }
            return(Json(responce));
        }
        public ActionResult Sign_Up(userdata ud)
        {
            UserRegsiter responce = new UserRegsiter();

            try
            {
                string  query = "Exec spCustomer '','" + ud.Email + "','" + ud.Password + "','" + ud.Name + "','" + ud.Contact + "','" + ud.Address + "','" + ud.Pin_Code + "','Insert'";
                DataSet ds    = d.BindDataset(query);
                if (ds.Tables[0].Rows.Count > 0)
                {
                    responce.Description = ds.Tables[0].Rows[0][0].ToString();
                }
                else
                {
                    responce.Description = "Something went wrong";
                }
            }
            catch (Exception e)
            {
                responce.Description = e.Message;
            }
            return(Json(responce));
        }
        public ActionResult Appointment_Applay(Appointment_data ad)
        {
            DataUtility     d        = new DataUtility();
            Appointment_app responce = new Appointment_app();

            try
            {
                string  query = "Exec spAppointment '','" + ad.Customer_Id + "','" + ad.Brand + "','" + ad.Applinces_Id + "','" + ad.D_OF_P + "','" + ad.Serial_NO + "','" + ad.price + "','" + ad.problem + "','" + ad.warranty_statuse + "','" + ad.Appnt_Date + "','','Insert'";
                DataSet ds    = d.BindDataset(query);
                if (ds.Tables[0].Rows.Count > 0)
                {
                    responce.Description = ds.Tables[0].Rows[0][0].ToString();
                }
                else
                {
                    responce.Description = "Something went wrong";
                }
            }
            catch (Exception e)
            {
                responce.Description = e.Message;
            }
            return(Json(responce));
        }