示例#1
0
 void AddParametersToSqlCommand(WPDevice ent, ref SqlCommand sc)
 {
     sc.Parameters.Add("@fn", ent.FN);
     sc.Parameters.Add("@title", ent.Title);
     sc.Parameters.Add("@typeid", ent.TypeID);
     sc.Parameters.Add("@description", ent.Description);
 }
示例#2
0
        public WPDevice createEntityFromReader(SqlDataReader dr)
        {
            WPDevice ent = new WPDevice();

            if (!dr.IsDBNull(dr.GetOrdinal("ID")))
            {
                ent.ID = Convert.ToInt32(dr["ID"]);
            }

            if (!dr.IsDBNull(dr.GetOrdinal("WPTypeDeviceID")))
            {
                ent.TypeID = Convert.ToInt32(dr["WPTypeDeviceID"]);
            }

            if (!dr.IsDBNull(dr.GetOrdinal("Title")))
            {
                ent.Title = dr["Title"].ToString();
            }

            if (!dr.IsDBNull(dr.GetOrdinal("FN")))
            {
                ent.FN = dr["FN"].ToString();
            }

            if (!dr.IsDBNull(dr.GetOrdinal("Description")))
            {
                ent.Description = dr["Description"].ToString();
            }


            return(ent);
        }
示例#3
0
 private void UninstallApplication(WPDevice device, Guid appGUID)
 {
     if (device.IsApplicationInstalled(appGUID))
     {
         m_addText.Invoke("(Done)");
         m_addText.Invoke("Uninstalling previous version...");
         device.UninstallApplication(appGUID);
     }
 }
示例#4
0
        public int Create(WPDevice ent)
        {
            int         createdid = 0;
            WPDeviceDAO entDAO    = new WPDeviceDAO();

            sc             = new SqlCommand("CreateWPDevice");
            sc.CommandType = CommandType.StoredProcedure;
            addParameters(ent);
            createdid = entDAO.createEntity(sc);
            return(createdid);
        }
示例#5
0
        private WPDevice CollectDevice()
        {
            WPDevice wpd = new WPDevice();

            wpd.Title       = tbTitle.Text.Trim();
            wpd.FN          = tbFN.Text.Trim();
            wpd.Description = tbDescription.Text.Trim();
            wpd.TypeID      = Utilities.ConvertToInt(ddlTypeDevice.SelectedValue);

            return(wpd);
        }
示例#6
0
        public override UniversalEntity createEntity()
        {
            UniversalEntity ue = new UniversalEntity();

            while (dr.Read())
            {
                WPDevice ent = new WPDevice();
                ent = createEntityFromReader(dr);
                ue.Add(ent);
            }
            return(ue);
        }
示例#7
0
        public int CreateWithAssign(WPDevice ent, int wpid, int userID)
        {
            int         createdid = 0;
            WPDeviceDAO entDAO    = new WPDeviceDAO();

            sc             = new SqlCommand("CreateWPDeviceWithAssign");
            sc.CommandType = CommandType.StoredProcedure;
            addParameters(ent);
            sc.Parameters.Add("@wpid", wpid);
            sc.Parameters.Add("@UserID", userID);
            createdid = entDAO.createEntity(sc);
            return(createdid);
        }
示例#8
0
        protected void lbSave_Click(object sender, EventArgs e)
        {
            WPDevice   wpd   = CollectDevice();
            WPDeviceDO wpddo = new WPDeviceDO();
            int        rez   = wpddo.Create(wpd);

            if (rez > 0)
            {
                nlDevice.SetCleanNotification("Прибор успешно добавлен");
                ClearForm();
            }
            else
            {
                nlDevice.SetDirtyNotification("Придобавлении произошла ошибка");
            }
        }
示例#9
0
 protected void lbSave_Click(object sender, EventArgs e)
 {
     if (Session["WPID"] != null)
     {
         WPDevice   wpd   = CollectDevice();
         WPDeviceDO wpddo = new WPDeviceDO();
         int        rez   = wpddo.CreateWithAssign(wpd, Utilities.ConvertToInt(Session["WPID"].ToString()), 1);
         if (rez > 0)
         {
             //lDevice.SetCleanNotification("Прибор успешно добавлен");
             ClearForm();
             //Response.Write(this.Parent.ToString());
             (this.Parent.Parent.Parent.FindControl("radgrid") as RadGrid).Rebind();
         }
         else
         {
             //nlDevice.SetDirtyNotification("Придобавлении произошла ошибка");
         }
     }
 }
示例#10
0
 void addParameters(WPDevice ent)
 {
     AddParametersToSqlCommand(ent, ref sc);
 }