protected RealType CaptureData()
    {
        RealType obj = new RealType();
        obj.RealType_ID = txtID.Text.Trim();
        obj.RealType_Name = txtName.Text.Trim();

        return obj;
    }
Esempio n. 2
0
 protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
 {
     RealTypeManager mgr = new RealTypeManager();
     RealType obj = new RealType();
     obj.RealType_ID = (GridView1.SelectedDataKey.Value).ToString();
     obj = mgr.selectRealType(obj);
     AddEditTypeControl1.populateControls(obj);
     MultiView1.ActiveViewIndex = 1;
 }
 public void populateControls(RealType obj)
 {
     Session.Remove("Flag");
     Session.Add("Flag", "Edit");
     btnOpt.Text = "Modify Agreement";
     btnDelete.Enabled = true;
     txtID.Text = obj.RealType_ID;
     txtName.Text = obj.RealType_Name;
 }
Esempio n. 4
0
 public RealType selectRealType(RealType obj)
 {
     try
     {
         IRealTypeSvc svc = (IRealTypeSvc)this.getService(typeof(IRealTypeSvc).Name);
         return svc.selectRealType(obj);
     }
     catch (ServiceLoadException ex)
     {
         throw ex;
     }
 }
Esempio n. 5
0
        public Boolean objectDataEquals(RealType obj)
        {
            if (!(this.RealType_ID.Equals(obj.RealType_ID)))
            {
                return false;
            }
            if (!(this.RealType_Name.Equals(obj.RealType_Name)))
            {
                return false;
            }

            return true;
        }
 protected void btnDelete_Click(object sender, EventArgs e)
 {
     try
     {
         RealTypeManager mgr = new RealTypeManager();
         RealType obj = new RealType();
         obj.RealType_ID = txtID.Text.Trim();
         lblError.Text = CustomErrors.CHANGES_ACCEDTED_STATUS + mgr.deleteRealType(obj);
         ClearControls();
     }
     catch (Exception ex)
     {
         lblError.Text = ex.Message;
     }
 }
Esempio n. 7
0
        public bool insertRealType(RealType obj)
        {
            using (RealReportContext db = new RealReportContext())
            {
                try
                {
                    db.RealTypes.Add(obj);
                    db.SaveChanges();
                    return true;
                }
                catch (Exception ex)
                {
                    return false;
                }

            }
        }
Esempio n. 8
0
 public Boolean updateRealType(RealType obj)
 {
     try
     {
         IRealTypeSvc svc = (IRealTypeSvc)this.getService(typeof(IRealTypeSvc).Name);
         if (obj.isDataEntered())
         {
             return svc.updateRealType(obj);
         }
         else
         {
             throw new BusinessValidationException(CustomErrors.REQUIRED_FIELD);
         }
     }
     catch (ServiceLoadException ex)
     {
         throw ex;
     }
 }
Esempio n. 9
0
        public bool deleteRealType(RealType obj)
        {
            using (RealReportContext db = new RealReportContext())
            {
                try
                {
                    IQueryable<RealType> RealTypeList = from realType in db.RealTypes
                                                        where realType.RealType_ID == obj.RealType_ID
                                                        select realType;

                    if ((RealTypeList.ToArray().Length > 0))
                    {
                        db.RealTypes.Remove(RealTypeList.ToArray()[0]);

                        #region Database Submission

                        try
                        {
                            db.SaveChanges();
                            return true;
                        }
                        catch (Exception ex)
                        {
                            return false;
                        }

                        #endregion
                    }
                    else
                    {
                        return false;
                    }
                }
                catch (Exception ex)
                {
                    return false;
                }
            }
        }
Esempio n. 10
0
        public RealType selectRealType(RealType obj)
        {
            RealReportContext db = new RealReportContext();

            try
            {
                IQueryable<RealType> RealTypeList = from RealType in db.RealTypes
                                                where RealType.RealType_ID == obj.RealType_ID
                                                select RealType;

                return (RealTypeList.ToList())[0];
            }
            catch (Exception ex)
            {
                return null;
            }
        }
Esempio n. 11
0
        public bool updateRealType(RealType obj)
        {
            using (RealReportContext db = new RealReportContext())
            {
                try
                {

                    IQueryable<RealType> RealTypeList = from RealType in db.RealTypes
                                                    where RealType.RealType_ID == obj.RealType_ID
                                                    select RealType;

                    if ((RealTypeList.ToArray()).Length > 0)
                    {
                        foreach (RealType RealType in RealTypeList)
                        {
                            RealType.RealType_Name = obj.RealType_Name;
                        }

                        #region Database Submission with Rollback

                        try
                        {
                            db.SaveChanges();
                            return true;
                        }
                        catch (Exception ex)
                        {
                            return false;
                        }
                        #endregion
                    }
                    else
                    {
                        return false;
                    }
                }
                catch (Exception ex)
                {
                    return false;
                }

            }
        }