// GET: Forms/Create public ActionResult FormAdd(string formtype) { LoginCheck(); if (formtype == "Arıza") { ViewData["FormAddTitle"] = "Arıza Formu Ekranı"; ViewData["montajdateStyle"] = "display:none"; } else if (formtype == "montaj") { ViewData["FormAddTitle"] = "Montaj Formu Ekranı"; ViewData["arizadateStyle"] = "display:none"; } else { return(Redirect("Index")); } FORMLines _DefaultModel = new FORMLines(); _DefaultModel.BELGENO = Convert.ToInt32(GLOBALS.GetCookie("giris")["BELGEID"]); _DefaultModel.BELGESTR = GLOBALS.GetCookie("giris")["CLIENTREF"]; _DefaultModel.FORMTYPE = formtype; _DefaultModel.MONTAJDATE = DateTime.Now; _DefaultModel.ARIZADATE = DateTime.Now; _DefaultModel.FATURADATE = DateTime.Now; return(View(_DefaultModel)); }
public ActionResult FormKaydetJQ(FORMLines FormLines) { //zorunlu alan kontrolü if (FormLines.TEL == "" && FormLines.TEL2 == "") { return(View()); } string MontajDate = Convert.ToDateTime(((FormLines.MONTAJDATE == null) ? DateTime.Parse("1900-01-01") : FormLines.MONTAJDATE)).ToString("MM/dd/yyyy"); string ARIZADATE = Convert.ToDateTime(((FormLines.ARIZADATE == null) ? DateTime.Parse("1900-01-01") : FormLines.ARIZADATE)).ToString("MM/dd/yyyy"); string FatDate = Convert.ToDateTime(((FormLines.FATURADATE == null) ? DateTime.Parse("1900-01-01") : FormLines.FATURADATE)).ToString("MM/dd/yyyy"); bool durum = true; if ((FormLines.FORMTYPE == "montaj" && FormLines.MONTAJDATE > DateTime.Now) || (FormLines.FORMTYPE == "Arıza" && FormLines.ARIZADATE > DateTime.Now)) { durum = false; } using (IDbConnection db = new SqlConnection(ConfigurationManager.ConnectionStrings["PTEKNIKMSSQL"].ConnectionString)) { string sqlQuery = "INSERT INTO [dbo].[FORMLINE](FORMTYPE,FICHENO,[BELGENO],[BELGESTR],[ADSOYAD],[ADRES],[TEL],[TEL2],[EMAIL],[MONTAJDATE],[ARIZADATE],[FIRMA],[SATICIFIRMA],[FATURADATE],[FATURANO],[GARANTINO],[CIHAZ],[CIHAZSERINO],CLIENTREF)VALUES" + "('" + FormLines.FORMTYPE + "','" + FormLines.BELGESTR + "-" + FormLines.BELGENO + "'," + FormLines.BELGENO + "" + ",'" + FormLines.BELGESTR + "'" + ",'" + FormLines.ADSOYAD + "'" + ",'" + FormLines.ADRES + "'" + ",'" + FormLines.TEL + "'" + ",'" + FormLines.TEL2 + "'" + ",'" + FormLines.EMAIL + "'" + ",cast('" + MontajDate + "' as datetime)" + ",cast('" + ARIZADATE + "' as datetime)" + ",'" + FormLines.FIRMA + "'" + ",'" + FormLines.SATICIFIRMA + "'" + ",cast('" + FatDate + "' as datetime)" + ",'" + FormLines.FATURANO + "'" + ",'" + FormLines.GARANTINO + "'" + ",'" + FormLines.CIHAZ + "'" + ",'" + FormLines.CIHAZSERINO + "'" + ",'" + GLOBALS.GetCookie("giris")["CLIENTREF"] + "'" + ")"; if (durum == true) { int rowsAffected = db.Execute(sqlQuery); int rowsUpdated = db.Execute("update USERS set BELGEID=BELGEID+1 where LOGICALREF=" + GLOBALS.GetCookie("giris")["USERID"] + ""); int belgeid = Convert.ToInt32(giris["BELGEID"]); belgeid++; giris["BELGEID"] = belgeid.ToString(); Response.Cookies.Add(giris); } } // Response.Redirect("FormEdit?ficheno="+ FormLines.BELGESTR + "-" + FormLines.BELGENO+ "&formtype="+Request.QueryString["formtype"]+""); return(Json(new { success = durum }, JsonRequestBehavior.AllowGet)); // return RedirectToAction("FormEdit",new {ficheno=FormLines.BELGESTR+"-"+FormLines.BELGENO,formtype=Request.QueryString["formtype"] }); }
public ActionResult HakedisList() { List <FORMLines> _list = new List <FORMLines>(); using (IDbConnection db = new SqlConnection(ConfigurationManager.ConnectionStrings["PTEKNIKMSSQL"].ConnectionString)) { _list = db.Query <FORMLines>("select case when durum=2 then 'Ödendi' end as ONAYDURUM," + "* from FORMLINE WHERE CLIENTREF=" + GLOBALS.GetCookie("giris")["CLIENTREF"] + " and DURUM=2").ToList(); } return(View(_list)); }
public ActionResult FormBas(string ficheno) { FORMLines _DefaultModel = new FORMLines(); if (ficheno != "0") { using (db) { _DefaultModel = db.Query <FORMLines>("select * from FORMLINE where FICHENO='" + ficheno + "'").SingleOrDefault(); } } else { _DefaultModel.BELGENO = Convert.ToInt32(GLOBALS.GetCookie("fichenos")["BELGEID"]); _DefaultModel.BELGESTR = GLOBALS.GetCookie("fichenos")["CLIENTREF"]; _DefaultModel.FORMTYPE = "MONTAJ"; _DefaultModel.MONTAJDATE = DateTime.Now; } return(View(_DefaultModel)); }
// GET: Forms public ActionResult FormList(string formtype, string SearchSTR) { LoginCheck(); if (formtype == "Arıza") { ViewData["FormListTitle"] = "Arıza Formları"; } else if (formtype == "montaj") { ViewData["FormListTitle"] = "Montaj Formları"; } else { return(RedirectToAction("Index")); } string SqlAra = ""; if (!String.IsNullOrEmpty(SearchSTR)) { SqlAra = " and replace(BELGESTR,' ','') like '%" + SearchSTR.Replace(" ", "") + "%'"; } List <FORMLines> FormLists = new List <FORMLines>(); using (IDbConnection db = new SqlConnection(ConfigurationManager.ConnectionStrings["PTEKNIKMSSQL"].ConnectionString)) { FormLists = db.Query <FORMLines>("Select * From FORMLINE where CLIENTREF=" + GLOBALS.GetCookie("giris")["CLIENTREF"] + " and formtype='" + formtype + "' " + SqlAra).ToList(); } return(View(FormLists)); }
public ActionResult Index() { LoginCheck(); FORMSIndex _formsIndex = new FORMSIndex(); using (IDbConnection db = new SqlConnection(ConfigurationManager.ConnectionStrings["PTEKNIKMSSQL"].ConnectionString)) { _formsIndex = db.Query <FORMSIndex>("select (select count(LOGICALREF) FROM FORMLINE WHERE (DURUM IS NULL OR DURUM=0) AND CLIENTREF=" + GLOBALS.GetCookie("giris")["CLIENTREF"] + ") AS BEKLEYEN" + ",(select count(LOGICALREF) FROM FORMLINE WHERE DURUM>=1 AND CLIENTREF=" + GLOBALS.GetCookie("giris")["CLIENTREF"] + ") AS ONAYLANAN " + ",(select count(LOGICALREF) FROM FORMLINE WHERE DURUM<=-1 AND CLIENTREF=" + GLOBALS.GetCookie("giris")["CLIENTREF"] + ") AS REDDEDILEN").SingleOrDefault(); } return(View(_formsIndex)); }
public JsonResult GetWaitedForms() { List <FORMLines> _formLines = new List <FORMLines>(); using (IDbConnection db = new SqlConnection(ConfigurationManager.ConnectionStrings["PTEKNIKMSSQL"].ConnectionString)) { _formLines = db.Query <FORMLines>("select top 5 FORMTYPE,DATEDIFF(DAY,ADDDATE,GETDATE()) AS TIMEDIFF,FICHENO from FORMLINE where DURUM=0 and CLIENTREF=" + GLOBALS.GetCookie("giris")["CLIENTREF"] + " order by ADDDATE desc").ToList(); } return(Json(_formLines, JsonRequestBehavior.AllowGet)); }
public JsonResult GetFormsJson(string SQLAra, string formtype) { string LSqlAra = ""; if (SQLAra != "") { LSqlAra += "and replace(ADRES+ADSOYAD,' ','') like '%" + SQLAra.Replace(" ", "") + "%' "; } List <FORMLines> _formLists = new List <FORMLines>(); using (IDbConnection db = new SqlConnection(ConfigurationManager.ConnectionStrings["PTEKNIKMSSQL"].ConnectionString)) { _formLists = db.Query <FORMLines>("select * from FORMLINE where CLIENTREF=" + GLOBALS.GetCookie("giris")["CLIENTREF"] + " and formtype='" + formtype + "' " + LSqlAra).ToList(); } return(Json(_formLists, JsonRequestBehavior.AllowGet)); }
public ActionResult FormBas(string ficheno, FORMLines FormLines) { bool durum = false; LoginCheck(); //zorunlu alan kontrolü if (String.IsNullOrEmpty(FormLines.TEL) && String.IsNullOrEmpty(FormLines.TEL2)) { TempData["msg"] = "<script>alert('En Az Bir Telefon Numarası Girmelisiniz!!!');</script>"; return(View()); } if (String.IsNullOrEmpty(FormLines.ADRES) && String.IsNullOrEmpty(FormLines.ADSOYAD)) { TempData["msg"] = "<script>alert('Müşteri Adı Ve Adres Girmeden İlerleyemezsiniz!!!');</script>"; return(View()); } if ((FormLines.FORMTYPE == "MONTAJ" && FormLines.MONTAJDATE > DateTime.Now)) { durum = false; TempData["msg"] = "<script>alert('İleri Bir Tarih Seçimi Yapamazsınız!!!');</script>"; return(View()); } string MontajDate = Convert.ToDateTime(((FormLines.MONTAJDATE == null) ? DateTime.Parse("1900-01-01") : FormLines.MONTAJDATE)).ToString("MM/dd/yyyy"); if (ficheno != "0") { string sqlQuery = "update [dbo].[FORMLINE] set " + "ADSOYAD='" + FormLines.ADSOYAD + "'" + ",ADRES='" + FormLines.ADRES + "'" + ",TEL='" + FormLines.TEL + "'" + ",TEL2='" + FormLines.TEL2 + "'" + ",EMAIL='" + FormLines.EMAIL + "'" + ",MONTAJDATE='" + MontajDate + "'" + ",FIRMA='" + FormLines.FIRMA + "'" + ",SATICIFIRMA='" + FormLines.SATICIFIRMA + "'" + ",FATURANO='" + FormLines.FATURANO + "'" + ",GARANTINO='" + FormLines.GARANTINO + "'" + ",CIHAZ='" + FormLines.CIHAZ + "'" + ",CIHAZSERINO='" + FormLines.CIHAZSERINO + "'" + ",CACIKLAMA='" + FormLines.CACIKLAMA + "'" + " WHERE FICHENO='" + ficheno + "'"; int rowsAffected = db.Execute(sqlQuery); return(RedirectToAction("FormLine", new { ficheno = ficheno, adsoyad = FormLines.ADSOYAD })); } FormLines.BELGENO = Convert.ToInt32(GLOBALS.GetCookie("fichenos")["BELGEID"]); FormLines.BELGESTR = GLOBALS.GetCookie("fichenos")["CLIENTREF"]; using (db) { string sqlQuery = "INSERT INTO [dbo].[FORMLINE](ADDDATE,NAME,FORMTYPE,FICHENO,[BELGENO],[BELGESTR],[ADSOYAD],[ADRES],[TEL],[TEL2],[EMAIL],[MONTAJDATE],[FIRMA],[SATICIFIRMA],ACIKLAMA,CLIENTREF)VALUES" + "(GETDATE(),(select DEFINITION_ FROM LKSDB..LG_" + GLOBALS.GFirma + "_CLCARD WHERE LOGICALREF=" + GLOBALS.GetCookie("giris")["CLIENTREF"] + ")," + "'" + FormLines.FORMTYPE + "','" + FormLines.BELGESTR + "-" + FormLines.BELGENO + "'," + FormLines.BELGENO + "" + ",'" + FormLines.BELGESTR + "'" + ",'" + FormLines.ADSOYAD + "'" + ",'" + FormLines.ADRES + "'" + ",'" + FormLines.TEL + "'" + ",'" + FormLines.TEL2 + "'" + ",'" + FormLines.EMAIL + "'" + ",cast('" + MontajDate + "' as datetime)" + ",'" + FormLines.FIRMA + "'" + ",'" + FormLines.SATICIFIRMA + "'" + ",'" + FormLines.ACIKLAMA + "'" + ",'" + GLOBALS.GetCookie("giris")["CLIENTREF"] + "'" + ")"; int rowsAffected = db.Execute(sqlQuery); int rowsUpdated = db.Execute("update USERS set BELGEID=BELGEID+1 where LOGICALREF=" + GLOBALS.GetCookie("giris")["USERID"] + ""); int belgeid = Convert.ToInt32(cookie["BELGEID"]); belgeid++; cookie["BELGEID"] = belgeid.ToString(); cookie.Expires = DateTime.Now.AddDays(1); Response.Cookies.Add(cookie); } return(RedirectToAction("FormLine", new { ficheno = FormLines.BELGESTR + "-" + FormLines.BELGENO, adsoyad = FormLines.ADSOYAD })); }
public JsonResult GetFormsJson(string SQLAra, string formtype, string durum) { string LSqlAra = ""; if (SQLAra != "") { LSqlAra += "and replace(ADRES+ADSOYAD,' ','') like '%" + SQLAra.Replace(" ", "") + "%' "; } if (!String.IsNullOrEmpty(durum)) { LSqlAra += " and durum=" + durum; } List <FORMLines> _formLists = new List <FORMLines>(); using (IDbConnection db = new SqlConnection(ConfigurationManager.ConnectionStrings["PTEKNIKMSSQL"].ConnectionString)) { _formLists = db.Query <FORMLines>("select (CASE WHEN DURUM=1 THEN 'bg-success' WHEN DURUM=-1 THEN 'bg-danger' ELSE '' END) AS TRSTYLE," + "(CASE WHEN DURUM=1 THEN 'ONAYLANDI' WHEN DURUM=-1 THEN 'REDDEDİLDİ' WHEN DURUM=2 THEN 'ÖDENDİ' ELSE 'Gönderildi Bekliyor' END) AS ONAYDURUM" + ",* from FORMLINE where CLIENTREF=" + GLOBALS.GetCookie("giris")["CLIENTREF"] + " and formtype='" + formtype + "' and ((GOSTER=1 and ISTALEP=0) or (ISTALEP=1) " + LSqlAra).ToList(); } return(Json(_formLists, JsonRequestBehavior.AllowGet)); }