public personel_info GetPersonelInfoByCode(string Code) { PISContext db = new PISContext(); PISFunction PISFunction = new PISFunction(); var fitercode = PISFunction.WST_CODE; personel_info opersonel_info = new personel_info(); List <position> oposition = new List <position>(); var query = (from o in db.personel_info.Where(w => fitercode.Contains(w.WSTCODE) && w.CODE == Code) from u in db.unit.Where(w => w.unitcode == o.UNITCODE).DefaultIfEmpty() from p in db.position.Where(w => w.poscode == o.POSCODE).DefaultIfEmpty() select new Personel_Info() { sFNAME = o.FNAME, sLNAME = o.LNAME, sEmailAddr = o.EmailAddr, sLongname = u.longname, sUnitabbr = u.unitabbr, sPosition = p.t_name } ).FirstOrDefault(); return(opersonel_info); }
public static List <UnitInfo> ListUnit_ToLower(PISContext pis, string sUnitCode) { List <UnitInfo> lstUnit = new List <UnitInfo>(); var u = pis.unit.FirstOrDefault(w => w.unitcode == sUnitCode); if (u != null) { lstUnit.Add(new UnitInfo() { CODE = u.unitcode, NAME = u.longname, ABBR = u.unitabbr, RELATE = u.DUMMY_RELATIONSHIP }); var lstUnitRalated_DB = pis.unit.Where(w => w.DUMMY_RELATIONSHIP.StartsWith(u.DUMMY_RELATIONSHIP + "-")) .Select(s => new { s.unitcode, s.longname, s.unitabbr, s.DUMMY_RELATIONSHIP }).ToList(); lstUnitRalated_DB.ForEach(ur => { lstUnit.Add(new UnitInfo() { CODE = ur.unitcode, NAME = ur.longname, ABBR = ur.unitabbr, RELATE = ur.DUMMY_RELATIONSHIP }); }); } return(lstUnit); }
public List <oSetSearch> SetSearch(string SearchBy) { List <oSetSearch> osetsearch = new List <oSetSearch>(); List <personel_info> listpersonel_info = new List <personel_info>(); PTTGSP_DWSContext db = new PTTGSP_DWSContext(); PISContext pis = new PISContext(); PISFunction PISFunction = new PISFunction(); var fitercode = PISFunction.WST_CODE; var cf4 = db.TM_Config.FirstOrDefault(w => w.nID == 4); string sUnitCode_GSP = cf4 != null ? cf4.sValue : "80000563"; var listunitcode = PISFunction.ListUnit_ToLower(sUnitCode_GSP).Select(s => s.CODE).ToList(); listpersonel_info = pis.personel_info.Where(w => fitercode.Contains(w.WSTCODE) && (SearchBy == "3"? !listunitcode.Contains(w.UNITCODE): listunitcode.Contains(w.UNITCODE))).ToList(); osetsearch = (from a in listpersonel_info select new oSetSearch { value = a.CODE, label = a.CODE + " " + "-" + " " + a.FNAME + " " + a.LNAME, Search = a.CODE + " " + a.FNAME + " " + a.LNAME, }).OrderBy(o => o.label).ToList(); return(osetsearch); }
public UserController(IConfiguration conf, IAuthentication au) { IConfig = conf; IAuthen = au; db = new PTTGSP_DWSContext(); pis = new PISContext(); }
public static List <UnitInfo> ListUnit_ToUpper(PISContext pis, string sUnitCode) { List <UnitInfo> lstUnit = new List <UnitInfo>(); var u = pis.unit.FirstOrDefault(w => w.unitcode == sUnitCode); if (u != null) { lstUnit.Add(new UnitInfo() { CODE = u.unitcode, NAME = u.longname, ABBR = u.unitabbr, RELATE = u.DUMMY_RELATIONSHIP }); var arrDummyRalation = u.DUMMY_RELATIONSHIP.Split('-'); int nDummyLevel = arrDummyRalation.Length; List <string> lstDummyRalation = new List <string>(); for (int n = nDummyLevel - 1; n > 0; n--) { string sDummyRalation = string.Join("-", arrDummyRalation.ToList().GetRange(0, n)); lstDummyRalation.Add(sDummyRalation); } var lstUnitRalated_DB = pis.unit.Where(w => lstDummyRalation.Contains(w.DUMMY_RELATIONSHIP)) .Select(s => new { s.unitcode, s.longname, s.unitabbr, s.DUMMY_RELATIONSHIP }).ToList(); lstUnitRalated_DB.ForEach(ur => { lstUnit.Add(new UnitInfo() { CODE = ur.unitcode, NAME = ur.longname, ABBR = ur.unitabbr, RELATE = ur.DUMMY_RELATIONSHIP }); }); } return(lstUnit); }
public static List <RepInfo> AllReportTo(string EMPCODE, PISContext _pis) { List <RepInfo> lstRep = new List <RepInfo>(); var emp = pis.personel_info.FirstOrDefault(w => w.CODE == EMPCODE); if (emp != null) { lstRep.AddRange(AllReportTo(emp.CODE, emp.POSCODE, _pis)); } return(lstRep); }
public static List <RepInfo> AllReportTo(string EMPCODE, string POSCODE, PISContext _pis) { List <RepInfo> lstRep = new List <RepInfo>(); var rep = _pis.Report_To.FirstOrDefault(w => w.CODE == EMPCODE && w.POSCODE == POSCODE && w.PERCENTAGE == "100.00"); if (rep != null) { lstRep.AddRange(AllReportTo(rep.CODE, rep.POSCODE, rep.BAND, _pis)); } return(lstRep); }
public List <List_TB_Agency> GetAgency() { PISContext pis = new PISContext(); // var lstAgency = pis.unit.Where(w => w.DUMMY_RELATIONSHIP == "1-1" || ("1-1").Contains(w.DUMMY_RELATIONSHIP)).ToList().Select(s => new List_TB_Agency var lstAgency = pis.unit.Where(w => w.DUMMY_RELATIONSHIP == "1-1" || (w.DUMMY_RELATIONSHIP.Contains("1-1"))).ToList().Select(s => new List_TB_Agency { label = s.longname + " " + s.unitabbr + " ", value = s.unitcode }).ToList(); return(lstAgency); }
public static EmpInfo HeadEmployee_byUnitCode(PISContext pis, string sUnitCode) { EmpInfo emp = new EmpInfo(); string sPositionCode = HeadPostionCode_byUnitCode(pis, sUnitCode); var d = pis.personel_info.FirstOrDefault(w => w.POSCODE == sPositionCode); if (d != null) { emp.CODE = d.CODE; emp.NAME = d.FNAME + " " + d.LNAME; emp.POSITION_CODE = d.POSCODE; var p = pis.position.FirstOrDefault(w => w.poscode == d.POSCODE); emp.POSITION_NAME = p != null ? p.t_name : d.POSNAME; emp.POSITION_ABBR = p != null ? p.AB_NAME : d.POSNAME; } return(emp); }
public static string HeadPostionCode_byUnitCode(PISContext pis, string sUnitCode) { string sPositionCode = ""; var u = pis.unit.FirstOrDefault(w => w.unitcode == sUnitCode); if (u != null) { if (string.IsNullOrEmpty(u.HEAD_POSITION)) { var lstDummy = u.DUMMY_RELATIONSHIP.Split('-').ToList(); string sDummy_Head = string.Join("-", lstDummy.GetRange(0, lstDummy.Count - 1)); var u_head = pis.unit.FirstOrDefault(w => w.DUMMY_RELATIONSHIP == sDummy_Head); if (u_head != null) { sPositionCode = string.IsNullOrEmpty(u_head.HEAD_POSITION) ? HeadPostionCode_byUnitCode(pis, u_head.unitcode) : u_head.HEAD_POSITION; } } else { sPositionCode = u.HEAD_POSITION; } } return(sPositionCode); }
public cListRequest GetListtRequest(string txtSearch, string dropdown, string dsStartDate, string dsEndDate) { var result = new cListRequest(); try { UserAccount ua = IAuthen.SessionInfo(); PTTGSP_DWSContext db = new PTTGSP_DWSContext(); PISContext pis = new PISContext(); txtSearch = (txtSearch + "").ToLower(); var lstEmpcode = pis.personel_info.Where(w => w.CODE.Contains(txtSearch) || (w.FNAME + " " + w.LNAME).Contains(txtSearch) || (dropdown != null ? w.UNITCODE == dropdown : true)).Select(s => s.CODE).ToList(); // var lstDropdown = pis.personel_info.Where(w => w.UNITCODE.Contains(dropdown)).Select(s => s.CODE).ToList(); var lstRequest = db.T_Request .Where(w => (ua.nRoleID == 1 || ua.nRoleID == 2) ? lstEmpcode.Contains(w.sCreateBy) : w.sCreateBy == ua.sEmployeeCode) .Select(s => new { s.nRequestID, s.sRequestNo, s.nStepID, s.nReasonID, s.dCreate, s.IsApproved_MG1, s.IsApproved_MG2, s.IsApproved_MG3, s.IsCancel }).ToList(); //การเบิก var lstRequestID = lstRequest.Select(s => s.nRequestID).ToList(); var lstRequestMaterial = db.T_Request_Material.Where(w => lstRequestID.Contains(w.nRequestID)) .Select(s => new { s.nRequestID, s.nMaterialID, s.nPay_TotalPrice, s.nRequest_Amount, s.sNote }).ToList(); //การเบิกวัสดุ var lstStepID = lstRequest.Select(s => s.nStepID).ToList(); var lstStepRequest = db.TM_Step_Request.Where(w => lstStepID.Contains(w.nStepID)).Select(s => new { s.nStepID, s.sName }).ToList(); //สเต็ปการเบิก var lstRequestMaterialID = lstRequestMaterial.Select(s => s.nMaterialID).ToList(); var lstMaterial = db.TB_Materials.Where(w => !w.IsDel && lstRequestMaterialID.Contains(w.nMaterialID)) .Select(s => new { s.nMaterialID, s.sMaterialCode, s.sName, s.nUnitID }).ToList(); //วัสดุ var lstMaterialUnit = db.TB_Material_Unit.Where(w => !w.IsDel).Select(s => new { s.nUnitID, s.sName }).ToList(); //หน่วยนับวัสดุ var lstReason = db.TB_Reason.Where(w => !w.IsDel).Select(s => new { s.nReasonID, s.sName }).ToList(); //เหตุผลในการเบิก var Request = (from a in lstRequest join c in lstStepRequest on a.nStepID equals c.nStepID // join d in T_Reason on a.nReasonID equals d.nReasonID select new lstRequest { nRequestID = a == null ? 0 : a.nRequestID, sRequestNo = a == null ? "" : a.sRequestNo, dCreate = a.dCreate, sCreate = a.dCreate.ToString("dd/MM/yyyy", culture), nStepID = a == null ? 0 : a.nStepID, sStepName = c == null ? "" : c.sName, IsCancel = a.IsCancel, IsApprove = (a.IsApproved_MG1 ?? false) || (a.IsApproved_MG2 ?? false) || (a.IsApproved_MG3 ?? false), lstRequestMaterial = (from e in lstRequestMaterial join f in lstMaterial on e.nMaterialID equals f.nMaterialID join g in lstMaterialUnit on f.nUnitID equals g.nUnitID join h in lstReason on a.nReasonID equals h.nReasonID where e.nRequestID == a.nRequestID select new lstRequestMaterial { nMaterialID = f.nMaterialID, sMaterialCode = f.sMaterialCode, sName = f.sName, nRequest_Amount = e.nRequest_Amount, nUnitID = f.nUnitID, sUnitname = g.sName, nPay_TotalPrice = e.nPay_TotalPrice, nReasonID = a == null ? 0 : a.nReasonID, sReasonName = h == null ? "" : h.sName, sNote = e.sNote, }).ToList() }).ToList(); if (!string.IsNullOrWhiteSpace(dsStartDate) && !string.IsNullOrWhiteSpace(dsEndDate)) { DateTime sDate = Convert.ToDateTime(dsStartDate ?? "1900-01-01"); DateTime eDate = Convert.ToDateTime(dsEndDate ?? "9999-01-01"); Request = Request.Where(w => (w.dCreate >= sDate && w.dCreate <= eDate)).ToList(); } // if (!string.IsNullOrWhiteSpace(dsStartDate)) // { // DateTime sDate = Convert.ToDateTime(dsStartDate ?? "1900-01-01"); // Request = Request.Where(w => // (w.dCreate >= sDate && w.dCreate == null) || (w.dCreate >= sDate && w.dCreate == null)).ToList(); // } result.lstRequest = Request; } catch (Exception e) { result.sStatus = SysFunc.process_Error; result.sMsg = e.Message; } return(result); }
public WithdrawalRetrunlst GetData_List(Withdrawal_Search data) { db = new PTTGSP_DWSContext(); pis = new PISContext(); WithdrawalRetrunlst result = new WithdrawalRetrunlst(); List <Withdrawal_history_H> H_TB = new List <Withdrawal_history_H>(); int?nReasonID; int?sStepID; if (!string.IsNullOrEmpty(data.sReasonID)) { nReasonID = data.sReasonID.ToIntOrNull(); } else { nReasonID = null; } if (!string.IsNullOrEmpty(data.sStepID)) { sStepID = data.sStepID.ToIntOrNull(); } else { sStepID = null; } var lstData = (from R in db.T_Request.Where(w => (!string.IsNullOrEmpty(data.sRequestNo) ? (w.sRequestNo.ToLower().Contains(data.sRequestNo.ToLower().Trim())) : true)) from Re in db.TB_Reason.Where(w => w.nReasonID == R.nReasonID && (nReasonID.HasValue ? w.nReasonID == nReasonID : true)) from U in db.TB_User.Where(w => w.sEmployeeID == R.sCreateBy && (!string.IsNullOrEmpty(data.sEmployeeID) ? (w.sEmployeeID.ToLower().Contains(data.sEmployeeID.ToLower().Trim())) : true)) from SR in db.TM_Step_Request.Where(w => w.nStepID == R.nStepID && (sStepID.HasValue ? w.nStepID == sStepID : true)) select new { R.nRequestID, R.sRequestNo, //เลขที่ใบขอเบิก R.sCreateBy, //รหัสผู้ขอเบิก U.sFirstName, //ชื่อผู้ขอเบิก U.sLastName, //นามสกุลผู้ขอเบิก R.nReasonID, //เหตุผลในการเบิก sReasonName = Re.sName, //ชื่อเหตุผลในการเบิก R.dCreate, //วันที่เบิก R.nRequest_TotalPrice, R.sOrgID, //หน่วยงาน R.nStepID, //สถานะของรายการ SR.sName //ชื่อสถานะของรายการ }).ToList(); foreach (var i in lstData) { List <Withdrawal_history_S> S_TB = new List <Withdrawal_history_S>(); var H = new Withdrawal_history_H(); var lstSub = db.T_Request_Material.Where(w => w.IsApprove == true && w.nRequestID == i.nRequestID).Select(s => new Withdrawal_history_S { IsApprove = s.IsApprove, nMaterialID = s.nMaterialID, nPay_Amount = s.nPay_Amount, sNote = s.sNote, nPay_Price = s.nPay_Price, nPay_TotalPrice = s.nPay_TotalPrice, nRequestID = s.nRequestID, nRequest_Amount = s.nRequest_Amount, nRequest_Price = s.nRequest_Price, nRequest_TotalPrice = s.nRequest_TotalPrice, }).ToList(); foreach (var sub in lstSub) { Withdrawal_history_S s = new Withdrawal_history_S(); var Materials = db.TB_Materials.FirstOrDefault(w => w.nMaterialID == sub.nMaterialID); if (Materials != null) { s.sMaterialCode = Materials.sMaterialCode; // รหัสวัสดุ s.sMaterialName = Materials.sName; // ชื่อวัสดุ var Unit = db.TB_Material_Unit.FirstOrDefault(f => f.nUnitID == Materials.nUnitID); if (Unit != null) { s.sUnitName = Unit.sName; // หน่วยนับ } else { s.sUnitName = ""; } } s.nRequest_Amount = sub.nRequest_Amount; // จำนวนขอเบิก s.nPay_Amount = sub.nPay_Amount; //จำนวนที่ได้รับ s.nPay_TotalPrice = sub.nPay_TotalPrice; //ราคารวม S_TB.Add(s); } if (lstSub.Count > 0) { H.nReasonID = i.nReasonID; H.nRequestID = i.nRequestID; H.nRequest_TotalPrice = i.nRequest_TotalPrice; H.nStepID = i.nStepID; H.sCreateBy = i.sCreateBy; H.sFullName = i.sFirstName + " " + i.sLastName; H.sReasonName = i.sReasonName; H.sOrgID = i.sOrgID; H.sRequestNo = i.sRequestNo; H.StepName = i.sName; //H.dCreate = i.dCreate.SetMonth_th(); H.sub_List = S_TB; H_TB.Add(H); } } result.Withdrawal_history_H = H_TB; var lstStep = db.TM_Step_Request.OrderBy(o => o.sName).ToList(); var lstReason = db.TB_Reason.Where(w => !w.IsDel && w.IsActive).OrderBy(o => o.sName).ToList(); result.TB_Reason = lstReason; result.TM_Step_Request = lstStep; var lstUser = (from U in db.TB_User.Where(w => w.IsActive && !w.IsDel) select new lstAutoCompleted_Withdrawal { sEmployeeID = U.sEmployeeID, value = U.sEmployeeID, label = U.sEmployeeID + " " + "-" + " " + U.sFirstName + " " + U.sLastName, sFirstName = U.sFirstName, sLastName = U.sLastName, sOrgID = U.sOrgID, sOrgName = U.sOrgName, sPosName = U.sPosName, } ).OrderBy(o => o.sFirstName).ToList(); var lstUnit_DB = pis.unit.Where(w => (w.DUMMY_RELATIONSHIP == "1-1" || w.DUMMY_RELATIONSHIP.StartsWith("1-1-"))).ToList(); //หน่วยงาน var cf4 = db.TM_Config.FirstOrDefault(w => w.nID == 4); string sUnitCode_GSP = cf4 != null ? cf4.sValue : "80000563"; var lstMember = PISFunction.ListUnit_ToLower(sUnitCode_GSP).Select(s => s.CODE).ToList(); // string[] arrWSTCode = new string[] { "A", "B", "I", "J" }; // string[] arrPersonel = new string[] { }; // var lstMember = PISFunction.AllReportTo_EmpCode("270073"); // var lstPersonel = (from p in pis.personel_info.Where(w => lstMember.Contains(w.CODE)) // select new lstAutoCompleted_RequestApproval // { // sCODE = p.CODE, // รหัส user // value = p.CODE, // label = p.CODE + " " + "-" + " " + p.FULLNAMETH, // sPrefix = p.INAME, // คำนำหน้า // sFirstName = p.FNAME, // sLastName = p.LNAME, // sFullName = p.FULLNAMETH, // } //).OrderBy(o => o.sFirstName).ToList(); result.lstAutoCompleted = lstUser; return(result); }
public static string HeadEmpCode_byUnitCode(PISContext pis, string sUnitCode) { return(HeadEmployee_byUnitCode(pis, sUnitCode).CODE); }
public static List <RepInfo> AllReportTo(string EMPCODE, string POSCODE, string BAND, PISContext _pis) { List <RepInfo> lstRep = new List <RepInfo>(); lstRep.Add(new RepInfo() { sEmpCode = EMPCODE, sPosCode = POSCODE, sBand = BAND }); var rep = _pis.Report_To.FirstOrDefault(w => w.CODE == EMPCODE && w.POSCODE == POSCODE && w.PERCENTAGE == "100.00"); if (rep != null) { lstRep.AddRange(AllReportTo(rep.REP_CODE, rep.REP_POSCODE, rep.REP_BAND, _pis)); } return(lstRep); }
public RequestApprovalRetrunlst GetData_List(RequestApproval_Search data) { db = new PTTGSP_DWSContext(); pis = new PISContext(); RequestApprovalRetrunlst result = new RequestApprovalRetrunlst(); List <RequestApproval_H> H_TB = new List <RequestApproval_H>(); int?nReasonID; int?sStepID; if (!string.IsNullOrEmpty(data.sReasonID)) { nReasonID = data.sReasonID.ToIntOrNull(); } else { nReasonID = null; } if (!string.IsNullOrEmpty(data.sStepID)) { sStepID = data.sStepID.ToIntOrNull(); } else { sStepID = null; } string EmpCode = "580589"; var lstData = (from R in db.T_Request.Where(w => ((w.sEmpCode_MG1 == EmpCode && w.IsApproved_MG1 == null) || (w.sEmpCode_MG2 == EmpCode && w.IsApproved_MG2 == null) || (w.sEmpCode_MG3 == EmpCode && w.IsApproved_MG3 == null)) && (!string.IsNullOrEmpty(data.sRequestNo) ? (w.sRequestNo.ToLower().Contains(data.sRequestNo.ToLower().Trim())) : true)) from Re in db.TB_Reason.Where(w => w.nReasonID == R.nReasonID && (nReasonID.HasValue ? w.nReasonID == nReasonID : true)) from U in db.TB_User.Where(w => w.sEmployeeID == R.sCreateBy && (!string.IsNullOrEmpty(data.sEmployeeID) ? (w.sEmployeeID.ToLower().Contains(data.sEmployeeID.ToLower().Trim())) : true)) from SR in db.TM_Step_Request.Where(w => w.nStepID == R.nStepID && (sStepID.HasValue ? w.nStepID == sStepID : true)) select new { R.nRequestID, R.sRequestNo, //เลขที่ใบขอเบิก R.sCreateBy, //รหัสผู้ขอเบิก U.sFirstName, //ชื่อผู้ขอเบิก U.sLastName, //นามสกุลผู้ขอเบิก R.nReasonID, //เหตุผลในการเบิก sReasonName = Re.sName, //ชื่อเหตุผลในการเบิก R.dCreate, //วันที่เบิก R.nRequest_TotalPrice, //จำนวนเงิน R.sOrgID, //หน่วยงาน R.nStepID, //สถานะของรายการ SR.sName //ชื่อสถานะของรายการ }).ToList(); foreach (var i in lstData) { List <RequestApproval_S> S_TB = new List <RequestApproval_S>(); var H = new RequestApproval_H(); var lstSub = db.T_Request_Material.Where(w => w.IsApprove == true && w.nRequestID == i.nRequestID).Select(s => new RequestApproval_S { IsApprove = s.IsApprove, nMaterialID = s.nMaterialID, nPay_Amount = s.nPay_Amount, nID = s.nID, sNote = s.sNote, nPay_Price = s.nPay_Price, nPay_TotalPrice = s.nPay_TotalPrice, nRequestID = s.nRequestID, nRequest_Amount = s.nRequest_Amount, nRequest_Price = s.nRequest_Price, nRequest_TotalPrice = s.nRequest_TotalPrice, }).ToList(); foreach (var sub in lstSub) { RequestApproval_S s = new RequestApproval_S(); var Materials = db.TB_Materials.FirstOrDefault(w => w.nMaterialID == sub.nMaterialID); if (Materials != null) { s.nMaterialID = sub.nMaterialID; //รหัสวัสดุ s.sMaterialCode = Materials.sMaterialCode; // โค้ดวัสดุ s.sMaterialName = Materials.sName; // ชื่อวัสดุ s.nPrice = Materials.nPrice; var Unit = db.TB_Material_Unit.FirstOrDefault(f => f.nUnitID == Materials.nUnitID); if (Unit != null) { s.sUnitName = Unit.sName; // หน่วยนับ } else { s.sUnitName = ""; } } s.nID = sub.nID; s.nRequestID = sub.nRequestID; s.nRequest_Amount = sub.nRequest_Amount; // จำนวนขอเบิก s.nPay_Amount = sub.nPay_Amount; //จำนวนที่ได้รับ s.nPay_TotalPrice = sub.nPay_TotalPrice; //ราคารวม S_TB.Add(s); } if (lstSub.Count > 0) { H.nReasonID = i.nReasonID; H.nRequestID = i.nRequestID; H.nRequest_TotalPrice = i.nRequest_TotalPrice; H.nStepID = i.nStepID; H.sAlert = ""; H.sCreateBy = i.sCreateBy; H.sFullName = i.sFirstName + " " + i.sLastName; H.sReasonName = i.sReasonName; H.sOrgID = i.sOrgID; H.sRequestNo = i.sRequestNo; H.StepName = i.sName; //H.dCreate = i.dCreate.SetMonth_th(); H.sub_List = S_TB; H_TB.Add(H); } } result.RequestApproval_H = H_TB; var BTName = db.TM_Option_Sub.Where(w => w.nID == 3).ToList(); result.ApproveName = BTName.FirstOrDefault(w => w.nSubID == 2).sName; //อนุมัติ result.rejectName = BTName.FirstOrDefault(w => w.nSubID == 5).sName; //ส่งกลับแก้ไข result.cancelName = BTName.FirstOrDefault(w => w.nSubID == 6).sName; //ยกเลิก return(result); }
public MaterialController(IAuthentication au) { IAuthen = au; db = new PTTGSP_DWSContext(); pis = new PISContext(); }