private void btnClose_Click(object sender, EventArgs e) { try { ////DataAccess.SaleInvoice invoice = db.SaleInvoices.Where(s => s.ID == SaleInvoiceId).SingleOrDefault(); ////foreach (var item in invoice.SaleInvoiceDetails) ////{ //// var inv = db.Inventories.Where(s => s.ID == item.InventoryID).SingleOrDefault(); //// inv.ReceiveQuantity = Convert.ToInt32(item.PurchaseQuantity); //// inv.CurrentQuanity = Convert.ToInt32(item.CurrentQuanitity); //// item.Quanitity = Convert.ToInt32(item.PurchaseQuantity) - Convert.ToInt32(item.CurrentQuanitity); ////} ////int rowsSaved = db.SaveChanges(); ////if (rowsSaved > 0) ////{ ////} } catch (Exception ex) { ModuleClass.ShowExceptionMessage(this, ex, "خطأ", null); } }
void GetInvoices() { try { if (rbSearchByDate.Checked) { DateTime from = new DateTime(cmbFrom.DateTime.Year, cmbFrom.DateTime.Month, cmbFrom.DateTime.Day, 0, 0, 0); DateTime to = new DateTime(cmbTo.DateTime.Year, cmbTo.DateTime.Month, cmbTo.DateTime.Day, 23, 59, 59); db = new DataAccess.RedaV1Entities(ModuleClass.Connect()); var list = db.PurchaseInvoices.Where(s => s.BranchID == branchID && s.Date >= from && s.Date <= to).ToList(); bindingSource1.DataSource = list; } else { string query = txtSearch.Text; db = new DataAccess.RedaV1Entities(ModuleClass.Connect()); db.PurchaseInvoices.Where(s => s.Number.Contains(query)).Load(); var list = db.PurchaseInvoices.Local.ToBindingList(); bindingSource1.DataSource = list; } } catch (Exception ex) { ModuleClass.ShowExceptionMessage(this, ex, "خطأ", null); } }
private void btnSave_Click(object sender, EventArgs e) { try { if (MessageBox.Show("هل أنت متأكد من إرجاع الفاتور؟", "إرجاع الفاتور", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.Yes) { var saleInvoice = db.SaleInvoices.Where(s => s.ID == this._invoiceId).SingleOrDefault(); decimal tot = 0; foreach (var item in saleInvoice.SaleInvoiceDetails) { tot += (item.UnitPrice * item.Quanitity); } saleInvoice.Total = tot; saleInvoice.Flag = 2; if (db.SaveChanges() > 0) { this.Close(); } } } catch (Exception ex) { ModuleClass.ShowExceptionMessage(this, ex, "خطأ", null); } }
public ReturnValue editModuleDirName(double id, string dirName) { ReturnValue info = new ReturnValue(); info = ModuleClass.editDirName(id, dirName, this.loginInfo.value); return(info); }
private void Dashboard_Load(object sender, EventArgs e) { try { BranchID = Convert.ToInt32(UserData.Default.BranchID); branchBindingSource.DataSource = db.Branches.ToList(); var branch = db.Branches.Where(s => s.ID == BranchID).SingleOrDefault(); Assembly executingAssembly = Assembly.GetExecutingAssembly(); AssemblyTitleAttribute assembly = executingAssembly.GetCustomAttribute <AssemblyTitleAttribute>(); AssemblyFileVersionAttribute assemblyVersion = executingAssembly.GetCustomAttribute <AssemblyFileVersionAttribute>(); this.Text = assembly.Title + " " + assemblyVersion.Version + " ( " + UserData.Default.UserName + " ) - " + branch.BranchName; var users = from s in db.Users where s.IsEnable == true select s; userBindingSource.DataSource = users.ToList(); cmbUsers.EditValue = 1; cmbSaleInvoiceDateFrom.DateTime = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 0, 0, 0); // cmbSaleInvoiceDateTo.DateTime = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 23, 59, 59); new SaleInvoiceForm(new DataAccess.SaleInvoice(), true, SaleInvoiceType.Sale).Show(); } catch (Exception ex) { ModuleClass.ShowExceptionMessage(this, ex, "خطأ", null); } }
private void AddModuleAtPath(ModuleClass moduleClass, string modulePath) { if (fileWatcher != null) { fileWatcher.WatchFile(modulePath); } var name = Path.GetFileNameWithoutExtension(modulePath); if (name == null) { throw new Exception(String.Format("Invalid skin module path \"{0}\"", modulePath)); } var module = SkinModule.FromXmlFile(modulePath); if (module == null) { isValid = false; return; } Debug.LogWarning("Adding module: " + module.SourcePath + " With class: " + moduleClass); _modules[moduleClass].Add(module); }
public int Update(string userid, int portalid, string culturecode, int idx, int parentid, string code, string name, string image, string description, string status) { string alias = ModuleClass.convertTitle2Link(name); SqlCommand cmd = new SqlCommand("[Articles].[sp_ArticleCategories_Update]", con); cmd.CommandType = CommandType.StoredProcedure; cmd.CommandTimeout = Settings.CommandTimeout; cmd.Parameters.AddWithValue("@userid", userid); cmd.Parameters.AddWithValue("@ip", ip); cmd.Parameters.AddWithValue("@portalid", portalid); cmd.Parameters.AddWithValue("@culturecode", culturecode); cmd.Parameters.AddWithValue("@idx", idx); cmd.Parameters.AddWithValue("@code", code); cmd.Parameters.AddWithValue("@name", name); cmd.Parameters.AddWithValue("@alias", alias); cmd.Parameters.AddWithValue("@parentid", parentid); cmd.Parameters.AddWithValue("@image", image).IsNullable = true; cmd.Parameters.AddWithValue("@description", description); cmd.Parameters.AddWithValue("@status", status); cmd.Parameters.Add(new SqlParameter("@o_return", SqlDbType.Int, 2) { Direction = ParameterDirection.Output }); con.Open(); int i = cmd.ExecuteNonQuery(); int retunvalue = (int)cmd.Parameters["@o_return"].Value; con.Close(); return(retunvalue); }
private void CalculateInventory_Load(object sender, EventArgs e) { try { var item_list = db.Items.ToList(); itemBindingSource.DataSource = item_list; DataAccess.SaleInvoice invoice = db.SaleInvoices.Where(s => s.ID == SaleInvoiceId).SingleOrDefault(); ////foreach (var item in item_list) ////{ //// var InventoryList = db.vw_Inventory.Where(s => s.ItemID == item.ID); //// foreach (var invnt in InventoryList) //// { //// DataAccess.SaleInvoiceDetail saleDetails = db.SaleInvoiceDetails.Create(); //// saleDetails.SaleInvoiceID = SaleInvoiceId; //// saleDetails.CurrentQuanitity = invnt.CurrentQuanity; //// saleDetails.InventoryID = invnt.ID; //// saleDetails.ItemID = item.ID; //// saleDetails.PurchaseQuantity = invnt.ReceiveQuantity; //// saleDetails.Quanitity = invnt.ReceiveQuantity; //// saleDetails.Remarks = "Inv"; //// saleDetails.UnitPrice = invnt.SalePrice; //// invoice.SaleInvoiceDetails.Add(saleDetails); //// } ////} saleInvoiceDetailBindingSource.DataSource = invoice.SaleInvoiceDetails; } catch (Exception ex) { ModuleClass.ShowExceptionMessage(this, ex, "خطأ", null); } }
void FillSaleInvoiceGrid() { try { lblIncomeInvoice.Text = ""; lblNoOfSaleInvoices.Text = ""; int userID = Convert.ToInt32(cmbUsers.GetColumnValue("ID")); DateTime date = cmbSaleInvoiceDateFrom.DateTime; DateTime start = new DateTime(date.Year, date.Month, date.Day, 0, 0, 0); DateTime end = new DateTime(date.Year, date.Month, date.Day, 23, 59, 59); // var list = from s in db.vw_SaleReport where s.Date > start && s.Date < end && s.Flag != 0 select s; var list = from s in db.vw_SaleReport where s.Flag != 0 && s.UserID == userID && s.Date > start && s.Date < end && s.BranchID == BranchID select s; vwSaleReportBindingSource.DataSource = list.ToList(); gridViewSaleInvoice.ExpandAllGroups(); decimal?totalOfSale = (from s in list select s.Total).Sum(); int noOfInvoices = (from s in list where s.Flag == 1 select s.Total).Count(); lblIncomeInvoice.Text = totalOfSale != null?totalOfSale.ToString() : "0"; lblNoOfSaleInvoices.Text = noOfInvoices != null?noOfInvoices.ToString() : "0"; } catch (Exception ex) { ModuleClass.ShowExceptionMessage(this, ex, "خطأ", null); } }
private void btnShowReport_Click(object sender, EventArgs e) { try { FinancialDailyRPT rpt = new FinancialDailyRPT(); DateTime from = cmbDate.DateTime; var summary = db.FinancialSummary(from); if (summary.Any()) { rpt.bindingSource1.DataSource = summary.ToList(); rpt.parameterFrom.Value = cmbDate.DateTime; try { ReportPrintTool tool = new ReportPrintTool(rpt); tool.ShowPreview(); } catch (Exception ex) { ModuleClass.ShowExceptionMessage(this, ex, "خطأ", null); } } } catch (Exception ex) { ModuleClass.ShowExceptionMessage(this, ex, "خطأ", null); } }
private void Dashboard_FormClosing(object sender, FormClosingEventArgs e) { try { if (!normalLogout) { //DataAccess.UserLogin login = db.UserLogins.Create(); //login.Date = DateTime.Now; //login.UserID = Convert.ToInt32(UserData.Default.UserID); //login.Type = true;//Login Out //login.BranchID = BranchID; //db.UserLogins.Add(login); //if (db.SaveChanges() > 0) //{ //} //try //{ // Thread thread = new Thread(() => SendEmail(login, db.Users.Where(s => s.ID == login.UserID).SingleOrDefault())); // thread.Start(); //} //catch (Exception ex) //{ // //Do nothing //} //Shared.SendEmail(login, db.Users.Where(s => s.ID == login.UserID).SingleOrDefault()); } } catch (Exception ex) { ModuleClass.ShowExceptionMessage(this, ex, "خطأ", null); } }
private void txtDiscount_EditValueChanging(object sender, DevExpress.XtraEditors.Controls.ChangingEventArgs e) { try { decimal invoiceTotal = 0; foreach (var item in details) { invoiceTotal += (item.UnitPrice * item.Quanitity); } decimal output = 0; Decimal.TryParse(e.NewValue.ToString(), out output); decimal discount = output; if (discount > (invoiceTotal * 10 / 100)) { errorProvider1.SetError(txtDiscount, "أكبر تخفيض يمكن منحه هو : " + (invoiceTotal * 10 / 100)); e.Cancel = true; } else { errorProvider1.Clear(); } } catch (Exception ex) { ModuleClass.ShowExceptionMessage(this, ex, "خطأ", null); } }
private void btnShowReorderItems_Click(object sender, EventArgs e) { try { int ReorderPoint = Convert.ToInt32(txtReorderPoint.EditValue); //vwInventoryBindingSource.DataSource = null; var list = from s in db.vw_Inventory where s.CurrentQuanity < ReorderPoint && s.BranchID == BranchID select s; ReorderRPT rpt = new ReorderRPT(ReorderPoint.ToString()); rpt.DataSource = list.ToList(); try { //string InvoicePrinter = System.Configuration.ConfigurationManager.AppSettings["InvoicePrinter"]; ReportPrintTool tool = new ReportPrintTool(rpt); tool.ShowPreview(); //Print(InvoicePrinter);// } catch (Exception ex) { ModuleClass.ShowExceptionMessage(this, ex, "خطأ", null); } } catch (Exception ex) { ModuleClass.ShowExceptionMessage(this, ex, "خطأ", null); } }
private void btnGetAll_Click(object sender, EventArgs e) { try { int bId = 0; if (rbReda1.Checked) { bId = 1; } else { bId = 2; } DateTime from = new DateTime(cmbFrom.DateTime.Year, cmbFrom.DateTime.Month, cmbFrom.DateTime.Day, 0, 0, 0); DateTime to = new DateTime(cmbTo.DateTime.Year, cmbTo.DateTime.Month, cmbTo.DateTime.Day, 23, 59, 59); db = new DataAccess.RedaV1Entities(ModuleClass.Connect()); var list = db.PurchaseInvoices.Where(s => s.BranchID == bId && s.Date >= from && s.Date <= to).ToList(); bindingSource1.DataSource = list; } catch (Exception ex) { ModuleClass.ShowExceptionMessage(this, ex, "خطأ", null); } }
void DoPrint(int invoiceID) { decimal cashFromCustomer = Convert.ToDecimal(txtCashFromCustomer.EditValue); decimal CashReturn = Convert.ToDecimal(txtCashReturn.EditValue); Reports.SaleRpt rpt = new SaleRpt(Convert.ToDecimal(txtDiscount.EditValue), Convert.ToDecimal(txtAfterDiscount.EditValue), cashFromCustomer, CashReturn, invoiceID.ToString(), UserData.Default.UserName); ////var list = from s in db.vw_Sale2 where s.SaleInvoiceID == invoiceID select s; ////rpt.DataSource = list.ToList(); rpt.DataSource = rptList.ToList(); ////txtAfterDiscount.EditValue = 0; ////txtInvoiceTotal.EditValue = 0; ////txtDiscount.EditValue = 0; try { ReportPrintTool tool = new ReportPrintTool(rpt); // string InvoicePrinter = System.Configuration.ConfigurationManager.AppSettings["InvoicePrinter"]; if (InvoicePrinter == "") { tool.Print(); } else { tool.Print(InvoicePrinter); } } catch (Exception ex) { ModuleClass.ShowExceptionMessage(this, ex, "خطأ", null); } }
private void gridView1_KeyDown(object sender, KeyEventArgs e) { try { if (e.KeyCode == Keys.Delete)// && e.Modifiers == Keys.Control) { if (MessageBox.Show("حذف ?", "تأكيد الحذف", MessageBoxButtons.YesNo) != DialogResult.Yes) { return; } DataAccess.PurchaseInvoice currentRow = (DataAccess.PurchaseInvoice)gridView1.GetFocusedRow(); if (currentRow.Flag == 1) { MessageBox.Show("You can not delete closed invoice", "Delete Invoice", MessageBoxButtons.OK, MessageBoxIcon.Stop); return; } db.PurchaseInvoices.Remove(currentRow); if (db.SaveChanges() > 0) { ////MainScreen parent = (MainScreen)this.Parent.Parent.Parent.Parent; ////parent.ShowMessageInStatusBar("Item Deleted", 9000); } } } catch (Exception ex) { ModuleClass.ShowExceptionMessage(this, ex, "خطأ", null); } }
private void gridView1_ValidatingEditor(object sender, DevExpress.XtraEditors.Controls.BaseContainerValidateEditorEventArgs e) { try { ////if (gridView1.FocusedColumn == colName) ////{ //// if (e.Value == null || ((string)e.Value) == string.Empty) //// { //// e.Valid = false; //// e.ErrorText = "Name must have a value"; //// } //// else //// if (e.Value.ToString().Length > 50) //// { //// e.Valid = false; //// } ////} ////else //// if (gridView1.FocusedColumn == colCategoryID) //// { //// if (e.Value == null || ((string)e.Value) == string.Empty) //// { //// e.Valid = false; //// e.ErrorText = "Category must have a value"; //// } //// } } catch (Exception ex) { ModuleClass.ShowExceptionMessage(this, ex, "خطأ", null); } }
public Login() { try { InitializeComponent(); //string connString = ModuleClass.Connect(); //DataAccess.RedaV1Entities db = ModuleClass.GetConnection();//= new DataAccess.RedaV1Entities(ModuleClass.Connect()); db = ModuleClass.GetConnection(); DevExpress.UserSkins.BonusSkins.Register(); Assembly executingAssembly = Assembly.GetExecutingAssembly(); AssemblyTitleAttribute assembly = executingAssembly.GetCustomAttribute <AssemblyTitleAttribute>(); AssemblyFileVersionAttribute assemblyVersion = executingAssembly.GetCustomAttribute <AssemblyFileVersionAttribute>(); this.Text = assembly.Title + " " + assemblyVersion.Version;// +" ( " + UserData.Default.UserName + " ) ";// +branch.BranchName; SkinContainerCollection skins = SkinManager.Default.Skins; for (int i = 0; i < skins.Count; i++) { cmbTheme.Properties.Items.Add(skins[i].SkinName); } LoadData(); } catch (Exception ex) { ModuleClass.ShowExceptionMessage(this, ex, "خطأ", null); } }
private int AddData() { int SkinPackage_ID = Convert.ToInt32(ddlPackageList.SelectedValue); string ControlKey = txtControlKey.Text; HttpPostedFile File_ControlSrc = FileInput.PostedFile; string ControlSrc = ""; if ((File_ControlSrc != null) && (File_ControlSrc.ContentLength > 0)) { ControlSrc = System.IO.Path.GetDirectoryName(File_ControlSrc.FileName); } /*** UPLOAD *************************************************************************************************************/ HttpPostedFile icon_file = FileInput.PostedFile; string IconFile = ""; if (icon_file.ContentLength > 0) { ModuleClass module_obj = new ModuleClass(); IconFile = module_obj.GetEncodeString(System.IO.Path.GetFileName(icon_file.FileName)); string savePath = Path.Combine(skin_img_path, IconFile); icon_file.SaveAs(savePath); } /************************************************************************************************************************/ SkinControl skin_control_obj = new SkinControl(); int i = skin_control_obj.Insert(SkinPackage_ID, ControlKey, ControlSrc, IconFile); return(i); }
private void button1_Click(object sender, EventArgs e) { try { DataAccess.Inventory inv; var list = db.SaleInvoices.Where(s => s.Remarks.Contains("Reda")); foreach (var item in list.ToList()) { item.Flag = 1; // if (item.ID > 36650) { foreach (var child in item.SaleInvoiceDetails.ToList()) { inv = db.Inventories.Where(s => s.ID == child.InventoryID).SingleOrDefault(); inv.CurrentQuanity -= child.Quanitity; if (db.SaveChanges() > 0) { } } } } } catch (Exception ex) { ModuleClass.ShowExceptionMessage(this, ex, "خطأ", null); } }
public int Delete(string userid, int idx) { // Write your own Delete statement blocks. string dir_path = HttpContext.Current.Server.MapPath(System.Configuration.ConfigurationManager.AppSettings["upload_image_dir"]) + "/article_category_images"; string file_name = GetImageByID(idx); if (file_name != null) { ModuleClass module_obj = new ModuleClass(); module_obj.deleteFile(file_name, dir_path); } SqlCommand cmd = new SqlCommand("[Articles].[sp_ArticleCategories_Delete]", con) { CommandType = CommandType.StoredProcedure, CommandTimeout = Settings.CommandTimeout }; cmd.Parameters.AddWithValue("@userid", userid); cmd.Parameters.AddWithValue("@ip", ip); cmd.Parameters.AddWithValue("@idx", idx); cmd.Parameters.Add(new SqlParameter("@o_return", SqlDbType.Int) { Direction = ParameterDirection.Output }); con.Open(); cmd.ExecuteNonQuery(); int retunvalue = (int)cmd.Parameters["@o_return"].Value; con.Close(); return(retunvalue); }
public static bool SendDailyInventoryStatus(int branchID, DateTime dateFrom, DateTime toFrom) { try { DateTime from = new DateTime(dateFrom.Year, dateFrom.Month, dateFrom.Day, 0, 0, 0); DateTime to = new DateTime(toFrom.Year, toFrom.Month, toFrom.Day, 23, 59, 59); var db = ModuleClass.GetConnection(); var list = db.vw_ReorderItem.Where(s => s.Date > from && s.Date < to && s.BranchID == branchID && s.CurrentQuanity <= s.ReorderPoint && s.CategoryID != 2013).ToList(); if (list.Count() == 0) { return(true); } string message = " ---- ملخص كميات الأصناف رضا" + branchID + " -----" + Environment.NewLine; foreach (var item in list) { message += item.Name + " " + item.CurrentQuanity + Environment.NewLine; } int codeId = (int)PushOverMessageType.DailyInventoryStatus; var receivers = GetReceiver(codeId); var title = GetTitle(codeId); return(SendPushMessage(message, receivers, title)); } catch (Exception ex) { return(false); } }
private int AddData() { string userid = Session["UserId"].ToString(); int portalid = Convert.ToInt32(ddlPortalList.SelectedValue); int typeid = Convert.ToInt32(ddlMediaTypeList.SelectedValue); string title = txtTitle.Text; string description = txtDescription.Text; /*** UPLOAD *************************************************************************************************************/ string dir_path = "~/" + System.Configuration.ConfigurationManager.AppSettings["upload_background_audio_dir"]; HttpPostedFile posted_file = FileInput.PostedFile; string filename = ""; if (posted_file.ContentLength > 0) { ModuleClass module_obj = new ModuleClass(); filename = module_obj.GetEncodeString(System.IO.Path.GetFileName(posted_file.FileName)); string savePath = Server.MapPath(dir_path + "/" + filename); posted_file.SaveAs(savePath); } /************************************************************************************************************************/ MediaFiles media_obj = new MediaFiles(); //int i = media_obj.Insert(userid,portalid,typeid,filename, title, description); int i = 0; return(i); }
public static bool SendItemWithoutBarcode(int branchID, DateTime dateFrom, DateTime toFrom) { try { DateTime from = new DateTime(dateFrom.Year, dateFrom.Month, dateFrom.Day, 0, 0, 0); DateTime to = new DateTime(toFrom.Year, toFrom.Month, toFrom.Day, 23, 59, 59); var db = ModuleClass.GetConnection(); var list = db.vw_ReorderItem.Where(s => s.Date > from && s.Date < to && s.BranchID == branchID && s.Remarks != null && s.CategoryID != 2013).ToList(); if (list.Count() == 0) { return(true); } string message = " ملخص الأصناف بدون باركود رضا" + branchID + " " + Environment.NewLine; foreach (var item in list) { message += item.Name + " " + item.Remarks + " " + item.UserName + Environment.NewLine; } int codeId = (int)PushOverMessageType.ItemWithoutBarcode; var receivers = GetReceiver(codeId); var title = GetTitle(codeId); return(SendPushMessage(message, receivers, title)); } catch (Exception ex) { return(false); } //return PushMessage.SendPushMessage(message, title); }
private void listBoxControl1_SelectedValueChanged(object sender, EventArgs e) { try { if (popupContainerEdit1.IsPopupOpen && listBoxControl1.SelectedItem != null) { Console.WriteLine("SelectedValueChanged: " + listBoxControl1.SelectedItem.ToString()); popupContainerEdit1.ClosePopup(); if (listBoxControl1.SelectedValue is ItemObject) { var itemObj = (ItemObject)listBoxControl1.SelectedItem; lblItem.Text = itemObj.Name.ToString(); var val = itemObj.Data; itemID = Convert.ToInt32(val); popupContainerEdit1.Text = itemObj.Name.ToString(); } //popupContainerControl1.Hide(); } } catch (Exception ex) { ModuleClass.ShowExceptionMessage(this, ex, "خطأ", null); } }
private void txtBar_KeyDown_1(object sender, KeyEventArgs e) { try { if (e.KeyCode == Keys.Enter) { string barcodeText = txtBar.Text; if (txtBar.Text != "") { if (txtBar.Text.Length >= 6) { var ItemsFound = db.ItemBarcodes.Local.Where(s => s.BarcodeText == barcodeText); var ItemIDs = ItemsFound.Select(s => s.ItemID).First(); var item = db.Items.Local.Where(s => s.ID == ItemIDs).First(); if (ItemIDs != null) { // lblItem.Text = itemObj.Name.ToString(); popupContainerEdit1.Text = item.Name.ToString(); lblItem.Text = item.Name.ToString(); } } } } } catch (Exception ex) { ModuleClass.ShowExceptionMessage(this, ex, "خطأ", null); } }
private void txtBar_KeyDown(object sender, KeyEventArgs e) { try { if (e.KeyCode == Keys.Enter) { string barcodeText = txtBar.Text; if (txtBar.Text != "") { if (txtBar.Text.Length >= 6) { var ItemsFound = db.ItemBarcodes.Local.Where(s => s.BarcodeText == barcodeText); var ItemIDs = ItemsFound.Select(s => s.ItemID); if (ItemIDs != null && ItemIDs.Any()) { } else { this.bindingSourceInventory.DataSource = null; MessageBox.Show("هذا الصنف غير متوفر"); txtBar.Text = ""; //lblInventoryQuantity.Text = ""; //lblItemName.Text = ""; } } } } } catch (Exception ex) { ModuleClass.ShowExceptionMessage(this, ex, "خطأ", null); } }
private void btnAddZainBalance_Click(object sender, EventArgs e) { try { InputBox.SetLanguage(InputBox.Language.English); //Save the DialogResult as res DialogResult res = InputBox.ShowDialog("القيمة:", " رصيد زين جديد", InputBox.Icon.Question, InputBox.Buttons.OkCancel, InputBox.Type.TextBox, new string[] { "Item1", "Item2", "Item3" }, true, new System.Drawing.Font("Calibri", 10F, System.Drawing.FontStyle.Bold)); //Check InputBox result if (((InputBox.ResultValue != "") && (res == System.Windows.Forms.DialogResult.OK || res == System.Windows.Forms.DialogResult.Yes))) { Decimal amount = Convert.ToDecimal(InputBox.ResultValue); _shift.ZainVoucherMachineBalanceStart += amount; //txtZainVoucherMachineBalanceStart.EditValue = _shift.ZainVoucherMachineBalanceStart; shiftBindingSource.ResetBindings(true); CalculateNetAmounts(); } } catch (Exception ex) { ModuleClass.ShowExceptionMessage(this, ex, "خطأ", null); } }
private void btnShiftStart_Click(object sender, EventArgs e) { try { if (isValid() && MessageBox.Show("هل أنت متأكد من صحة بيانات الوردية و حالة جميع الأجهزة؟", "الرجاء التأكد من البيانات قبل بدء الوردية", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.Yes) { if (db.SaveChanges() > 0) { DataAccess.ShiftUser shiftUser = db.ShiftUsers.Create(); shiftUser.ShiftID = _shift.ID; shiftUser.UserID = _shift.UserId; shiftUser.LogInTime = DateTime.Now; shiftUser.LogoutTime = DateTime.Now; shiftUser.Duration = 0; shiftUser.Flag = 0; _shift.ShiftUsers.Add(shiftUser); if (db.SaveChanges() > 0) { ModuleClass.shiftID = _shift.ID; if (!SendDevicesStatus()) { MessageBox.Show("لم يستطع النظام ارسال حالة الأجهزة عن طريق رسائل الموبايل \nالرجاء تبليغ الإدارة بواسطة التلفون"); } this.Hide(); //new SaleInvoiceForm(new DataAccess.SaleInvoice(), true, SaleInvoiceType.Sale).Show(); new NormalUserForm(db).Show(); } } } } catch (Exception ex) { ModuleClass.ShowExceptionMessage(this, ex, "خطأ", null); } }
private void listBoxUsers_SelectedIndexChanged(object sender, EventArgs e) { try { if (listBoxUsers.SelectedItem != null) { ////int userId = Convert.ToInt32(listBoxUsers.GetItemValue(listBoxUsers.SelectedIndex)); ////var loginTime = db.UserLogins.Where(s => s.UserID == userId && s.Type == false && s.Date.Day == cmbDate.DateTime.Day && s.Date.Month == cmbDate.DateTime.Month && s.Date.Year == cmbDate.DateTime.Year).Select(s => s.Date); ////var LogoutTime = db.UserLogins.Where(s => s.UserID == userId && s.Type == true && s.Date.Day == cmbDate.DateTime.Day && s.Date.Month == cmbDate.DateTime.Month && s.Date.Year == cmbDate.DateTime.Year).Select(s => s.Date); ////if (loginTime != null && loginTime.Count() > 0) ////{ //// var first = (from s in loginTime select s).Min(); //// lblLginTime.Text = first.TimeOfDay.ToString(); ////} ////else ////{ //// lblLginTime.Text = "0"; ////} ////if (LogoutTime != null && LogoutTime.Count() > 0) ////{ //// var last = (from s in loginTime select s).Max(); //// lblLogoutTime.Text = last.TimeOfDay.ToString(); ////} ////else ////{ //// lblLogoutTime.Text = "0"; ////} } } catch (Exception ex) { ModuleClass.ShowExceptionMessage(this, ex, "خطأ", null); } }
public void Apply(ModuleClass moduleClass) { if (!isValid) { Debug.LogWarning("Trying to apply an invalid skin"); return; } _currentModuleClass = moduleClass; Debug.LogWarning("Trying to load modules for class: " + moduleClass); if (!_applicator.Apply(_modules[moduleClass])) { _applicator.Rollback(); Debug.LogWarning("Failed to apply skin module (look for an error in the messages above). All changes have been reverted."); isValid = false; } SetCameraRectHelper.CameraRect = renderArea; }
private void CheckAndLoadOverride(ModuleClass moduleClass) { var overridePath = Path.Combine(Core.OverrideDirectory, String.Format("{0}_{1}.xml", name, moduleClass.ToString())); if (File.Exists(overridePath)) { Debug.LogWarningFormat("Found override for skin \"{0}\" at \"{1}\"", name, overridePath); AddModuleAtPath(moduleClass, overridePath); } }
public void ApplyStickyProperties(ModuleClass moduleClass) { if (!isValid) { return; } _applicator.ApplyStickyProperties(); }