示例#1
0
 public void ProcessRequest(HttpContext context)
 {
     DataModel dm = new DataModel();
     LabChType lt = new LabChType();
     lt.LabChID = Convert.ToInt32(context.Request.Params["LabChID"]);
     lt.LabChName = context.Request.Params["LabChName"];
     lt.LabSupType = Convert.ToInt32(context.Request.Params["LabSupType"]);
     dm.SaveLabChType(lt);
     dm.ReturnJsonMsg(context.Response, 1, "保存成功!", lt.LabChID);
 }
示例#2
0
 protected void Page_Load(object sender, EventArgs e)
 {
     lc = new LabChType();
     DataModel dm = new DataModel();
     if (Request.Params["id"] != null && Request.Params["id"].Trim() != "")
     {
         int id = Convert.ToInt32(Request.Params["id"].Trim());
         lc = dm.GetLabChType(id);
     }
 }
示例#3
0
 public int SaveLabChType(LabChType lt)
 {
     InitCommand();
     if (lt.LabChID == 0)
     {
         //Insert new user
         cmd.CommandText = "INSERT INTO LabChType_tb (LabChName,LabSupType) VALUES (@LabChName,@LabSupType)";
         cmd.Parameters.Clear();
         cmd.Parameters.AddWithValue("@LabTypeName", lt.LabChName);
         cmd.Parameters.AddWithValue("@LabTypeInfo", lt.LabSupType);
         cmd.ExecuteNonQuery();
         cmd.CommandText = "SELECT @@Identity ";
         lt.LabChID = (int)cmd.ExecuteScalar();
     }
     else
     {
         cmd.CommandText = "UPDATE LabChType_tb SET  " +
         " LabChName=@LabChName,LabSupType=@LabSupType where LabChID=@LabChID";
         cmd.Parameters.Clear();
         cmd.Parameters.AddWithValue("@LabChName", lt.LabChName);
         cmd.Parameters.AddWithValue("@LabSupType", lt.LabSupType);
         cmd.Parameters.AddWithValue("@LabChID", lt.LabChID);
         cmd.ExecuteNonQuery();
     }
     conn.Close();
     return lt.LabChID;
 }
示例#4
0
 public List<LabChType> GetLabChTypes()
 {
     List<LabChType> lts = new List<LabChType>();
     InitCommand();
     cmd.CommandText = "select * from ( LabChType_tb left join LabType_tb on LabChType_tb.LabSupType= LabType_tb.LabTypeID )";
     dr = cmd.ExecuteReader();
     while (dr.Read())
     {
         LabChType lt = new LabChType();
         lt.LabChID = Convert.ToInt32(dr["LabChID"]);
         lt.LabChName = dr["LabChName"].ToString();
         lt.LabSupType = Convert.ToInt32(dr["LabSupType"]);
         lt.LabSupName = dr["LabTypeName"].ToString();
         lts.Add(lt);
     }
        // lts.Find(delegate(LabChType lct) { return lct.LabChID == 1; });
     dr.Close();
     conn.Close();
     return lts;
 }
示例#5
0
 public LabChType GetLabChType(int id)
 {
     LabChType lt = new LabChType();
     InitCommand();
     cmd.CommandText = "select * from ( LabChType_tb left join LabType_tb on LabChType_tb.LabSupType= LabType_tb.LabTypeID ) where LabChType_tb.LabChID = @id";
     cmd.Parameters.AddWithValue("@id", id);
     dr = cmd.ExecuteReader();
     if (dr.Read())
     {
         lt.LabChID = Convert.ToInt32(dr["LabChID"]);
         lt.LabChName = dr["LabChName"].ToString();
         lt.LabSupType = Convert.ToInt32(dr["LabSupType"]);
         lt.LabSupName = dr["LabTypeName"].ToString();
     }
     dr.Close();
     conn.Close();
     return lt;
 }