public Boolean InsertBank_master(FormCollection f) { GenHelper g = new GenHelper(); String Sqltext = "insert into Bank_master (bankid,bankname,accountnumber,bankaccno,chequestart,chequeend,divid,nextchequeno) values(@bankid,@bankname,@accountnumber,@bankaccno,@chequestart,@chequeend,@divid,@nextchequeno)"; SqlConnection con = DBClass.mycon(); SqlCommand cmd = new SqlCommand(Sqltext, con); cmd.Parameters.AddWithValue("@bankid", g.GetNextId("Bank_master", "bankid")); cmd.Parameters.AddWithValue("@bankname", f["bankname"]); cmd.Parameters.AddWithValue("@accountnumber", f["accountnumber"]); cmd.Parameters.AddWithValue("@bankaccno", f["bankaccno"]); cmd.Parameters.AddWithValue("@chequestart", f["chequestart"]); cmd.Parameters.AddWithValue("@chequeend", f["chequeend"]); cmd.Parameters.AddWithValue("@divid", f["divid"]); cmd.Parameters.AddWithValue("@nextchequeno", f["nextchequeno"]); int ab = cmd.ExecuteNonQuery(); con.Close(); if (ab > 0) { return(true); } else { return(false); } }
public async Task <ActionResult> Logout() { await HttpContext.SignOutAsync(); GenHelper.WriteLog("[Log]", "[" + securityProvider.GetUserName() + "]Logout Done:[" + DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss tt") + "]"); return(Ok()); }
public Boolean InsertVoucher_master(FormCollection f) { GenHelper g = new GenHelper(); String Sqltext = "insert into Voucher_master (id,voucherno,vodate,billtypeid,sectionid,divid,depoid,rvnumber,ponumber,invoiceno,userid,status,enteredon) values(@id,@voucherno,@vodate,@billtypeid,@sectionid,@divid,@depoid,@rvnumber,@ponumber,@invoiceno,@userid,@status,@enteredon)"; SqlConnection con = DBClass.mycon(); SqlCommand cmd = new SqlCommand(Sqltext, con); cmd.Parameters.AddWithValue("@id", g.GetNextId("Voucher_master", "id")); cmd.Parameters.AddWithValue("@voucherno", f["voucherno"]); cmd.Parameters.AddWithValue("@vodate", f["vodate"]); cmd.Parameters.AddWithValue("@billtypeid", f["billtypeid"]); cmd.Parameters.AddWithValue("@sectionid", f["sectionid"]); cmd.Parameters.AddWithValue("@divid", f["divid"]); cmd.Parameters.AddWithValue("@depoid", f["depoid"]); cmd.Parameters.AddWithValue("@rvnumber", f["rvnumber"]); cmd.Parameters.AddWithValue("@ponumber", f["ponumber"]); cmd.Parameters.AddWithValue("@invoiceno", f["invoiceno"]); cmd.Parameters.AddWithValue("@userid", f["userid"]); cmd.Parameters.AddWithValue("@status", f["status"]); cmd.Parameters.AddWithValue("@enteredon", f["enteredon"]); int ab = cmd.ExecuteNonQuery(); con.Close(); if (ab > 0) { return(true); } else { return(false); } }
public Boolean Insertvoucherdata(FormCollection f, int divid, int sectionid, int userid) { GenHelper g = new GenHelper(); String Sqltext = "insert into accounttrans(id,trtype,accno,sectionid,divid,dramount,cramount,userid) values(@id,@trtype,@accno,@sectionid,@divid,@dramount,@cramount,@userid)"; SqlConnection con = DBClass.mycon(); SqlCommand cmd = new SqlCommand(Sqltext, con); cmd.Parameters.AddWithValue("@id", g.GetNextId("accounttrans", "id")); cmd.Parameters.AddWithValue("@trtype", f["trtype"]); cmd.Parameters.AddWithValue("@accno", f["accno"]); cmd.Parameters.AddWithValue("@sectionid", sectionid); cmd.Parameters.AddWithValue("@divid", divid); cmd.Parameters.AddWithValue("@dramount", f["dramount"]); cmd.Parameters.AddWithValue("@cramount", f["cramount"]); cmd.Parameters.AddWithValue("@userid", userid); int ab = cmd.ExecuteNonQuery(); con.Close(); if (ab > 0) { return(true); } else { return(false); } }
public Boolean InsertBilltype_master(FormCollection f) { GenHelper g = new GenHelper(); String Sqltext = "insert into Billtype_master (billtypeid,billtypename,sectionid,divid) values(@billtypeid,@billtypename,@sectionid,@divid)"; SqlConnection con = DBClass.mycon(); SqlCommand cmd = new SqlCommand(Sqltext, con); cmd.Parameters.AddWithValue("@billtypeid", g.GetNextId("Billtype_master", "billtypeid")); cmd.Parameters.AddWithValue("@billtypename", f["billtypename"]); cmd.Parameters.AddWithValue("@sectionid", f["sectionid"]); cmd.Parameters.AddWithValue("@divid", f["divid"]); // cmd.Parameters.AddWithValue("@active", f["active"]); int ab = cmd.ExecuteNonQuery(); con.Close(); if (ab > 0) { return(true); } else { return(false); } }
public ActionResult backupdb() { serverpath = Server.MapPath("~/backups"); GenHelper g = new GenHelper(); string DatabaseName = "profitplus"; string BackupName = DatabaseName + "_" + DateTime.Now.Day.ToString() + "_" + DateTime.Now.Month.ToString() + "_" + DateTime.Now.Year.ToString() + ".bak"; try { SqlConnection con = DBClass.mycon(); String Qry = "BACKUP DATABASE " + DatabaseName + " TO DISK = '" + serverpath + "\\" + BackupName + "' WITH FORMAT, MEDIANAME = 'Z_SQLServerBackups', NAME = '" + BackupName + "';"; SqlCommand cmd = new SqlCommand(Qry, con); cmd.ExecuteNonQuery(); con.Close(); string[] backuplist = Directory.GetFiles(@serverpath, "*.bak"); ViewBag.backlist = backuplist; ViewBag.msg = "Backup Successfully Created"; return(View("backupform")); } catch (Exception ex) { g.logerror(ex); String Errmsg = "Error Creating Backup" + "<br/>" + ex.Message; return(Content(Errmsg)); } }
public ActionResult restore() { serverpath = Server.MapPath("~/backups"); GenHelper g = new GenHelper(); String selectedfile; selectedfile = Request.QueryString["selfile"]; string DatabaseName = "profitplus"; string BackupName = selectedfile; try { SqlConnection sqlConnection = DBClass.mycon(); string sqlQuery = "RESTORE DATABASE " + DatabaseName + " FROM DISK ='" + BackupName + "'"; SqlCommand sqlCommand = new SqlCommand(sqlQuery, sqlConnection); sqlCommand.CommandType = CommandType.Text; int iRows = sqlCommand.ExecuteNonQuery(); sqlConnection.Close(); String message = "The " + DatabaseName + " database restored with the name " + BackupName + " successfully..."; return(Content(message)); } catch (SqlException ex) { g.logerror(ex); String errmessage = "Cannot Restore " + DatabaseName + " with the name " + BackupName + "... Try Again"; return(Content(errmessage)); } }
private void GetStreamInfo() { try { _currentTask.MediaInfo = GenHelper.GetMediaInfo(_currentTask.VideoStream.TempFile); } catch (TimeoutException ex) { Log.Error(ex); } finally { if (_currentTask.MediaInfo.Video.Count > 0) { _currentTask.VideoStream.Bitrate = _currentTask.MediaInfo.Video[0].BitRate; _currentTask.VideoStream.StreamSize = GenHelper.GetFileSize(_currentTask.VideoStream.TempFile); _currentTask.VideoStream.FrameCount = _currentTask.MediaInfo.Video[0].FrameCount; _currentTask.VideoStream.StreamId = _currentTask.MediaInfo.Video[0].ID; } } for (var i = 0; i < _currentTask.AudioStreams.Count; i++) { var aStream = _currentTask.AudioStreams[i]; aStream = AudioHelper.GetStreamInfo(aStream); _currentTask.AudioStreams[i] = aStream; } foreach (var sStream in _currentTask.SubtitleStreams) { sStream.StreamSize = GenHelper.GetFileSize(sStream.TempFile); } }
public ActionResult TrialBal(FormCollection fc) { GenHelper g = new GenHelper(); DataSet ds = new DataSet(); String repname = "TrialBalance"; String Tblname = "mytrialbal"; DBClass.NonQuery("drop table " + Tblname); Reports rp = new Reports(); String Mon = System.Globalization.CultureInfo.CurrentCulture.DateTimeFormat.GetMonthName(Convert.ToInt32(fc["mon"])); String Stdate = fc["year"] + "-" + fc["mon"] + "-" + "01"; DateTime sd = DateTime.Parse(Stdate); DateTime ed = sd.AddMonths(1); ed = ed.AddDays(-1); String edate = g.SqlDate(ed.ToString()); DataTable trbal = rp.PrepareTraialBal(Tblname, Stdate, edate); String SumQry = "select sum(receipts) as TotalCredits,sum(payments) as TotalDebits from " + Tblname; DataTable sumdt = DBClass.GetData(SumQry); ds.Tables.Add(trbal); ds.Tables.Add(sumdt); float[] cols = new float[] { 60f, 180f, 65f, 65f, 65f, 65f }; String path = Server.MapPath("/pdfs/trialbalance.pdf"); String[] rephead = new String[] { "N.EW.K.R.T.C Hubli", "Trial Balance For the Month of " + Mon + " " + fc["year"] }; String[] tblhead = new string[] { "Account Number", "Account Name", "Opening Balance", "Receipts", "Payments", "Closing Balance" }; pdf ph = new pdf(ds, cols, rephead, tblhead, path, repname, Tblname); ph.GenerateReport(); //String DropQry = "drop table " + Tblname; //DBClass.NonQuery(DropQry); return(File(path, "application/pdf")); }
static void CreateDemoData() { var gen = new GenHelper(); var ids = new List <string>(); for (int i = 0; i < 200; i++) { var id = gen.MakeTosh(20); ids.Add(id); contacts.Add(new Contact() { UserName = id, FullName = gen.GetFullName() }); } for (int i = 0; i < 5000; i++) { var id1 = gen.Next(ids.Count); var id2 = gen.Next(ids.Count - 1); articles.Add(new Article() { ID = i, Title = GenHelper.ToTitle(gen.MakeBlah(gen.Next(7))), Content = gen.MakeBlahBlahBlah(5 + gen.Next(100), 7), Author = contacts[id1] }); } }
public Boolean InsertParty_master(FormCollection f) { GenHelper g = new GenHelper(); String Sqltext = "insert into Party_master (partyid,partyname,divid,sectionid,Address,city,state,pincode,MobileNo,PhoneNo,GSTNo,TANNo,PANNo) values(@partyid,@partyname,@divid,@sectionid,@Address,@city,@state,@pincode,@MobileNo,@PhoneNo,@GSTNo,@TANNo,@PANNo)"; SqlConnection con = DBClass.mycon(); SqlCommand cmd = new SqlCommand(Sqltext, con); cmd.Parameters.AddWithValue("@partyid", g.GetNextId("Party_master", "partyid")); cmd.Parameters.AddWithValue("@partyname", f["partyname"]); cmd.Parameters.AddWithValue("@divid", f["divid"]); cmd.Parameters.AddWithValue("@sectionid", f["sectionid"]); cmd.Parameters.AddWithValue("@Address", f["Address"]); cmd.Parameters.AddWithValue("@city", f["city"]); cmd.Parameters.AddWithValue("@state", f["state"]); cmd.Parameters.AddWithValue("@pincode", f["pincode"]); cmd.Parameters.AddWithValue("@MobileNo", f["MobileNo"]); cmd.Parameters.AddWithValue("@PhoneNo", f["PhoneNo"]); //cmd.Parameters.AddWithValue("@sectionid", f["MobileNo"]); cmd.Parameters.AddWithValue("@GSTNo", f["GSTNo"]); cmd.Parameters.AddWithValue("@TANNo", f["TANNo"]); cmd.Parameters.AddWithValue("@PANNo", f["PANNo"]); int ab = cmd.ExecuteNonQuery(); con.Close(); if (ab > 0) { return(true); } else { return(false); } }
public Boolean InsertDiv_master(FormCollection f) { GenHelper g = new GenHelper(); String Sqltext = "insert into Div_master (divid,divname) values(@divid,@divname)"; SqlConnection con = DBClass.mycon(); SqlCommand cmd = new SqlCommand(Sqltext, con); int newid = g.GetNextId("Div_master", "divid"); cmd.Parameters.AddWithValue("@divid", newid); cmd.Parameters.AddWithValue("@divname", f["divname"]); int ab = cmd.ExecuteNonQuery(); String Sql = "insert into autoidgen(id,cadtvoc,padtvoc,sadtvoc,radtvoc,adjvoc,cadtbpo,padtbpo,radtbpo,sadtbpo,divid,cash) values(@id,0,0,0,0,0,0,0,0,0,@divid,0)"; SqlCommand cmd1 = new SqlCommand(Sql, con); cmd1.Parameters.AddWithValue("@id", g.GetNextId("autoidgen", "id")); cmd1.Parameters.AddWithValue("@divid", newid); int ab1 = cmd1.ExecuteNonQuery(); con.Close(); if (ab > 0 && ab1 > 0) { return(true); } else { return(false); } }
public Boolean InsertAccount_master(FormCollection f) { GenHelper g = new GenHelper(); String Sqltext = "insert into Account_master (accountid,accountnumber,accountname,parentid,groupid,sectionid,allow) values(@accountid,@accountnumber,@accountname,@parentid,@groupid,@sectionid,@allow)"; SqlConnection con = DBClass.mycon(); SqlCommand cmd = new SqlCommand(Sqltext, con); cmd.Parameters.AddWithValue("@accountid", g.GetNextId("Account_master", "accountid")); cmd.Parameters.AddWithValue("@accountnumber", f["accountnumber"]); cmd.Parameters.AddWithValue("@accountname", f["accountname"]); cmd.Parameters.AddWithValue("@parentid", f["parentid"]); cmd.Parameters.AddWithValue("@groupid", f["groupid"]); cmd.Parameters.AddWithValue("@sectionid", f["sectionid"]); cmd.Parameters.AddWithValue("@allow", f["allow"]); //cmd.Parameters.AddWithValue("@active", f["active"]); int ab = cmd.ExecuteNonQuery(); con.Close(); if (ab > 0) { return(true); } else { return(false); } }
public Boolean InsertUsers(FormCollection f) { GenHelper g = new GenHelper(); String Sqltext = "insert into Users (id,username,password,sectionid,divid,mobileno,usertypeid) values(@id,@username,@password,@sectionid,@divid,@mobileno,@usertypeid)"; SqlConnection con = DBClass.mycon(); SqlCommand cmd = new SqlCommand(Sqltext, con); cmd.Parameters.AddWithValue("@id", g.GetNextId("Users", "id")); cmd.Parameters.AddWithValue("@username", f["username"]); cmd.Parameters.AddWithValue("@password", f["password"]); cmd.Parameters.AddWithValue("@sectionid", f["sectionid"]); cmd.Parameters.AddWithValue("@divid", f["divid"]); cmd.Parameters.AddWithValue("@mobileno", f["mobileno"]); cmd.Parameters.AddWithValue("@usertypeid", f["usertypeid"]); int ab = cmd.ExecuteNonQuery(); con.Close(); if (ab > 0) { return(true); } else { return(false); } }
public DataTable GetRpData(String sdate, String edate) { GenHelper g = new GenHelper(); String Qry = "SELECT [at].accountnumber, am.accountname,Sum([at].dramount) AS Receipts,Sum([at].cramount) AS Payments FROM dbo.account_master AS am"; Qry += " INNER JOIN dbo.accounttrans AS [at] ON am.accountnumber = [at].accountnumber WHERE [at].divid = 1 and trdate>='" + g.SqlDate(sdate) + "' and trdate<='" + g.SqlDate(edate) + "' GROUP BY [at].accountnumber,am.accountname"; return(DBClass.GetData(Qry)); }
public ActionResult findvoucher() { GenHelper g = new GenHelper(); DataTable dt = g.FindVouchers(Request["vtype"], Convert.ToInt32(Session["divid"])); DataSet ds = new DataSet(); ds.Tables.Add(dt); return(PartialView("_findvoc", ds)); }
public IActionResult GenPURItem([FromBody] JArray values) { try { GenHelper.WriteLog("[Log]", "[" + securityProvider.GetUserName() + "]" + controllername + "-GenPURItem:[" + DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss tt") + "]"); GenHelper.WriteLog("[Json]", "[" + securityProvider.GetUserName() + "]" + controllername + "-GenPURItem:[" + Environment.NewLine + values.ToString() + Environment.NewLine + "][" + DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss tt") + "]"); PurchaseReturnDetail dtl; string temp = ""; JToken token; foreach (JObject Jdtl in values.Children()) { dtl = objectSpace.CreateObject <PurchaseReturnDetail>(); temp = Jdtl["Baseline"].ToString(); dtl.Baseline = int.Parse(temp); if (Jdtl.ContainsKey("BaseDocNo")) { temp = Jdtl["BaseDocNo"].ToString(); dtl.BaseDocNo = temp; } temp = DocTypeCodes.PurchaseDelivery; dtl.BaseType = objectSpace.FindObject <DocType>(CriteriaOperator.Parse("BoCode=?", temp)); temp = Jdtl["Quantity"].ToString(); dtl.Quantity = double.Parse(temp); if (Jdtl.ContainsKey("BatchNumber")) { if (Jdtl["BatchNumber"] != null) { temp = Jdtl["BatchNumber"].ToString(); } if (!string.IsNullOrEmpty(temp)) { dtl.BatchNumber = temp; } } token = Jdtl["BinCode"]; temp = token["BoKey"].ToString(); dtl.BinCode = objectSpace.FindObject <vwWarehouseBins>(CriteriaOperator.Parse("BoKey=?", temp)); token = Jdtl["LineVendor"]; temp = token["BoKey"].ToString(); dtl.LineVendor = objectSpace.FindObject <vwBusinessPartners>(CriteriaOperator.Parse("BoKey=?", temp)); } objectSpace.CommitChanges(); return(Ok()); } catch (Exception ex) { GenHelper.WriteLog("[Error]", "[" + securityProvider.GetUserName() + "]" + controllername + "-GenPURItem:[" + ex.Message + "][" + DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss tt") + "]"); throw new Exception(ex.Message); } }
public APIResult CallLogoutAPI(string apiURL, string userName) { List <APIParameters> apiParameters = new List <APIParameters>(); var userParameter = new APIParameters() { Key = "email", Value = userName, Type = APIParameterType.Body }; var cpuIDParameter = new APIParameters() { Key = "CPUId", Value = GenHelper.cpuId(), Type = APIParameterType.Body }; var macAddressParameter = new APIParameters() { Key = "mac", Value = GenHelper.GetMACAddress(), Type = APIParameterType.Body }; var app_idParameter = new APIParameters() { Key = "app_id", Value = "LICAPPID", Type = APIParameterType.Body }; var motherBoardIdParameter = new APIParameters() { Key = "MotherBoardId", Value = GenHelper.motherBoardId(), Type = APIParameterType.Body }; var diskIdParameter = new APIParameters() { Key = "DiskId", Value = GenHelper.diskId(), Type = APIParameterType.Body }; apiParameters.Add(userParameter); apiParameters.Add(cpuIDParameter); apiParameters.Add(macAddressParameter); apiParameters.Add(app_idParameter); apiParameters.Add(motherBoardIdParameter); apiParameters.Add(diskIdParameter); var result = ApiIntegration.callPostAPI(apiURL, apiParameters); return(result); }
public void LoadDemoData() { var dt = dataSet.Tables["Contacts"]; var gen = new GenHelper(); for (int i = 0; i < 200; i++) { var id = gen.MakeTosh(20); var fullName = gen.GetFullName(); var age = 16 + gen.Next(80); var rating = gen.Next(100) * gen.Next(100) * 0.001f; dt.LoadDataRow(new object[] { id, fullName, age, rating }, LoadOption.OverwriteChanges); } }
public ActionResult EditBpo(Int32 id) { GenHelper g = new GenHelper(); Cash cs = new Cash(); DataTable bac = cs.GetBankAccounts(Convert.ToInt32(Session["divid"])); ViewBag.bacclist = new SelectList(bac.AsDataView(), "accountnumber", "bankname"); SelectList lst = new SelectList(g.Acclist(), "payid", "paydesc"); ViewBag.aclist = lst; DataTable dt = cs.FindBpo(id); return(View("EditBpo", dt)); }
public ActionResult GetWhsList(string companycode) { try { GenHelper.WriteLog("[Log]", "[" + securityProvider.GetUserName() + "]" + controllername + "-GetWhsList(" + companycode + "):[" + DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss tt") + "]"); List <vwWarehouseBins> existing = objectSpace.GetObjects <vwWarehouseBins>(CriteriaOperator.Parse("CompanyCode=? and BinAbsEntry=0", companycode)).ToList(); return(Ok(existing)); } catch (Exception ex) { GenHelper.WriteLog("[Error]", "[" + securityProvider.GetUserName() + "]" + controllername + "-GetWhsList(" + companycode + "):[" + ex.Message + "][" + DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss tt") + "]"); throw new Exception(ex.Message); } }
public IActionResult Get() { try { GenHelper.WriteLog("[Log]", "[" + securityProvider.GetUserName() + "]" + controllername + "-Get:[" + DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss tt") + "]"); IQueryable <PurchaseReturnDetail> employees = objectSpace.GetObjectsQuery <PurchaseReturnDetail>(); return(Ok(employees)); } catch (Exception ex) { GenHelper.WriteLog("[Error]", "[" + securityProvider.GetUserName() + "]" + controllername + "-Get:[" + ex.Message + "][" + DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss tt") + "]"); throw new Exception(ex.Message); } }
public ActionResult Add([FromBody] JObject values) { try { GenHelper.WriteLog("[Log]", "[" + securityProvider.GetUserName() + "]" + controllername + "-Post:[" + DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss tt") + "]"); PurchaseReturnDetail employee = objectSpace.CreateObject <PurchaseReturnDetail>(); JsonParser.ParseJObjectXPO <PurchaseReturnDetail>(values, employee, objectSpace); objectSpace.CommitChanges(); return(Ok(employee)); } catch (Exception ex) { GenHelper.WriteLog("[Error]", "[" + securityProvider.GetUserName() + "]" + controllername + "-Post:[" + ex.Message + "][" + DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss tt") + "]"); throw new Exception(ex.Message); } }
/// <summary> /// The ffmpeg process has exited. /// </summary> /// <param name="sender"> /// The sender. /// </param> /// <param name="e"> /// The EventArgs. /// </param> private void EncodeProcessExited(object sender, EventArgs e) { try { EncodeProcess.CancelErrorRead(); } catch (Exception exc) { Log.Error(exc); } _currentTask.ExitCode = EncodeProcess.ExitCode; Log.Info($"Exit Code: {_currentTask.ExitCode:0}"); if (_currentTask.ExitCode == 0) { if (_encProfile.EncodingMode == 0 || (_encProfile.EncodingMode == 1 && _encodingPass == 2)) { _currentTask.VideoStream.IsRawStream = false; _currentTask.VideoStream.Encoded = true; _currentTask.TempFiles.Add(_inputFile); _currentTask.VideoStream.TempFile = _outputFile; _currentTask.TempFiles.Add(_currentTask.AviSynthScript); try { _currentTask.MediaInfo = GenHelper.GetMediaInfo(_currentTask.VideoStream.TempFile); } catch (TimeoutException ex) { Log.Error(ex); } _currentTask.VideoStream = VideoHelper.GetStreamInfo(_currentTask.MediaInfo, _currentTask.VideoStream, _currentTask.EncodingProfile.OutFormat == OutputType.OutputBluRay); _currentTask.TempFiles.Add(_currentTask.FfIndexFile); } } _currentTask.CompletedStep = _currentTask.NextStep; IsEncoding = false; InvokeEncodeCompleted(new EncodeCompletedEventArgs(true, null, string.Empty)); }
static void CreateDemoData() { var gen = new GenHelper(); var contacts = ContactAdapter.GetAllContacts(); for (int i = 0; i < 5000; i++) { var id1 = gen.Next(contacts.Count); var id2 = gen.Next(contacts.Count - 1); articles.Add(new Article() { ID = i, Title = GenHelper.ToTitle(gen.MakeBlah(gen.Next(7))), Content = gen.MakeBlahBlahBlah(5 + gen.Next(100), 7), Author = contacts[id1] }); } }
public ActionResult Get(string bokey) { try { GenHelper.WriteLog("[Log]", "[" + securityProvider.GetUserName() + "]" + controllername + "-Get(" + bokey + "):[" + DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss tt") + "]"); vwWarehouseBins existing = objectSpace.FindObject <vwWarehouseBins>(CriteriaOperator.Parse("BoKey=?", bokey)); if (existing == null) { NotFound(); } return(Ok(existing)); } catch (Exception ex) { GenHelper.WriteLog("[Error]", "[" + securityProvider.GetUserName() + "]" + controllername + "-Get(" + bokey + "):[" + ex.Message + "][" + DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss tt") + "]"); throw new Exception(ex.Message); } }
public ActionResult Get(int id) { try { GenHelper.WriteLog("[Log]", "[" + securityProvider.GetUserName() + "]" + controllername + "-Get(" + id.ToString() + "):[" + DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss tt") + "]"); PurchaseReturnDetail existing = objectSpace.GetObjectByKey <PurchaseReturnDetail>(id); if (existing == null) { NotFound(); } return(Ok(existing)); } catch (Exception ex) { GenHelper.WriteLog("[Error]", "[" + securityProvider.GetUserName() + "]" + controllername + "-Get(" + id.ToString() + "):[" + ex.Message + "][" + DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss tt") + "]"); throw new Exception(ex.Message); } }
public ActionResult SupplierList(string companycode) { try { GenHelper.WriteLog("[Log]", "[" + securityProvider.GetUserName() + "]" + controllername + "-SupplierList(" + companycode + "):[" + DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss tt") + "]"); List <vwBusinessPartners> existing = objectSpace.GetObjects <vwBusinessPartners>(CriteriaOperator.Parse("CompanyCode=? and CardType=?", companycode, "S")).ToList(); if (existing == null) { NotFound(); } return(Ok(existing)); } catch (Exception ex) { GenHelper.WriteLog("[Error]", "[" + securityProvider.GetUserName() + "]" + controllername + "-SupplierList(" + companycode + "):[" + ex.Message + "][" + DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss tt") + "]"); throw new Exception(ex.Message); } }
void CreateDemoData() { var inMemoryDataStore = (InMemoryDataStore)DataStore; var ds = new DataSet(); using (var ms = new System.IO.MemoryStream()) { using (var writer = System.Xml.XmlWriter.Create(ms)) { inMemoryDataStore.WriteXml(writer); writer.Flush(); } ms.Flush(); ms.Position = 0; ds.ReadXml(ms); } var gen = new GenHelper(); var idsAccount = new List <string>(); var dtAccounts = ds.Tables["Accounts"]; for (int i = 0; i < 200; i++) { var id = gen.MakeTosh(20); idsAccount.Add(id); dtAccounts.Rows.Add(id, gen.GetFullName()); } var dtMessages = ds.Tables["Messages"]; for (int i = 0; i < 5000; i++) { var id1 = gen.Next(idsAccount.Count); var id2 = gen.Next(idsAccount.Count - 1); dtMessages.Rows.Add(null, GenHelper.ToTitle(gen.MakeBlah(gen.Next(7))), gen.MakeBlahBlahBlah(5 + gen.Next(100), 7), idsAccount[id1], idsAccount[(id1 + id2 + 1) % idsAccount.Count]); } ds.AcceptChanges(); using (var ms = new System.IO.MemoryStream()) { ds.WriteXml(ms, XmlWriteMode.WriteSchema); ms.Flush(); ms.Position = 0; using (var reader = System.Xml.XmlReader.Create(ms)) { inMemoryDataStore.ReadXml(reader); } } }
public IActionResult GetPURItem(string username) { try { GenHelper.WriteLog("[Log]", "[" + securityProvider.GetUserName() + "]" + controllername + "-GetPURItem(" + username + "):[" + DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss tt") + "]"); List <PurchaseReturnDetail> obj = objectSpace.GetObjects <PurchaseReturnDetail>(CriteriaOperator.Parse("[CreateUser.UserName]=? and isnull([PurchaseReturn])", username)).ToList(); if (obj == null) { return(NotFound()); } return(Ok(obj)); } catch (Exception ex) { GenHelper.WriteLog("[Error]", "[" + securityProvider.GetUserName() + "]" + controllername + "-GetPURItem:[" + ex.Message + "][" + DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss tt") + "]"); throw new Exception(ex.Message); } }