/// <summary>
        /// Probably better use method with parameter has type Service
        /// </summary>
        /// <param name="item"></param>
        /// <returns></returns>
        public bool Delete(ServiceSpecialization item)
        {
            bool result = false;
            using (StoredProcedure sp = new StoredProcedure("ServiceSpecialization_DeleteByService"))
            {
                sp.Params.Add("@ServiceID", System.Data.SqlDbType.Int).Value = item.ServiceID;

                result = sp.ExecuteNonQuery() > 0;
            }
            return result;
        }
 public int Add(ServiceSpecialization item)
 {
     int newID = 0;
     using (StoredProcedure sp = new StoredProcedure("ServiceSpecialization_AddSpecialization"))
     {
         sp.Params.Add("@ServiceID", System.Data.SqlDbType.NChar).Value = item.ServiceID;
         sp.Params.Add("@SpecializationID", System.Data.SqlDbType.NVarChar).Value = item.SpecializationID;
         newID = Convert.ToInt32(sp.ExecuteScalar());
     }
     return newID;
 }
Ejemplo n.º 3
0
        private void Save()
        {
            foreach (RepeaterItem item in RepeaterLang.Items)
            {
                if (item.ItemType == ListItemType.Item || item.ItemType == ListItemType.AlternatingItem)
                {
                    ServiceEditor editor = (ServiceEditor)item.FindControl("editor");
                    editor.CityID = Int32.Parse(ddlCity.SelectedValue);
                    editor.RegionID = Int32.Parse(ddlRegion.SelectedValue);
                    editor.ServiceStatus = Int32.Parse(ddlStatus.SelectedValue);
                    editor.Telephone = txtTelephone.Text;
                    editor.Url = txtUrl.Text;
                    editor.SaveItem();
                }
            }
            ServiceSpecializations ps = new ServiceSpecializations();
            ps.Delete(this.GroupID);
            for (int i = 0; i < chbSpecialization.Items.Count; i++)
            {

                if(chbSpecialization.Items[i].Selected)
                {
                    ServiceSpecialization p = new ServiceSpecialization();
                    p.ServiceID = this.GroupID;
                    p.SpecializationID = Int32.Parse(chbSpecialization.Items[i].Value);
                    ps.Add(p);
                }

            }

            GridViewItemsList.DataBind();
        }