Open farzinmonsef opened 4 years ago
CREATE TABLE [dbo].[Types]( Id [int] IDENTITY(1,1) NOT NULL, TypeNo [int] NULL, Code [int] NULL, TypesName varchar NULL, Comment varchar NULL, Link int NULL, Status [int] NULL, Actions[int] NULL
CONSTRAINT [PK_Types_Id] PRIMARY KEY NONCLUSTERED ( [Id] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] GO
public ActionResult Index()
{
try
{
//Tool.writeExe();
//Tool.AppendFile("test test", @"C:\Users\U612702\source\repos\WBRS.ReportsOnline.Site\RunReport2.Log");
Session["msgShow"] = "
<img src=\"../Images/Chat128.png\" />
<h4 style=\"color:darkblue\">Select Report to Enter Related Parameters and See the Printed Output on the Screen
";
Session["ApplicationList"] = Tool.refreshApplicationList(db);
Session["Parameters"] = (from p in db.ReportParameters
where (p.ReportID == 0)
orderby p.SortOrder
select p);
Session["enumReportTypes"] = HtmlDropDownExtensions.MapEnumToDictionary
using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data.Entity;
using System.Data.SqlClient;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;
using System.Web;
using System.Web.Mvc;
using System.Web.Mvc.Html;
using WBRS.ReportsOnline.Site.Models;
namespace WBRS.ReportsOnline.Site.Helpers
{
public static class HtmlDropDownExtensions
{
///
<!DOCTYPE html>
|
WB Reporting System |
|
@(Html.Kendo().ResponsivePanel()
.Name("sidebar")
.Breakpoint(1000)
.Orientation("left")
.HtmlAttributes(new { style = "z-index: 9999;" })
.Content(@
|
@RenderBody()
|
using System; using System.Collections.Generic; using System.Configuration; using System.Data; using System.Data.SqlClient; using System.Linq; using System.Web; using System.Web.Mvc; namespace WBRS.ReportsOnline.Site.Controllers { public class BaseController : Controller { protected override void OnException(ExceptionContext filterContext) { logDB(filterContext); Exception exception = filterContext.Exception; filterContext.ExceptionHandled = true; var Result = this.View("Error", new HandleErrorInfo(exception, filterContext.RouteData.Values["controller"].ToString(), filterContext.RouteData.Values["action"].ToString())); filterContext.Result = Result; } private void logDB(ExceptionContext filterContext) { var connectionString = ConfigurationManager.ConnectionStrings["CIBRS"].ConnectionString; using (SqlConnection connection = new SqlConnection(connectionString)) { connection.Open(); string sql = "insert into LogDB (Date_Time, UserName, Controller, Action, Message, Comment)"+ "values (@Date_Time, @UserName, @Controller, @Action, @Message, @Comment)"; using (SqlCommand command = new SqlCommand(sql, connection)) { var Date_Time = new SqlParameter("Date_Time", SqlDbType.DateTime); Date_Time.Value = DateTime.Now; command.Parameters.Add(Date_Time); var UserName = new SqlParameter("UserName", SqlDbType.VarChar); UserName.Value = (string)Session["UserID"] + "|" + (string)Session["UserFullName"]; command.Parameters.Add(UserName); var Controller = new SqlParameter("Controller", SqlDbType.VarChar); Controller.Value = filterContext.RouteData.Values["controller"].ToString(); command.Parameters.Add(Controller); var Action = new SqlParameter("Action", SqlDbType.VarChar); Action.Value = filterContext.RouteData.Values["action"].ToString(); command.Parameters.Add(Action); var Message = new SqlParameter("Message", SqlDbType.VarChar); Message.Value = filterContext.Exception.ToString(); command.Parameters.Add(Message); var Comment = new SqlParameter("Comment", SqlDbType.VarChar); Comment.Value = ""; command.Parameters.Add(Comment); var results = command.ExecuteReader(); } } } private void logDB_old(ExceptionContext filterContext) { var connectionString = ConfigurationManager.ConnectionStrings["CIBRS"].ConnectionString; string queryString = "SELECT Top 1 [Id], [Date_Time],[UserName],[Controller],[Action],[Message],[Comment] FROM LogDB;"; using (var connection = new SqlConnection(connectionString)) { using (SqlDataAdapter dataAdapter = new SqlDataAdapter(queryString, connection)) { DataSet dataSet = new DataSet(); dataAdapter.Fill(dataSet); DataRow newLog = dataSet.Tables[0].NewRow(); newLog["Date_Time"] = DateTime.Now; newLog["UserName"] = (string)Session["UserID"] + "|" + (string)Session["UserFullName"]; newLog["Controller"] = filterContext.RouteData.Values["controller"].ToString(); newLog["Action"] = filterContext.RouteData.Values["action"].ToString(); newLog["Message"] = filterContext.Exception.ToString(); newLog["Comment"] = ""; dataSet.Tables[0].Rows.Add(newLog); } } } } }
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.ComponentModel.DataAnnotations;
namespace EQM.Site.Models { [MetadataType(typeof(TransactionMetaData))] public partial class Transaction { public static explicit operator List
[DataType(DataType.Date)]
[Display(Name = "Today's Date")]
public string TodayDate { get; set; }
[DataType(DataType.Date)]
//[UIHint("Date")]
[Display(Name = "Transaction Effective Date")]
public string TransactionEffectiveDate { get; set; }
[Display(Name = "Requisition Number")]
public string RequisitionNumber { get; set; }
[Required()]
[StringLength(255)]
[RegularExpression(@"^[a-zA-Z''-'\s ]{5,255}$",
ErrorMessage = "Reserve Name sgould be between 5 to 255 Characters, and just alphabets/space are allowed")]
//[Required( ErrorMessage = "Phone is a Required field." )]
//[DataType( DataType.PhoneNumber )]
//[RegularExpression("^[01]?[- .]?\\(?[2-9]\\d{2}\\)?[- .]?\\d{3}[- .]?\\d{4}$",
// ErrorMessage = "Phone is required and must be properly formatted.")]
[Display(Name = "Reserve Name")]
public string ReserveName { get; set; }
[Display(Name = "Total Vested Shares")]
public string TotalVestedShares { get; set; }
[StringLength(255)]
[Display(Name = "Memo")]
public Nullable<bool> Memo { get; set; }
[StringLength(255)]
[Display(Name = "Attachments")]
public Nullable<int> Attachments { get; set; }
//[StringLength(200)]
[Display(Name = "Status")]
public Nullable<int> Status { get; set; }
[Range(1, 5, ErrorMessage = "Action must be between 1 and 5")]
[Display(Name = "Actions")]
public Nullable<bool> Actions { get; set; }
}
}
@model EQM.Site.Models.Transaction
@{ ViewBag.Title = "Edit"; }
@using (Html.BeginForm()) { @Html.AntiForgeryToken() var attributes = new System.Collections.Generic.Dictionary<string, object>(); attributes.Add("class", "form-control k-header");
<div class="form-horizontal">
<h4>Transaction</h4>
<hr />
@Html.ValidationSummary(true, "", new { @class = "text-danger" })
@Html.HiddenFor(model => model.Id)
<div class="form-group">
@Html.LabelFor(model => model.TransactionType, htmlAttributes: new { @class = "control-label col-md-2" })
<div class="col-md-10">
@Html.EditorFor(model => model.TransactionType, new { htmlAttributes = new { @class = "form-control" } })
@Html.ValidationMessageFor(model => model.TransactionType, "", new { @class = "text-danger" })
</div>
</div>
<div class="form-group">
@Html.LabelFor(model => model.TodayDate, htmlAttributes: new { @class = "control-label col-md-2" })
<div class="col-md-10">
@Html.EditorFor(model => model.TodayDate, new { htmlAttributes = new { @class = "form-control" } })
@Html.ValidationMessageFor(model => model.TodayDate, "", new { @class = "text-danger" })
</div>
</div>
<div class="form-group">
@Html.LabelFor(model => model.TransactionEffectiveDate, htmlAttributes: new { @class = "control-label col-md-2" })
<div class="col-md-10">
@Html.EditorFor(model => model.TransactionEffectiveDate, new { htmlAttributes = new { @class = "form-control" } })
@Html.ValidationMessageFor(model => model.TransactionEffectiveDate, "", new { @class = "text-danger" })
</div>
</div>
<div class="form-group">
@Html.LabelFor(model => model.RequisitionNumber, htmlAttributes: new { @class = "control-label col-md-2" })
<div class="col-md-10">
@Html.EditorFor(model => model.RequisitionNumber, new { htmlAttributes = new { @class = "form-control" } })
@Html.ValidationMessageFor(model => model.RequisitionNumber, "", new { @class = "text-danger" })
</div>
</div>
<div class="form-group">
@Html.LabelFor(model => model.ReserveName, htmlAttributes: new { @class = "control-label col-md-2" })
<div class="col-md-10">
@Html.EditorFor(model => model.ReserveName, new { htmlAttributes = new { @class = "form-control" } })
@Html.ValidationMessageFor(model => model.ReserveName, "", new { @class = "text-danger" })
</div>
</div>
<div class="form-group">
@Html.LabelFor(model => model.TotalVestedShares, htmlAttributes: new { @class = "control-label col-md-2" })
<div class="col-md-10">
@Html.EditorFor(model => model.TotalVestedShares, new { htmlAttributes = new { @class = "form-control" } })
@Html.ValidationMessageFor(model => model.TotalVestedShares, "", new { @class = "text-danger" })
</div>
</div>
<div class="form-group">
@Html.LabelFor(model => model.Memo, htmlAttributes: new { @class = "control-label col-md-2" })
<div class="col-md-10">
@Html.EditorFor(model => model.Memo, new { htmlAttributes = new { @class = "form-control" } })
@Html.ValidationMessageFor(model => model.Memo, "", new { @class = "text-danger" })
</div>
</div>
<div class="form-group">
@Html.LabelFor(model => model.Attachments, htmlAttributes: new { @class = "control-label col-md-2" })
<div class="col-md-10">
@Html.EditorFor(model => model.Attachments, new { htmlAttributes = new { @class = "form-control" } })
@Html.ValidationMessageFor(model => model.Attachments, "", new { @class = "text-danger" })
</div>
</div>
<div class="form-group">
@Html.LabelFor(model => model.Status, htmlAttributes: new { @class = "control-label col-md-2" })
<div class="col-md-10">
@Html.EditorFor(model => model.Status, new { htmlAttributes = new { @class = "form-control" } })
@Html.ValidationMessageFor(model => model.Status, "", new { @class = "text-danger" })
</div>
</div>
<div class="form-group">
@Html.LabelFor(model => model.Actions, htmlAttributes: new { @class = "control-label col-md-2" })
<div class="col-md-10">
@Html.EditorFor(model => model.Actions, new { htmlAttributes = new { @class = "form-control" } })
@Html.ValidationMessageFor(model => model.Actions, "", new { @class = "text-danger" })
</div>
</div>
<div class="form-group">
<div class="col-md-offset-2 col-md-10">
<input type="submit" value="Save" class="btn btn-default" />
</div>
</div>
</div>
}
Phase1
(https://github.com/farzinmonsef/tk1/files/4394667/CreateTable_Transaction_n_data.zip)
EQM.Site.zip lib.zip