Ejemplo n.º 1
0
 //销售员客户查询处理
 public ActionResult select_client()
 {
     int saleID = Convert.ToInt32(Request["saleID"]);
     SqlParameter[] saleIDparam = { new SqlParameter("@saleID", saleID) };
     var clientds = SQLHelper.ExecuteDataset(connStr, System.Data.CommandType.StoredProcedure, "sale_select_client", saleIDparam);
     if (clientds.Tables[0].Rows.Count > 0)
     {
         List<Client> clients = new List<Client>();
         for (int i = 0; i < clientds.Tables[0].Rows.Count; i++)
         {
             Client client = new Client();
             client.id = Convert.ToInt32(clientds.Tables[0].Rows[i]["id"]);
             client.clientname = clientds.Tables[0].Rows[i]["clientname"].ToString();
             client.industry = clientds.Tables[0].Rows[i]["industry"].ToString();
             client.address = clientds.Tables[0].Rows[i]["address"].ToString();
             client.area = clientds.Tables[0].Rows[i]["area"].ToString();
             client.contact = clientds.Tables[0].Rows[i]["contact"].ToString();
             client.contactphone = clientds.Tables[0].Rows[i]["contactphone"].ToString();
             client.presigntime = clientds.Tables[0].Rows[i]["presigntime"].ToString();
             client.signtime = clientds.Tables[0].Rows[i]["signtime"].ToString();
             client.preamt = clientds.Tables[0].Rows[i]["preamt"].ToString();
             client.amt = clientds.Tables[0].Rows[i]["amt"].ToString();
             clients.Add(client);
         }
         var result = new { code = "0", rows = clients };
         return Json(result, JsonRequestBehavior.AllowGet);
     }
     else
     {
         var result = new { code = "1" };
         return Json(result, JsonRequestBehavior.AllowGet);
     }
 }
Ejemplo n.º 2
0
 //查询客户详情处理
 public ActionResult totalmessageclient()
 {
     int id = Convert.ToInt32(Request["id"]);
     SqlParameter[] messageparam = { new SqlParameter("@id", id) };
     var totalmessageres = SQLHelper.ExecuteDataset(connStr, System.Data.CommandType.StoredProcedure, "client_total_message", messageparam);
     if (totalmessageres.Tables[0].Rows.Count > 0)
     {
         List<Client> totalclient = new List<Client>();
         for (int i = 0; i < totalmessageres.Tables[0].Rows.Count; i++)
         {
             Client client = new Client();
             client.clientname = totalmessageres.Tables[0].Rows[i]["clientname"].ToString();
             client.industry = totalmessageres.Tables[0].Rows[i]["industry"].ToString();
             client.address = totalmessageres.Tables[0].Rows[i]["address"].ToString();
             client.area = totalmessageres.Tables[0].Rows[i]["area"].ToString();
             client.areavalue = Convert.ToInt32(totalmessageres.Tables[0].Rows[i]["areavalue"]);
             client.clientfrom = totalmessageres.Tables[0].Rows[i]["clientfrom"].ToString();
             client.contact = totalmessageres.Tables[0].Rows[i]["contact"].ToString();
             client.contactphone = totalmessageres.Tables[0].Rows[i]["contactphone"].ToString();
             client.presigntime = totalmessageres.Tables[0].Rows[i]["presigntime"].ToString();
             client.signtime = totalmessageres.Tables[0].Rows[i]["signtime"].ToString();
             client.preamt = totalmessageres.Tables[0].Rows[i]["preamt"].ToString();
             client.amt = totalmessageres.Tables[0].Rows[i]["amt"].ToString();
             client.salename = totalmessageres.Tables[0].Rows[i]["salename"].ToString();
             totalclient.Add(client);
         }
         var result = new { code = "0", rows = totalclient };
         return Json(result, JsonRequestBehavior.AllowGet);
     }
     else
     {
         var result = new { code = "1" };
         return Json(result, JsonRequestBehavior.AllowGet);
     }
 }
Ejemplo n.º 3
0
 //销售管理员客户条件查询
 public ActionResult salemanagersearchclient()
 {
     if (Convert.ToInt32(Session["status"]) == 0)
     {
         string clientname = Request["clientname"].ToString();
         SqlParameter[] searchparam = { new SqlParameter("@clientname", "%" + clientname + "%") };
         var clientds = SQLHelper.ExecuteDataset(connStr, System.Data.CommandType.StoredProcedure, "allclientsearch", searchparam);
         if (clientds.Tables[0].Rows.Count > 0)
         {
             List<Client> clients = new List<Client>();
             for (int i = 0; i < clientds.Tables[0].Rows.Count; i++)
             {
                 Client client = new Client();
                 client.id = Convert.ToInt32(clientds.Tables[0].Rows[i]["id"]);
                 client.clientname = clientds.Tables[0].Rows[i]["clientname"].ToString();
                 client.industry = clientds.Tables[0].Rows[i]["industry"].ToString();
                 client.address = clientds.Tables[0].Rows[i]["address"].ToString();
                 client.area = clientds.Tables[0].Rows[i]["area"].ToString();
                 client.contact = clientds.Tables[0].Rows[i]["contact"].ToString();
                 client.contactphone = clientds.Tables[0].Rows[i]["contactphone"].ToString();
                 client.salename = clientds.Tables[0].Rows[i]["salename"].ToString();
                 clients.Add(client);
             }
             var result = new { code = "0", rows = clients };
             return Json(result, JsonRequestBehavior.AllowGet);
         }
         else
         {
             var result = new { code = "1" };
             return Json(result, JsonRequestBehavior.AllowGet);
         }
     }
     else
     {
         int id = Convert.ToInt32(Request["id"]);
         string clientname = Request["clientname"].ToString();
         SqlParameter[] searchparam = { new SqlParameter("@id", id), new SqlParameter("@clientname", "%" + clientname + "%") };
         var clientds = SQLHelper.ExecuteDataset(connStr, System.Data.CommandType.StoredProcedure, "managerclientsearch", searchparam);
         if (clientds.Tables[0].Rows.Count > 0)
         {
             List<Client> clients = new List<Client>();
             for (int i = 0; i < clientds.Tables[0].Rows.Count; i++)
             {
                 Client client = new Client();
                 client.id = Convert.ToInt32(clientds.Tables[0].Rows[i]["id"]);
                 client.clientname = clientds.Tables[0].Rows[i]["clientname"].ToString();
                 client.industry = clientds.Tables[0].Rows[i]["industry"].ToString();
                 client.address = clientds.Tables[0].Rows[i]["address"].ToString();
                 client.area = clientds.Tables[0].Rows[i]["area"].ToString();
                 client.contact = clientds.Tables[0].Rows[i]["contact"].ToString();
                 client.contactphone = clientds.Tables[0].Rows[i]["contactphone"].ToString();
                 client.salename = clientds.Tables[0].Rows[i]["salename"].ToString();
                 clients.Add(client);
             }
             var result = new { code = "0", rows = clients };
             return Json(result, JsonRequestBehavior.AllowGet);
         }
         else
         {
             var result = new { code = "1" };
             return Json(result, JsonRequestBehavior.AllowGet);
         }
     }
     return View();
 }