Exemplo n.º 1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     DataModel dm = new DataModel();
     lo = new LabOrder();
     if (Request.Params["week"] == null || Request.Params["week"] == "")
     {
         dm.ReturnJsonMsg(Response, 0, "未知周次!");
     }
     if (Request.Params["cls"] == null || Request.Params["cls"] == "")
     {
         dm.ReturnJsonMsg(Response, 0, "未知节次!");
     }
     if (Request.Params["wd"] == null || Request.Params["wd"] == "")
     {
         dm.ReturnJsonMsg(Response, 0, "未知工作日!");
     }
     if (Request.Params["lab"] == null || Request.Params["lab"] == "")
     {
         dm.ReturnJsonMsg(Response, 0, "未知实验室!");
     }
     lo.OrderCls = Convert.ToInt32(Request.Params["cls"]);
     lo.OrderWeek = Convert.ToInt32(Request.Params["week"]);
     lo.OrderWeekday = Convert.ToInt32(Request.Params["wd"]);
     //用户信息
     luser = dm.GetUser(Convert.ToInt32(Session["lxyLabUserID"]));
     //实验室信息
     lab = dm.GetLab(Convert.ToInt32(Request.Params["lab"]));
 }
Exemplo n.º 2
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Request.Params["id"] != null && Request.Params["id"].Trim() != "")
     {
         DataModel dm = new DataModel();
         int id = Convert.ToInt32(Request.Params["id"]);
         lab = dm.GetLab(id);
     }
 }
Exemplo n.º 3
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Request.Params["id"] == null || Request.Params["id"].Trim() == "")
     {
         Response.Write("未指定的ID");
         Response.End();
     }
     else
     {
         DataModel dm=new DataModel();
         int id = Convert.ToInt32(Request.Params["id"].Trim());
         lab = dm.GetLab(id);
     }
 }
Exemplo n.º 4
0
 public void ProcessRequest(HttpContext context)
 {
     DataModel dm = new DataModel();
     Lab  lt = new Lab ();
     lt.LabID = Convert.ToInt32(context.Request.Params["LabID"]);
     lt.LabAddr = context.Request.Params["LabAddr"];
     lt.LabName = context.Request.Params["LabName"];
     lt.LabInfo = context.Request.Params["LabInfo"];
     lt.LabAmount = Convert.ToInt32( context.Request.Params["LabAmount"]);
     lt.LabType = Convert.ToInt32(context.Request.Params["LabType"]);
     lt.LabDefault =false;
     lt.LabAdmin = 1;
     dm.SaveLab(lt);
     dm.ReturnJsonMsg(context.Response, 1, "保存成功!", lt.LabID);
 }
Exemplo n.º 5
0
        public int SaveLab(Lab lab)
        {
            InitCommand();
            if (lab.LabID == 0)
            {
                //Insert new user
                cmd.CommandText = "INSERT INTO Lab_tb (LabName,LabAdmin,LabAddr,LabInfo,LabAmount,LabType,LabDefault) VALUES (@LabName,@LabAdmin,@LabAddr,@LabInfo,@LabAmount,@LabType,@LabDefault)";
                cmd.Parameters.Clear();
                cmd.Parameters.AddWithValue("@LabName", lab.LabName);
                cmd.Parameters.AddWithValue("@LabAdmin", lab.LabAdmin);
                cmd.Parameters.AddWithValue("@LabAddr", lab.LabAddr);
                cmd.Parameters.AddWithValue("@LabInfo", lab.LabInfo);
                cmd.Parameters.AddWithValue("@LabAmount", lab.LabAmount);
                cmd.Parameters.AddWithValue("@LabType", lab.LabType);
                cmd.Parameters.AddWithValue("@LabDefault", lab.LabDefault);
                cmd.ExecuteNonQuery();
                cmd.CommandText = "SELECT @@Identity ";
                lab.LabID = (int)cmd.ExecuteScalar();
            }
            else
            {
                cmd.CommandText = "UPDATE Lab_tb SET  " +
                " LabName=@LabName,LabAdmin=@LabAdmin ,LabAddr=@LabAddr,LabInfo=@LabInfo,LabAmount=@LabAmount,LabType=@LabType,LabDefault=@LabDefault  where LabID=@LabID";
                cmd.Parameters.Clear();
                cmd.Parameters.AddWithValue("@LabName", lab.LabName);
                cmd.Parameters.AddWithValue("@LabAdmin", lab.LabAdmin);
                cmd.Parameters.AddWithValue("@LabAddr", lab.LabAddr);
                cmd.Parameters.AddWithValue("@LabInfo", lab.LabInfo);
                cmd.Parameters.AddWithValue("@LabAmount", lab.LabAmount);
                cmd.Parameters.AddWithValue("@LabType", lab.LabType);
                cmd.Parameters.AddWithValue("@LabDefault", lab.LabDefault);
                cmd.Parameters.AddWithValue("@LabID", lab.LabID);
                cmd.ExecuteNonQuery();
            }
            conn.Close();

            return lab.LabID;
        }
Exemplo n.º 6
0
 public List<Lab> GetLabs()
 {
     List<Lab> labs = new List<Lab>();
     InitCommand();
     cmd.CommandText = "select * from (( Lab_tb left join  LabChType_tb on Lab_tb.LabType = LabChType_tb.LabChID ) left join  LabType_tb on LabChType_tb.LabSupType= LabType_tb.LabTypeID ) ";
     dr = cmd.ExecuteReader();
     while (dr.Read())
     {
         Lab lab = new Lab();
         lab.LabID = Convert.ToInt32(dr["LabID"]);
         lab.LabAddr = dr["LabAddr"].ToString();
         lab.LabAdmin = Convert.ToInt32(dr["LabAdmin"]);
         lab.LabAmount = Convert.ToInt32(dr["LabAmount"]);
         lab.LabDefault = Convert.ToBoolean(dr["LabDefault"]);
         lab.LabInfo = dr["LabInfo"].ToString();
         lab.LabName = dr["LabName"].ToString();
         lab.LabType = Convert.ToInt32(dr["LabType"]);
         lab.LabChName = dr["LabChName"].ToString();
         lab.LabTypeName = dr["LabTypeName"].ToString();
         labs.Add(lab);
     }
     return labs;
 }
Exemplo n.º 7
0
        /// <summary>
        /// 获取默认的实验室
        /// </summary>
        /// <returns></returns>
        public Lab GetLab()
        {
            Lab lab = new Lab();
            InitCommand();
            string cmdText = "select * from ((( Lab_tb left join LabChType_tb on Lab_tb.LabType=LabChType_tb.LabChID) left join LabType_tb on LabChType_tb.LabSupType=LabType_tb.LabTypeID) left join Admin_tb on Lab_tb.LabAdmin=Admin_tb.AdminID) where LabDefault";
            cmd.CommandText = cmdText;
            dr = cmd.ExecuteReader();
            if (dr.Read())
            {

                lab.LabAddr = dr["LabAddr"].ToString();
                lab.LabAdmin = Convert.ToInt32(dr["LabAdmin"]);

                lab.LabAmount = Convert.ToInt32(dr["LabAmount"]);
                lab.LabDefault = Convert.ToBoolean(dr["LabDefault"]);
                lab.LabID = Convert.ToInt32(dr["LabID"]);

                lab.LabInfo = dr["LabInfo"].ToString();
                lab.LabType = Convert.ToInt32(dr["LabType"]);

                lab.LabName = dr["LabName"].ToString();
                lab.LabChName = dr["LabChName"].ToString();
                lab.LabTypeName = dr["LabTypeName"].ToString();
                lab.LabSupType = Convert.ToInt32(dr["LabTypeID"]);
            }
            conn.Close();
            return lab;
        }