public ActionResult ShiftMaster(ParentViewModel model) { Jct_Asset_Dep_Shift shift = new Jct_Asset_Dep_Shift(); shift.Shift_Name = model.Jct_Asset_Dep_Shift.Shift_Name; shift.ShiftCode = model.Jct_Asset_Dep_Shift.Shift_Name.Substring(0, 3); shift.Effe_From = System.DateTime.Today; shift.Created_On = System.DateTime.Now; shift.Effe_To = System.DateTime.MaxValue; shift.Status = "A"; shift.Created_By = HttpContext.User.Identity.Name; shift.Created_Hostname = System.Environment.MachineName; shift.Ip_Address = ("::1" == System.Web.HttpContext.Current.Request.UserHostAddress) ? "localhost" : System.Web.HttpContext.Current.Request.UserHostAddress; SqlConnection con = DBConnection.getConnection(); string sql = "Jct_Asset_Dep_Book_Shift_Insert"; SqlCommand cmd = new SqlCommand(sql, con); cmd.CommandType = System.Data.CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@ShiftCode", shift.ShiftCode); cmd.Parameters.AddWithValue("@Shift_Name", shift.Shift_Name); cmd.Parameters.AddWithValue("@Effe_From", shift.Effe_From); cmd.Parameters.AddWithValue("@Effe_To", shift.Effe_To); cmd.Parameters.AddWithValue("@Created_By", shift.Created_By); cmd.Parameters.AddWithValue("@Status", shift.Status); cmd.Parameters.AddWithValue("@Created_Hostname", shift.Created_Hostname); cmd.Parameters.AddWithValue("@Ip_Address", shift.Ip_Address); cmd.ExecuteNonQuery(); con.Close(); return(RedirectToAction("ShiftMaster", "ShiftMaster", null)); }
public ParentViewModel() { Jct_Asset_Dep_Unit = new Jct_Asset_Dep_Unit(); Jct_Asset_Dep_Company = new Jct_Asset_Dep_Company(); Jct_Asset_Dep_SubUnit = new Jct_Asset_Dep_SubUnit(); Jct_Asset_Dep_Book = new Jct_Asset_Dep_Book(); Jct_Asset_Dep_Group = new Jct_Asset_Dep_Group(); Jct_Asset_Dep_SubGroup = new Jct_Asset_Dep_SubGroup(); Jct_Asset_Dep_CompanyActRate = new Jct_Asset_Dep_CompanyActRate(); Jct_Asset_Dep_Bill_Info = new Jct_Asset_Dep_Bill_Info(); Jct_Asset_Dep_Asset = new Jct_Asset_Dep_Asset(); Jct_Asset_Dep_Book_AccountingYear = new Jct_Asset_Dep_Book_AccountingYear(); Jct_Asset_Dep_Section = new Jct_Asset_Dep_Section(); FinancialYearMasterModel = new FinancialYearMasterModel(); Jct_Asset_Dep_Method = new Jct_Asset_Dep_Method(); Jct_Asset_Dep_Insurance = new Jct_Asset_Dep_Insurance(); Jct_Asset_Dep_Sub_Asset = new Jct_Asset_Dep_Sub_Asset(); Jct_Asset_Dep_Shift = new Jct_Asset_Dep_Shift(); SLMProspectiveCalculatorModel = new SLMProspectiveCalculatorModel(); DropDownViewModel = new DropDownViewModel(); ReportViewModel = new ReportViewModel(); }