Exemplo n.º 1
0
        private void btnNew_Click(object sender, RoutedEventArgs e)
        {
            var x = this.DataContext as Impeding;

            if (x.ID != null)
            {
                var oi = new Impeding();
                oi.OrphanID      = OrphanID;
                this.DataContext = oi;
            }
        }
Exemplo n.º 2
0
        public static List <Impeding> GetImpedingAllByOrphanID(int?id)
        {
            var           ois = new List <Impeding>();
            SqlConnection con = new SqlConnection(BaseDataBase.ConnectionString);
            SqlCommand    com = new SqlCommand("sp_GetImpedingAllByOrphanID", con);

            com.CommandType = System.Data.CommandType.StoredProcedure;
            SqlParameter pr = new SqlParameter("@OrphanID", id);

            com.Parameters.Add(pr);
            try
            {
                con.Open();
                SqlDataReader rd = com.ExecuteReader();
                while (rd.Read())
                {
                    Impeding x = new Impeding();
                    if (!(rd["ID"] is DBNull))
                    {
                        x.ID = System.Int32.Parse(rd["ID"].ToString());
                    }
                    x.impedingType          = rd["impedingType"].ToString();
                    x.impedingDegree        = rd["impedingDegree"].ToString();
                    x.impedingIdentityID    = rd["impedingIdentityID"].ToString();
                    x.impedingIdentityImage = rd["impedingIdentityImage"].ToString();
                    x.RelatedAssociation    = rd["RelatedAssociation"].ToString();
                    x.Notes = rd["Notes"].ToString();
                    if (!(rd["ImpedingDate"] is DBNull))
                    {
                        x.ImpedingDate = DateTime.Parse(rd["ImpedingDate"].ToString());
                    }
                    if (!(rd["OrphanID"] is DBNull))
                    {
                        x.OrphanID = System.Int32.Parse(rd["OrphanID"].ToString());
                    }

                    ois.Add(x);
                }
                rd.Close();
            }
            catch
            {
                ois = new List <Impeding>();
            }
            finally
            {
                con.Close();
            }
            return(ois);
        }
Exemplo n.º 3
0
        public bool UpdateData()
        {
            impedingIdentityImage = BaseDataBase.CheckImageFile(impedingidentityimage, Impeding.GetImpedingByID(ID).impedingIdentityImage);

            return(BaseDataBase._StoredProcedure("sp_Updateimpeding"
                                                 , new SqlParameter("@ID", ID)
                                                 , new SqlParameter("@impedingType", impedingType)
                                                 , new SqlParameter("@impedingDegree", impedingDegree)
                                                 , new SqlParameter("@impedingIdentityID", impedingIdentityID)
                                                 , new SqlParameter("@impedingIdentityImage", impedingIdentityImage)
                                                 , new SqlParameter("@RelatedAssociation", RelatedAssociation)
                                                 , new SqlParameter("@ImpedingDate", ImpedingDate)
                                                 , new SqlParameter("@Notes", Notes)
                                                 , new SqlParameter("@OrphanID", OrphanID)));
        }