Esempio n. 1
0
        /// <summary>
        /// 3.Portal 网站主体的ManageService工具类
        /// </summary>
        /// [模板文件]:service/manageservice.txt
        /// 生成文件名称:ManageService.cs
        private void CreateManageService()
        {
            string Content = "";
            string ClassName, InstanceName, Table_Comment, UnitTemplate;
            string ServiceDefine = "", ServiceMethod = "";
            //读取原文件内容到内存
            string Template_Name = @"AutoCode/Model/service/manageservice.txt";

            Content = UtilFile.ReadFile2String(Template_Name);

            foreach (string Table_Name in TableList)
            {
                ClassName     = Table_Name;
                Table_Comment = "";
                if (TableInfoList.ContainsKey(Table_Name))
                {
                    Table_Comment = TableInfoList[Table_Name]["Comment"];
                    string[] t_c = Table_Comment.Split(new char[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries);
                    if (t_c.Length > 1)
                    {
                        Table_Comment = t_c[0];
                    }
                }
                InstanceName   = UtilString.LcFirst(ClassName);
                UnitTemplate   = @"
        /// <summary>
        /// {$Table_Comment}服务
        /// </summary>
        private static IService{$ClassName} {$InstanceName}Service;";
                UnitTemplate   = UnitTemplate.Replace("{$InstanceName}", InstanceName);
                UnitTemplate   = UnitTemplate.Replace("{$ClassName}", ClassName);
                UnitTemplate   = UnitTemplate.Replace("{$Table_Comment}", Table_Comment);
                ServiceDefine += UnitTemplate;
                UnitTemplate   = @"
        /// <summary>
        /// 服务:{$Table_Comment}
        /// </summary>
        public static IService{$ClassName} {$ClassName}Service()
        {
            Init();
            if ({$InstanceName}Service == null) {$InstanceName}Service = new Service{$ClassName}();
            return {$InstanceName}Service;
        }";
                UnitTemplate   = UnitTemplate.Replace("{$InstanceName}", InstanceName);
                UnitTemplate   = UnitTemplate.Replace("{$ClassName}", ClassName);
                UnitTemplate   = UnitTemplate.Replace("{$Table_Comment}", Table_Comment);
                ServiceMethod += UnitTemplate;
            }
            Content = Content.Replace("{$ServiceDefine}", ServiceDefine);
            Content = Content.Replace("{$ServiceMethod}", ServiceMethod);

            //存入目标文件内容
            UtilFile.WriteString2File(Save_Dir + "ManageService.cs", Content);
        }
Esempio n. 2
0
 partial void DeleteTable_Comment(Table_Comment instance);
Esempio n. 3
0
 partial void UpdateTable_Comment(Table_Comment instance);
Esempio n. 4
0
 partial void InsertTable_Comment(Table_Comment instance);
Esempio n. 5
0
	private void detach_Table_Comment(Table_Comment entity)
	{
		this.SendPropertyChanging();
		entity.Table_Customer = null;
	}
Esempio n. 6
0
	private void detach_Table_Comment(Table_Comment entity)
	{
		this.SendPropertyChanging();
		entity.Table_HotelReservation = null;
	}
Esempio n. 7
0
 protected void Button_comment_Click(object sender, EventArgs e)
 {
     if (dbc.GetCommentByReservationId(Convert.ToInt32(GridView2.SelectedRow.Cells[0].Text)))
     {
         ScriptManager.RegisterStartupScript(this.UpdatePanel1, this.GetType(), "updateScript", "alert('You Had Commented The Reservation!')", true);
         return;
     }
     try
     {
         Table_Comment c = new Table_Comment();
         c.Date = DateTime.Now;
         c.HotelId = dbc.GetHotelReservationById(Convert.ToInt32(GridView2.SelectedRow.Cells[0].Text)).HotelId;
         c.Score = DropDownList1.SelectedIndex + 1;
         c.Comment = textbox_comment.Text + " ";
         c.CustomerEmail = Session["Customer"].ToString();
         c.ReservationId = Convert.ToInt32(GridView2.SelectedRow.Cells[0].Text);
         data.Table_Comment.InsertOnSubmit(c);
         data.SubmitChanges();
     }
     catch (Exception) { }
 }