Example #1
0
        //添加
        protected void ImageButton1_Click(object sender, ImageClickEventArgs e)
        {
            Entity.MechanicalEntity MechanicalEntity = new Entity.MechanicalEntity();
            Entity.UserEntity       parent           = new Entity.UserEntity();
            Entity.ContactEntity    contactEnitty    = new Entity.ContactEntity();
            if (Request["schClassgcid"] == null || string.IsNullOrEmpty(Request["schClassgcid"].ToString()))
            {
                FinalMessage("班级无效!", "Mechanical_Add.aspx", 0);
                return;
            }
            //学生实体相关信息保存
            MechanicalEntity.ClassName = "";
            MechanicalEntity.Gid       = int.Parse(Request["schClassgcid"]);
            MechanicalEntity.MechIMEI  = this.MechIMEI.Text;
            MechanicalEntity.MechName  = this.MechName.Text;
            MechanicalEntity.MechPhone = this.MechPhone.Text;
            //保存数据
            try
            {
                new Daiv_OA.BLL.MechanicalBLL().Add(MechanicalEntity);
            }
            catch (Exception ex)
            {
                FinalMessage("操作失败!" + ex.Message, "Mechanical_Add.aspx", 1);
                return;
            }

            FinalMessage("操作成功", "Mechanical_List.aspx", 0);
        }
 //更新
 protected void ImageButton1_Click(object sender, ImageClickEventArgs e)
 {
     Entity.MechanicalEntity   model         = new Entity.MechanicalEntity();
     Daiv_OA.BLL.ContactBLL    contactBll    = new Daiv_OA.BLL.ContactBLL();
     Daiv_OA.BLL.MechanicalBLL mechanicalBll = new Daiv_OA.BLL.MechanicalBLL();
     if (Request["schClassgcid"] == null || string.IsNullOrEmpty(Request["schClassgcid"].ToString()))
     {
         FinalMessage("班级无效!", "Mechanical_Edit.aspx?id=" + q("id"), 0);
         return;
     }
     model           = mechanicalBll.GetEntity(Str2Int(q("id"), 0));
     model.ClassName = "";
     model.Gid       = int.Parse(Request["schClassgcid"]);
     model.MechIMEI  = this.MechIMEI.Text;
     model.MechName  = this.MechName.Text;
     model.MechPhone = this.MechPhone.Text;
     //检查是否已经存在的班级
     Entity.MechanicalEntity tempEntity = mechanicalBll.GetEntityByImeiAndGid(model.MechIMEI, model.Gid);
     if (tempEntity != null && tempEntity.ID != model.ID)
     {
         FinalMessage("此班级已经存在此设置号,请使用其他的设备号!", "Mechanical_Edit.aspx?id=" + q("id"), 0);
         return;
     }
     mechanicalBll.Update(model);
     logHelper.logInfo("修改设备成功!操作人:" + UserId);
     FinalMessage("操作成功", "Mechanical_List.aspx", 0);
 }
Example #3
0
        //删除数据
        protected void lbDel_Click(object sender, CommandEventArgs e)
        {
            User_Load("mech-list");
            string oname = Getoname();

            Daiv_OA.BLL.MechanicalBLL MechanicalBll = new Daiv_OA.BLL.MechanicalBLL();
            Daiv_OA.BLL.UserBLL       userBll       = new BLL.UserBLL();
            int sid = Convert.ToInt32(e.CommandArgument);

            Entity.MechanicalEntity MechanicalEntity = MechanicalBll.GetEntity(sid);
            MechanicalBll.Delete(sid);
            logHelper.logInfo("删除设备成功!操作人:" + oname);
            string stuStr = Newtonsoft.Json.JsonConvert.SerializeObject(MechanicalEntity);

            logHelper.logInfo("删除设备:" + stuStr);
            Adminlogadd(oname);
            Bind();
        }
Example #4
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public void Update(Entity.MechanicalEntity model)
 {
     dal.Update(model);
 }
Example #5
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int Add(Entity.MechanicalEntity model)
 {
     return(dal.Add(model));
 }