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); }
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); }
private void UninstallApplication(WPDevice device, Guid appGUID) { if (device.IsApplicationInstalled(appGUID)) { m_addText.Invoke("(Done)"); m_addText.Invoke("Uninstalling previous version..."); device.UninstallApplication(appGUID); } }
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); }
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); }
public override UniversalEntity createEntity() { UniversalEntity ue = new UniversalEntity(); while (dr.Read()) { WPDevice ent = new WPDevice(); ent = createEntityFromReader(dr); ue.Add(ent); } return(ue); }
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); }
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("Придобавлении произошла ошибка"); } }
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("Придобавлении произошла ошибка"); } } }
void addParameters(WPDevice ent) { AddParametersToSqlCommand(ent, ref sc); }