public JsonResult Form(ReadForm form) { form.UserID = UserSession.UserID; var read = Facade <UserActionFacade>().Reading(form); return(Json(read, JsonRequestBehavior.AllowGet)); }
public BaseForm getForm(typeForm type, string cnnString, string tableName, BaseForm rootForm) { BaseForm res = null; switch (type) { case typeForm.ADD: res = new AddForm(cnnString, tableName); return(res); case typeForm.READ: res = new ReadForm(cnnString, tableName); return(res); case typeForm.UPDATE: res = new UpdateForm(cnnString, tableName); return(res); case typeForm.DELETE: res = new DeleteForm(cnnString, tableName); return(res); case typeForm.HASFORMS: res = new FormHasForms(cnnString, tableName, rootForm); return(res); default: return(res); } }
public BaseForm getForm(typeForm type, AbstractController controller, string tableName) { BaseForm res = null; switch (type) { case typeForm.ADD: res = new AddForm(controller, tableName); return(res); case typeForm.READ: res = new ReadForm(controller, tableName); return(res); case typeForm.UPDATE: res = new UpdateForm(controller, tableName); return(res); case typeForm.DELETE: res = new DeleteForm(controller, tableName); return(res); default: return(res); } }
public RedirectResult Read(int id, string url, int seriesID = 0, IList <int> listIDs = null) { var session = UserSession; // mark as read var readForm = new ReadForm { UserID = session.UserID, SourceID = id, SourceTable = R.SourceTable.RELEASE }; Facade <UserActionFacade>().Reading(readForm); // add series to list if (seriesID > 0 && listIDs != null) { foreach (var listID in listIDs) { var form = new ConnectorForm { ByUserID = UserSession.UserID, ConnectorType = R.ConnectorType.SERIES_USERLIST, SourceID = seriesID, TargetID = listID }; Facade <ConnectorFacade>().AddConnector(form); } } return(RedirectPermanent(url)); }
public static void read <T>(out T x, string s = "read: ") { x = default(T); if (x == null) { x = (T)(object)(" "); } var rf = new ReadForm(s); rf.ShowDialog(); if (rf.DialogResult == System.Windows.Forms.DialogResult.OK) { var result = rf.Result; if (x.IsNumericType()) { x = (T)((object)double.Parse(result, System.Globalization.CultureInfo.InvariantCulture)); } if (x is string) { x = (T)((object)(result)); } if (x is System.Numerics.Complex) { x = (T)((object)MathNet.Numerics.ComplexExtensions.ToComplex(result, System.Globalization.CultureInfo.InvariantCulture)); } } CONSOLE_OUTPUT(System.Environment.NewLine + s + " " + objectToString(x)); }
private void button2_Click(object sender, EventArgs e) { using (var fldrDlg = new OpenFileDialog()) { if (fldrDlg.ShowDialog() == DialogResult.OK) { string res = ""; for (int i = 0; i < text.Length; i++) { for (int j = 0; j < symbols.Count; j++) { if (text.Substring(i, 1).Equals(symbols[j].symbol)) { res += symbols[j].code; break; } } } List <byte> bytes = new List <byte>(); byte current = 0; byte current_id = 0; for (int i = 0; i < res.Length; i++) { if (current_id == 8) { bytes.Add(current); current = 0; current_id = 0; } if (res[i].Equals('1')) { current = (byte)((current << 1) + 1); } else { current = (byte)(current << 1); } current_id++; } ReadForm r = new ReadForm(); r.textBox1.Text = res; r.Show(); File.WriteAllBytes(fldrDlg.FileName, bytes.ToArray()); } } }
public int Reading(ReadForm form) { form.ByUserID = form.UserID; // byUserID has to be the UserID using (var uow = UnitOfWorkFactory.Create <NovelContext>()) { var service = new UserActionService(uow); var id = service.Reading(form); var read = service.SummarizeRead(form); return(read); } }
private void openByteArrayToolStripMenuItem_Click(object sender, EventArgs e) { using (var fldrDlg = new OpenFileDialog()) { if (fldrDlg.ShowDialog() == DialogResult.OK) { byte[] array = File.ReadAllBytes(fldrDlg.FileName); string code = ""; string current_code = ""; for (int i = 0; i < array.Length; i++) { BitArray bitArray = new BitArray(new[] { array[i] }); for (int j = 7; j > -1; j--) { if (bitArray[j] == true) { code += "1"; } else { code += "0"; } } } for (int i = 0; i < code.Length; i++) { foreach (Symbol s in symbols) { if (current_code.Equals(s.code)) { Console.Write(current_code + " "); text += s.symbol; current_code = ""; break; } } current_code += code[i]; } FileInfo info = new FileInfo(fldrDlg.FileName); fileWeight.Text = "Вес файла: " + info.Length + " байт"; //byte_array = File.ReadAllBytes(fldrDlg.FileName); comboBox1.Enabled = false; ReadForm r = new ReadForm(); r.textBox1.Text = text; r.Show(); } } }
public int Reading(ReadForm form) { var tUserRead = Table <UserRead>(); var userRead = tUserRead.GetOrAdd(w => w.UserID == form.UserID && w.SourceID == form.SourceID && w.SourceTable == form.SourceTable); MapProperty(form, userRead); UpdateAuditFields(userRead, form.ByUserID); // save SaveChanges(); return(userRead.ID); }
public int SummarizeRead(ReadForm form) { var tUserRead = View <UserRead>(); var tSummarize = Table <Summarize>(); var summarize = tSummarize.GetOrAdd(w => w.SourceID == form.SourceID && w.SourceTable == form.SourceTable); MapProperty(form, summarize); UpdateAuditFields(summarize, form.ByUserID); summarize.ReadCount = tUserRead.Where(w => w.SourceID == form.SourceID && w.SourceTable == form.SourceTable).Count(); // save SaveChanges(); return(summarize.ReadCount); }
public void ReadDevice_Event(object sender, EventArgs e) { ReadForm readForm = new ReadForm(this); readForm.Height = 84; int num = (int)readForm.ShowDialog(); this.LoadSettingsToProgramConfig(); this.UpdateTooltips(); }