Example #1
0
        public JsonResult getforUpdate(int Id)
        {
            connection();
            persondata EmpList = new persondata();
            SqlCommand com     = new SqlCommand("getone", con);

            com.CommandType = CommandType.StoredProcedure;
            com.Parameters.AddWithValue("@Id", Id);


            con.Open();


            SqlDataReader rdr = com.ExecuteReader();

            while (rdr.Read())
            {
                EmpList.Id       = Convert.ToInt32(rdr["Id"]);
                EmpList.Name     = rdr["Name"].ToString();
                EmpList.fname    = rdr["FName"].ToString();
                EmpList.visatype = rdr["Visatype"].ToString();
            }
            var json = JsonConvert.SerializeObject(EmpList);

            return(Json(json, JsonRequestBehavior.AllowGet));
        }
Example #2
0
        public void downloadform(int Id)
        {
            connection();
            persondata EmpList = new persondata();
            SqlCommand com     = new SqlCommand("getone", con);

            com.CommandType = CommandType.StoredProcedure;
            com.Parameters.AddWithValue("@Id", Id);
            con.Open();
            SqlDataReader rdr = com.ExecuteReader();

            while (rdr.Read())
            {
                EmpList.Id          = Convert.ToInt32(rdr["Id"]);
                EmpList.Name        = rdr["Name"].ToString();
                EmpList.country     = rdr["Country"].ToString();
                EmpList.visatype    = rdr["Visatype"].ToString();
                EmpList.Email       = rdr["Email"].ToString();
                EmpList.phone       = Convert.ToInt32(rdr["Phoneno"]);
                EmpList.Nochildrens = Convert.ToInt32(rdr["Siblingcount"]);
                EmpList.DOB         = Convert.ToDateTime(rdr["Dateofbirth"]);
            }
            const string loc = "C:\\zohaib\\";
            Document     doc = new Document(loc + "name.docx");

            doc.MailMerge.Execute(new string[] { "id", "NAME", "VISA", "PHONE", "COUNTRY", "CHILDS", "EMAIL", "DATE", }, new object[] { EmpList.Id, EmpList.Name, EmpList.visatype, EmpList.phone, EmpList.country, EmpList.Nochildrens, EmpList.Email, EmpList.DOB });
            doc.Save(loc + " " + EmpList.Id + " _ " + EmpList.Name + ".docx");
        }
Example #3
0
    public void savedata()
    {
        persondata person = new persondata();

        person.shengming = bloodline;//存值进去
        person.lingqi    = 50;
        save.savedate(person);
    }
Example #4
0
    public static void savedate(persondata data)
    {
        string filepath = Application.dataPath + @"/persondata/persondata.json";

        Debug.Log(Application.dataPath + @"/persondata/persondata.json");

        string json = JsonMapper.ToJson(data);//persondata类传值进来,转为json数据保存

        Debug.Log(json);

        FileInfo     file = new FileInfo(filepath);
        StreamWriter sw   = file.CreateText();

        sw.WriteLine(json);
        sw.Close();
        sw.Dispose();
        AssetDatabase.Refresh();
    }
Example #5
0
    public void Loaddata()
    {
        string filepath = Application.dataPath + @"/persondata/persondata.json";

        Debug.Log(Application.dataPath + @"/persondata/persondata.json");

        if (!File.Exists(filepath))
        {
            Debug.Log("no file");
            return;
        }

        StreamReader sr = new StreamReader(filepath);


        string dataset = sr.ReadToEnd();//取值

        Debug.Log(dataset);

        person = JsonMapper.ToObject <persondata>(dataset);//toobject赋值给persondata类
    }
Example #6
0
        public ActionResult send(persondata obj)
        {
            connection();
            SqlCommand com = new SqlCommand("AddNewEmpDetails", con);

            com.CommandType = CommandType.StoredProcedure;
            com.Parameters.AddWithValue("@Name", obj.Name);
            com.Parameters.AddWithValue("@Fname", obj.fname);
            com.Parameters.AddWithValue("@Email", obj.Email);
            com.Parameters.AddWithValue("@Phoneno", obj.phone);
            com.Parameters.AddWithValue("@Dateofbirth", obj.DOB);
            com.Parameters.AddWithValue("@Country", obj.country);
            com.Parameters.AddWithValue("@Maritialstatus", obj.maritial);
            com.Parameters.AddWithValue("@Gender", obj.gender);
            com.Parameters.AddWithValue("@Visatype", obj.visatype);
            com.Parameters.AddWithValue("@Siblingcount", obj.Nochildrens);
            con.Open();
            int i = com.ExecuteNonQuery();

            con.Close();
            return(Json(new { msg = "Successfully added " }));
        }