Esempio n. 1
0
        public string Add(Model.Geospec geo)
        {
            string str = " INSERT INTO [FAMIS].[dbo].[Geospec] ([currency],[decimal_symbol],[date_format],[region_id],[country_id])" + Environment.NewLine;
            str += " VALUES ('" +
                geo.Currency + "','" +
                geo.Decimal_symbol + "', '" +
                geo.Date_format + "'," +
                geo.Region_id + "," +
                geo.Country_id + ")";

            try
            {
                SqlCommand scmd = new SqlCommand(str, db.Db());

                int iret = scmd.ExecuteNonQuery();
                return iret.ToString() + " Record successfully saved";
            }
            catch (SqlException ex)
            {
                return "Error saving the record of: " + geo.Geospec_id + Environment.NewLine + " Erro: " + ex.Message.ToString();
                throw;
            }
            finally
            {

            }
        }
 public static int OrganAdd(Model.Organizational Organ)
 {
     SqlParameter[] pars = new SqlParameter[] { new SqlParameter("@Name", SqlDbType.VarChar, 50), new SqlParameter("@PID", SqlDbType.VarChar, 6) };
     pars[0].Value = Organ.Name;
     pars[1].Value = Organ.PID;
     return SqlHelper.ExecuteProcess("pro_Organizational_Add", pars);
 }
Esempio n. 3
0
File: Client.cs Progetto: ecmr/FAMIS
        public Model.Client Select(Model.Client Client)
        {
            Model.Client cliente;

            try
            {
                SqlCommand cmd = new SqlCommand("Select * From dbo.[client] Where client_id= " + Client.Client_id, db.Db());
                SqlDataReader dr = cmd.ExecuteReader(); //CommandBehavior.CloseConnection

                if (dr.Read())
                {
                    cliente = new Model.Client();
                    cliente.Client_id = Convert.ToInt32(dr["client_id"].ToString());
                    cliente.Local_name = dr["local_name"].ToString();
                    cliente.Intl_name = dr["intl_name"].ToString();
                    cliente.Code = dr["code"].ToString();
                    cliente.Active = Convert.ToInt32(dr["active"]);
                    cliente.Multinational = Convert.ToInt32(dr["multinational"].ToString());
                    return cliente;
                }
                else
                {
                    return null;
                }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message.ToString());
            }
        }
Esempio n. 4
0
 /// <summary>
 /// 新增
 /// </summary>
 /// <param name="model">要往数据库中的添加的实体对象</param>
 /// <returns>结果</returns>
 public int Add(Model.Product_Info  model)
 {
     int result = 0;
     try
     {
         StringBuilder strSql = new StringBuilder();
         strSql.Append(@"insert into [Product_Info]( ");
         strSql.Append(@"[JK_Titile],[jk_DateTime],[JK_Product_id],[JK_Product_img_src],[JK_Product_name],[JK_Product_datetime]) values (@jK_Titile,@jk_DateTime,@jK_Product_id,@jK_Product_img_src,@jK_Product_name,@jK_Product_datetime)");
         strSql.Append(";select @@IDENTITY");
         SqlParameter[] parameters = new SqlParameter[] {
             new SqlParameter("@jK_Titile", SqlDbType.NVarChar,50),
             new SqlParameter("@jk_DateTime", SqlDbType.DateTime,8),
             new SqlParameter("@jK_Product_id", SqlDbType.Int,4),
             new SqlParameter("@jK_Product_img_src", SqlDbType.NVarChar,80),
             new SqlParameter("@jK_Product_name", SqlDbType.NChar,10),
             new SqlParameter("@jK_Product_datetime", SqlDbType.DateTime,8)
             };
         parameters[0].Value = model.JK_Titile;
         parameters[1].Value = model.Jk_DateTime;
         parameters[2].Value = model.JK_Product_id;
         parameters[3].Value = model.JK_Product_img_src;
         parameters[4].Value = model.JK_Product_name;
         parameters[5].Value = model.JK_Product_datetime;
         result = Convert.ToInt32(DAL.SqlDataHelper.GetScalar(strSql.ToString(), parameters));
     }
     catch (Exception)
     {
     }
     return result;
 }
Esempio n. 5
0
 /// <summary>
 /// 新增
 /// </summary>
 /// <param name="model">要往数据库中的添加的实体对象</param>
 /// <returns>结果</returns>
 public int Add(Model.Number_Card  model)
 {
     int result = 0;
     try
     {
         StringBuilder strSql = new StringBuilder();
         strSql.Append(@"insert into [Number_Card]( ");
         strSql.Append(@"[JK_Number_Card],[JK_Number_Card_Id],[JK_NumberCard_DateTime],[JK_Number_Count],[JK_Member_id]) values (@jK_Number_Card,@jK_Number_Card_Id,@jK_NumberCard_DateTime,@jK_Number_Count,@jK_Member_id)");
         strSql.Append(";select @@IDENTITY");
         SqlParameter[] parameters = new SqlParameter[] {
             new SqlParameter("@jK_Number_Card", SqlDbType.NVarChar,50),
             new SqlParameter("@jK_Number_Card_Id", SqlDbType.Int,4),
             new SqlParameter("@jK_NumberCard_DateTime", SqlDbType.DateTime,8),
             new SqlParameter("@jK_Number_Count", SqlDbType.Int,4),
             new SqlParameter("@jK_Member_id", SqlDbType.Int,4)
             };
         parameters[0].Value = model.JK_Number_Card;
         parameters[1].Value = model.JK_Number_Card_Id;
         parameters[2].Value = model.JK_NumberCard_DateTime;
         parameters[3].Value = model.JK_Number_Count;
         parameters[4].Value = model.JK_Member_id;
         result = Convert.ToInt32(DAL.SqlDataHelper.GetScalar(strSql.ToString(), parameters));
     }
     catch (Exception)
     {
     }
     return result;
 }
        public int CreateUser(Model.User user)
        {
            var newUser = Container.Users.Add(new User { UserName = user.UserName });
            Container.SaveChanges();

            return newUser.UserId;
        }
Esempio n. 7
0
File: Agency.cs Progetto: ecmr/FAMIS
        public Model.Agency Select(Model.Agency agency)
        {
            Model.Agency ag;

            try
            {
                SqlCommand cmd = new SqlCommand("Select * From dbo.[Agency] Where agency_id=" + agency.Agency_id, db.Db());

                using(SqlDataReader dr = cmd.ExecuteReader())
                {
                    ag = new Model.Agency();

                    if (dr.Read())
                    {
                        if (!dr.IsDBNull(0))
                            ag.Agency_id = dr.GetInt32(0);
                        if (!dr.IsDBNull(1))
                            ag.Name = dr.GetString(1);
                    }
                    return ag;
                }
            }
            catch (Exception)
            {
                return null;
            }
        }
Esempio n. 8
0
 /// <summary>
 /// 新增
 /// </summary>
 /// <param name="model">要往数据库中的添加的实体对象</param>
 /// <returns>结果</returns>
 public int Add(Model.Applyforresale  model)
 {
     int result = 0;
     try
     {
         StringBuilder strSql = new StringBuilder();
         strSql.Append(@"insert into [Applyforresale]( ");
         strSql.Append(@"[JK_Applyforresale],[JK_Applyforresale_DateTime],[JK_Applyforresale_Member_Id],[JK_Applforresale_Member_name]) values (@jK_Applyforresale,@jK_Applyforresale_DateTime,@jK_Applyforresale_Member_Id,@jK_Applforresale_Member_name)");
         strSql.Append(";select @@IDENTITY");
         SqlParameter[] parameters = new SqlParameter[] {
             new SqlParameter("@jK_Applyforresale", SqlDbType.NChar,10),
             new SqlParameter("@jK_Applyforresale_DateTime", SqlDbType.DateTime,8),
             new SqlParameter("@jK_Applyforresale_Member_Id", SqlDbType.Int,4),
             new SqlParameter("@jK_Applforresale_Member_name", SqlDbType.NVarChar,50)
             };
         parameters[0].Value = model.JK_Applyforresale;
         parameters[1].Value = model.JK_Applyforresale_DateTime;
         parameters[2].Value = model.JK_Applyforresale_Member_Id;
         parameters[3].Value = model.JK_Applforresale_Member_name;
         result = Convert.ToInt32(DAL.SqlDataHelper.GetScalar(strSql.ToString(), parameters));
     }
     catch (Exception)
     {
     }
     return result;
 }
Esempio n. 9
0
        /// <summary>
        /// 添加部门
        /// </summary>
        /// <param name="model">部门对象</param>
        /// <returns>结果对象</returns>
        public Model.ResultModel Add(Model.T_Department dept)
        {
            ResultModel rm = new ResultModel();
            Model.QueryDept qd = new QueryDept()
            {
                DeptName = dept.DeptName
            };
            var list = dal.Get(qd);

            if (list.Count > 0)
            {
                rm.Result = false;
                rm.Message = "部门名称重复";
            }
            else
            {
                if (dal.Add(dept))
                {
                    rm.Result = true;
                    rm.Message = "部门添加成功";
                }
                else
                {
                    rm.Result = false;
                    rm.Message = "部门添加失败";
                }
            }
            return rm;
        }
        private void popularFields(int pGetID = 0)
        {
            mdc = new Model.Model();
            try
            {
                if (pGetID > 0)
                {

                    Materias_Edit materia = mdc.Materia.First(mat => mat.idMateria == pGetID);

                    tbCodMateria.Text = pGetID.ToString();
                    tbNome.Text = materia.tbNome.Text.Trim();
                    tbDescricao.Text = materia.tbDescricao.Text.Trim();

                }
                else
                {
                    Response.Redirect("Materias.aspx");
                }
            }
            catch (Exception)
            {

            }
            finally
            {
                mdc.Dispose();
            }


        }
Esempio n. 11
0
        /// <summary>
        /// 添加代表
        /// </summary>
        /// <param name="behalf">代表对象</param>
        /// <returns>结果对象</returns>
        public Model.ResultModel Add(Model.T_Behalf behalf)
        {
            ResultModel rm = new ResultModel();
            Model.QueryBehalf qb = new QueryBehalf()
            {
                Phone = behalf.Phone
            };

            var list = dal.Get(qb);
            if (list.Count > 0)
            {
                rm.Result = false;
                rm.Message = "代表手机号不能重复";
            }
            else
            {
                if (dal.Add(behalf))
                {
                    rm.Result = true;
                    rm.Message = "代表添加成功";
                }
                else
                {
                    rm.Result = false;
                    rm.Message = "代表添加失败";
                }
            }
            return rm;
        }
Esempio n. 12
0
        public string Add(Model.Position Pos)
        {
            string str = " INSERT INTO [FAMIS].[dbo].[Position] " +
                   " ([code] " +
                   " ,[department_id] " +
                   " ,[name] " +
                   " ,[salary_research]) " +
                   " VALUES ('" +
                   Pos.Code + "', " +
                   Pos.Department_id + ", '" +
                   Pos.Name + "', " +
                   Pos.Salary_research + ")";

            try
            {
                SqlCommand scmd = new SqlCommand(str, db.Db());

                int iret = scmd.ExecuteNonQuery();
                return iret.ToString() + " Record successfully saved";
            }
            catch (SqlException ex)
            {
                return "Error saving the record of: " + Pos.Name.ToString() + Environment.NewLine + " Erro: " + ex.Message.ToString();
                throw;
            }
            finally
            {

            }
        }
Esempio n. 13
0
        /// <summary>
        /// Parses a directory, looking for every config.cpp file
        /// </summary>
        /// <param name="directoryPath">The path of the folder</param>
        /// <param name="merge">Indicates whether the <see cref="Model"/>s will be merged into one.</param>
        /// <returns>The collection of models.</returns>
        public List <Model.Model> ParseDirectory(string directoryPath, bool merge = false)
        {
            if (!Directory.Exists(directoryPath))
            {
                throw new ArgumentException("The directory Specified does not exist.", "directoryPath");
            }

            var files = Directory.GetFiles(directoryPath, "config.cpp", SearchOption.AllDirectories);

            var result = new List <Model.Model>();

            foreach (var file in files)
            {
                var model = this.Parse(file);
                result.Add(model);
            }

            if (merge)
            {
                var mergedModel = new Model.Model();
                mergedModel.MergeFromListOfModels(result);

                return(new List <Model.Model> {
                    mergedModel
                });
            }

            return(result);
        }
Esempio n. 14
0
        /// <summary>
        /// 添加书籍
        /// </summary>
        /// <param name="book"></param>
        /// <returns></returns>
        public bool AddBook(Model.Book book)
        {
            string strSql = "insert into [Book] (b_id, b_name, author, publisher, amount) values (@b_id,@b_name,@author,@publisher,@amount); ";
            SqlParameter[] parameters ={
                           new SqlParameter ("@b_id",SqlDbType .VarChar,50),
                           new SqlParameter ("@b_name",SqlDbType .VarChar,50),
                           new SqlParameter ("@author",SqlDbType .VarChar,50),
                           new SqlParameter ("@publisher",SqlDbType .VarChar,50),
                           new SqlParameter ("@amount",SqlDbType .Int,50),
                                      };
            parameters[0].Value = book.Id;
            parameters[1].Value = book.Name;
            parameters[2].Value = book.Author;
            parameters[3].Value = book.Publisher;
            parameters[4].Value = Convert.ToInt32(book.Amount);

            Model.Book prev = GetSingleBook(book.Id);
            if (prev.Id == book.Id)
            {
                return false;
            }

            int n = Convert.ToInt32(SqlDbHelper.ExecuteNonQuery(strSql, CommandType.Text, parameters));
            if (n == 1)
                return true;
            else
                return false;
        }
        private void onInsert()
        {
            mdc = new Model.Model();
            try
            {
                Materias_ADD materia = new Materias_ADD();

                materia.tbNome.Text          = materia.tbNome.Text.Trim();
                materia.tbDescricao.Text     = materia.tbDescricao.Text.Trim();
                materia.tbDataCadrastro.Text = materia.tbDataCadrastro.Text.Trim();
                Convert.ToDateTime(tbDataCadrastro);

                InsertOnSubmit(materia);

                mdc.change();

                Response.Redirect("Materias.aspx");
            }
            catch (Exception)
            {
                Response.Redirect("Materias.aspx");
            }
            finally
            {
                mdc.Dispose();
            }
        }
Esempio n. 16
0
        public string Add(Model.Areas Model, int ProvinceID, int CityID)
        {
           
            AreasBll bll = new AreasBll();

            return (bll.Add(Model, ProvinceID, CityID));
        }
Esempio n. 17
0
        public App()
        {
            IView  mview = new MView();
            IModel model = new Model.Model();

            Presenter.Presenter presenter = new Presenter.Presenter(mview, model);
        }
Esempio n. 18
0
        public Model.Department Select(Model.Department Dep)
        {
            try
            {
                SqlCommand cmd = new SqlCommand("Select * From [FAMIS].[dbo].[Department] Where Department_id =" + Dep.Department_id, db.Db());
                SqlDataReader dr = cmd.ExecuteReader();

                Model.Department Department;

                Department = new Model.Department();

                while (dr.Read())
                {

                    if (!dr.IsDBNull(0))
                    {
                        Department.Department_id = dr.GetInt32(0);
                    }
                    if (!dr.IsDBNull(1))
                    {
                        Department.Name = dr.GetString(1);
                    }
                }

                return Department;

            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
        private void onUpdate()
        {
            mdc = new Model.Model();
            try
            {

                Materias_Edit materia = mdc.Materia.First(mat => mat.idMateria == int.Parse(tbCodMateria.Text.Trim()));

                tbNome.Text = materia.tbNome.Text.Trim();
                tbDescricao.Text = materia.tbDescricao.Text.Trim();
                materia.dataAtualizacao = DateTime.Parse(DateTime.Now.ToShortDateString());

                mdc.AcceptChanges();

                Response.Redirect("Materias.aspx");
            }
            catch (Exception)
            {

            }
            finally
            {
                mdc.Dispose();
            }
        }
Esempio n. 20
0
 //获取账单信息
 public DataSet getBill(string customer_id)
 {
     Model.Model model = new Model.Model();
     DataSet dt = new DataSet();
     dt = model.getBillInfor(customer_id);
     return dt;
 }
Esempio n. 21
0
 //获得账户信息
 public DataSet getCustomer(string username)
 {
     Model.Model model = new Model.Model();
     DataSet dt = new DataSet();
     dt = model.getCustomerInfor(username);
     return dt;
 }
Esempio n. 22
0
File: Region.cs Progetto: ecmr/FAMIS
        public Model.Region Select(Model.Region reg)
        {
            try
            {
                SqlCommand cmd = new SqlCommand("Select * From [FAMIS].[dbo].[Region] Where region_id =" + reg.Region_id, db.Db());
                SqlDataReader dr = cmd.ExecuteReader();

                Model.Region region = new Model.Region();

                if (dr.Read())
                {

                    if (!dr.IsDBNull(0))
                    {
                        region.Region_id = dr.GetInt32(0);
                    }
                    if (!dr.IsDBNull(1))
                    {
                        region.Name = dr.GetString(1);
                    }
                }
                return region;

            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
Esempio n. 23
0
        public static void Edit(Model.Type type)
        {
            string sql = @"update LType" + type.Language.ToString() + " set name='" + type.Name + "' where id=" + type.Id.ToString()+
                " update tblMenuType set OrderId=" + type.Order.ToString() + " where id=" + type.Id.ToString();

            SqlHelper.ExecuteNonQuery(SqlHelper.ConnectionString, CommandType.Text, sql);
        }
Esempio n. 24
0
        /// <summary>
        /// 根据书籍编号和借阅人编号得到借阅时间
        /// </summary>
        /// <param name="book"></param>
        /// <param name="viewer"></param>
        /// <returns></returns>
        public DateTime getRecordBorrowTime(Model.Book book, Model.Viewer viewer)
        {
            string strSql = "select borrow_date from [BorrowInfo] where r_id=@r_id and b_id=@b_id";
            SqlParameter[] parameters ={
                           new SqlParameter ("@r_id",SqlDbType .VarChar,50),
                           new SqlParameter ("@b_id",SqlDbType.VarChar,50)
                                      };
            parameters[0].Value = viewer.Id;
            parameters[1].Value = book.Id;

            DataTable dt = SqlDbHelper.ExecuteDataTable(strSql.ToString(),
                 CommandType.Text, parameters);
            string result ="";
            if (dt.Rows.Count > 0)
            {
                if (dt.Rows[0]["borrow_date"] != null && dt.Rows[0]["borrow_date"].ToString() != "")
                {
                    result = dt.Rows[0]["borrow_date"].ToString();
                }
            }
            result = result.Split(' ')[0];
            DateTime dateresult = new DateTime();
            try
            {
                dateresult = DateTime.Parse(result);
            } catch (FormatException e)
            {

            }
            return dateresult;
        }
Esempio n. 25
0
 /// <summary>
 /// 添加字典
 /// </summary>
 /// <param name="model">字典对象</param>
 /// <returns>是否成功</returns>
 public bool Add(Model.T_Dictionary model)
 {
     string detpType = Model.Enums.DicType.单位类型.ToString();
     model.Sort = db.T_Dictionary.Where(each => each.Type == detpType).Count()+1;
     db.AddToT_Dictionary(model);
     db.SaveChanges();
     return true;
 }
 public static void ChangeCatColor(Model.Cat cat, CatColor color)
 {
     Console.WriteLine("Задайте цвет здоровой кошки: ");
     color.HealtyColor = Console.ReadLine();
     Console.WriteLine("Задайте цвет больной кошки: ");
     color.SickColor = Console.ReadLine();
     cat.Color = color;
 }
Esempio n. 27
0
 private void AssertGoodRead(m.Post post, string docid)
 {
     m.Post readPost = m.Post.Get(docid);
     Assert.AreEqual(post.ID, readPost.ID);
     Assert.AreEqual(post.Title, readPost.Title);
     Assert.AreEqual(post.Key, readPost.Key);
     Assert.AreEqual(post.Content, readPost.Content);
     Assert.AreEqual(post.Created.ToString("yyyy-MM-dd HH:mm:ss"), readPost.Created.ToString("yyyy-MM-dd HH:mm:ss"));
 }
Esempio n. 28
0
 public static DataSet SelectRecordData(Model.SelectRecord selectRecord)
 {
     SqlParameter[] pars = new SqlParameter[] { new SqlParameter("@tablename", SqlDbType.VarChar, 100), new SqlParameter("@record", SqlDbType.VarChar, 200), new SqlParameter("@columnlist", SqlDbType.VarChar, 300), new SqlParameter("@condition", SqlDbType.VarChar, 0x1f40) };
     pars[0].Value = selectRecord.Stablename;
     pars[1].Value = selectRecord.Irecord;
     pars[2].Value = selectRecord.Scolumnlist;
     pars[3].Value = selectRecord.Scondition;
     return SqlHelper.GetAllInfo(pars, "SelectRecord");
 }
Esempio n. 29
0
 public static int WorkFlowAdd(Model.WorkFlow workinfo)
 {
     SqlParameter[] pars = new SqlParameter[] { new SqlParameter("@Name", SqlDbType.VarChar, 50), new SqlParameter("@URL", SqlDbType.VarChar, 100), new SqlParameter("@Remark", SqlDbType.VarChar, 255), new SqlParameter("@State", SqlDbType.Int) };
     pars[0].Value = workinfo.Name;
     pars[1].Value = workinfo.URL;
     pars[2].Value = workinfo.Remark;
     pars[3].Value = workinfo.State;
     return SqlHelper.ExecuteProcess("pro_WorkFlow_Add", pars);
 }
Esempio n. 30
0
 public void SaveOrUpdate(Model.ScenicImg si)
 {
     using (var x=session.Transaction)
     {
         x.Begin();
         session.SaveOrUpdate(si);
         x.Commit();
     }
 }
Esempio n. 31
0
 public void updateDiscountCode(Model.DiscountCode dc)
 {
     using (var x=session.Transaction)
     {
         x.Begin();
         session.Update(dc);
         x.Commit();
     }
 }
Esempio n. 32
0
        /// <summary>
        /// Parses the specified XML string.
        /// </summary>
        /// <param name="xmlString">The XML string.</param>
        /// <returns>The model generated from that string</returns>
        public Model.Model Parse(string xmlString)
        {
            this.Document = new StringReader(xmlString);

            var model = new Model.Model();

            this.ParseDocument(ref model);

            return(model);
        }
Esempio n. 33
0
 /// <summary>
 /// 添加部门
 /// </summary>
 /// <param name="model">部门对象</param>
 /// <returns>是否成功</returns>
 public bool Add(Model.T_Department model)
 {
     if (model.Sort == -1)
     {
         model.Sort = db.T_Department.Max(each => each.Sort) + 1;
     }
     db.AddToT_Department(model);
     db.SaveChanges();
     return true;
 }
Esempio n. 34
0
		public void AddPost(Model.Post post)
		{
			var postAdding = new PostAddingEventArgs(this, post);
			PostAdding.Raise(postAdding);
			if (postAdding.Cancel)
				return;
			postRepository.SavePost(post);
			var postAdded = new PostAddedEventArgs(this, post);
			PostAdded.Raise(postAdded);
		}
Esempio n. 35
0
		public void RemovePost(Model.Post post)
		{
			var postRemoving = new PostRemovingEventArgs(this, post);
			PostRemoving.Raise(postRemoving);
			if (postRemoving.Cancel)
				return;
			postRepository.DeletePost(post);
			var postRemoved = new PostRemovedEventArgs(this, post);
			PostRemoved.Raise(postRemoved);
		}
 public static int Add(Model.WorkFlowExecution workinfo)
 {
     SqlParameter[] pars = new SqlParameter[] { new SqlParameter("@DID", SqlDbType.Int), new SqlParameter("@UID", SqlDbType.Int), new SqlParameter("@step", SqlDbType.Int), new SqlParameter("@Remark", SqlDbType.VarChar, 255), new SqlParameter("@Result", SqlDbType.TinyInt) };
     pars[0].Value = workinfo.DID;
     pars[1].Value = workinfo.UID;
     pars[2].Value = workinfo.step;
     pars[3].Value = workinfo.Remark;
     pars[4].Value = workinfo.Result;
     return SqlHelper.ExecuteProcess("pro_WorkFlowExecution_Add", pars);
 }
Esempio n. 37
0
 public ViewModel()
 {
     model               = new Model.Model();
     Locations           = new ObservableCollection <MyLocation>(model.GetAllLocations());
     location            = Locations[0];
     DisplayMessageBoxes = true;
     AddLocation         = new DataBinding(AddNewLocation);
     GetLocation         = new DataBinding(GoToLocationDetails);
     GetAllLocations     = new DataBinding(() => Model = new Model.Model());
     UpdateLocation      = new DataBinding(UpdateChosenLocation);
     RemoveLocation      = new DataBinding(RemoveChosenLocation);
 }
Esempio n. 38
0
        /// <summary>
        /// Parses the document.
        /// </summary>
        /// <param name="model">The model.</param>
        private void ParseDocument(ref Model.Model model)
        {
            string readString;

            while ((readString = this.Document.ReadLine()) != null)
            {
                if (readString.Contains("<Class"))
                {
                    var newClass = new Class();
                    var element  = XElement.Parse(readString);
                    newClass.Name     = element.Attribute("Name").Value;
                    newClass.Inherits = element.Attribute("Inheritance").Value;
                    newClass.Remark   = element.Attribute("Remark").Value;
                    this.ParseClass(ref newClass);
                    model.Classes.Add(newClass);
                }
            }
        }
Esempio n. 39
0
        private void popularGrid()
        {
            mdc = new Model.Model();
            try
            {
                var sourceMateria = from mat in mdc.Materia select mat;

                gwDados.DataSource = sourceMateria;
                gwDados.DataBind();
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                mdc.Dispose();
            }
        }
        private void onDelete()
        {
            mdc = new Model.Model();
            try
            {
            
                Materias_Edit materia = mdc.Materia.First(mat => mat.idMateria == int.Parse(tbCodigo.Text.Trim()));

                mdc.Materia.RowDeleted();

                mdc.AcceptChanges();

                Response.Redirect("Materias.aspx");

            }
            catch (Exception)
            {

            }
            finally
            {
                mdc.Dispose();
            }
        }
Esempio n. 41
0
 public DereferencedModel GetDereferencedModel(Model.Model model)
 {
     return(new DereferencedModel(model));
 }
Esempio n. 42
0
 public StarWarsService()
 {
     this.Model = new ModelGenerator().Generate();
 }