private void btnUpdate_Click(object sender, EventArgs e) { if (JMessages.Question(" آیا از ویرایش مبلغ پرداختی توزین مطمئن هستید ؟ ", "") != DialogResult.Yes) { return; } JTransferData tmpJTransferData = new JTransferData(); JDataBase dbMain = tmpJTransferData.CreateConMainServer(false); try { dbMain.setQuery(" Update BascolWeights set Pay_h= " + txtPrice.IntValue + " Where Code=" + _Code + " And UserPostCode=" + JMainFrame.CurrentPostCode); if (dbMain.Query_Execute() > 0) { JMessages.Information(" تایید شد ", ""); } else { JMessages.Error(" خطا در ثبت ", ""); } } finally { dbMain.Dispose(); } }
private void Transfer(bool msg) { JTransferData tmp = new JTransferData(); try { if (!(tmp.Transfer())) { if (msg) { JMessages.Error(" انتقال با مشکل مواجه شده است ", ""); } } else { if (msg) { JMessages.Information(" انتقال با موفقیت انجام گردید ", ""); } } //JSystem.Nodes.CurrentAction = JSystem.Nodes.CurrentAction; } catch (Exception ex) { JSystem.Except.AddException(ex); } finally { tmp.Dispose(); } }
private void btnReturnConfirm_Click(object sender, EventArgs e) { if (jJanusGrid1.SelectedRow == null) { return; } _Code = Convert.ToInt32(jJanusGrid1.SelectedRow.Row["Code"]); if (_Code == 0) { JMessages.Information(" از لیست رکوردی را انتخاب کنید ", ""); return; } if (JMessages.Question(" آیا می خواهید تایید برگشت شود ؟ ", "") == DialogResult.Yes) { JWeight tmpWeight = new JWeight(); foreach (DataRow dr in jJanusGrid1.DefaultView.Rows) { tmpWeight.GetData(Convert.ToInt32(dr["Code"])); tmpWeight.verify = false; if (!(tmpWeight.Update())) { JMessages.Error(" ویرایش با خطا مواجه شد ", ""); return; } } JMessages.Information(" ویرایش با موفقیت انجام شد ", ""); btnSearch_Click(null, null); } }
private void btnback_del_Click(object sender, EventArgs e) { if (jJanusGrid1.SelectedRow == null) { return; } _Code = Convert.ToInt32(jJanusGrid1.SelectedRow.Row["Code"]); if (_Code == 0) { JMessages.Information(" از لیست رکوردی را انتخاب کنید ", ""); return; } if (JMessages.Question(" آیا می خواهید عملیات حذف برگشت شود ؟ ", "") == DialogResult.Yes) { JWeight tmpWeight = new JWeight(_Code); tmpWeight.dele = false; if (tmpWeight.Update()) { JMessages.Information(" ویرایش با موفقیت انجام شد ", ""); btnSearch_Click(null, null); } else { JMessages.Error(" ویرایش با خطا مواجه شد ", ""); } } }
/// <summary> /// //////////////Port////////////////////////////////////////////////////// /// </summary> private void InitComPort() { try { // Set the com port to be 1 com.PortName = "COM1"; if (com.IsOpen) { com.Close(); } com.Open(); // This port is already open, then close. if (!(com.IsOpen)) { JMessages.Information(" ارتباط بر قرار نشد ", ""); return; } // Trigger the OnComm event whenever data is received //com.RThreshold = 1; com.ReceivedBytesThreshold = 1; // Set the port to 1200 baud, no parity bit, 8 data bits, 1 stop bit (all standard) //com.BaudRate = "1200,n,8,1"; com.BaudRate = 1200; com.Parity = System.IO.Ports.Parity.None; com.DataBits = 8; com.StopBits = System.IO.Ports.StopBits.One; // Force the DTR line high, used sometimes to hang up modems //com.DTREnable = true; com.RtsEnable = true; //com.RTSEnable = true; // No handshaking is used //com.Handshaking = MSCommLib.HandshakeConstants.comNone; com.Handshake = System.IO.Ports.Handshake.None; // Use this line instead for byte array input, best for most communications //com.InputMode = MSCommLib.InputModeConstants.comInputModeText; //com.inp // Read the entire waiting data when com.Input is used //com.InputLen = 0; // Don't discard nulls, 0x00 is a useful byte com.DiscardNull = false; // Attach the event handler // com.OnComm += new System.EventHandler(this.com_OnComm); //com.PortOpen = true; } catch (Exception ex) { JSystem.Except.AddException(ex); } }
public void TotalPrice() { int Sum = 0; foreach (DataRow dr in Nodes.CurrentRows) { Sum = Sum + Convert.ToInt32(dr["Pay"]); } JMessages.Information(JGeneral.MoneyStr(Sum.ToString()) + " ریال ", " جمع کل "); }
private void btnSave_Click(object sender, EventArgs e) { if (!(JPermission.CheckPermission("Bascol.JConfigBascolForm.btnSave_Click"))) { return; } if (JReport.SetBascoolNumber(Convert.ToInt32(cmbBascol.SelectedValue), cmbBascolType.SelectedIndex)) { JMessages.Information(" با موفقیت ثبت شد ", ""); } //Globals.JRegistry.Write("BascolNum", cmbBascol.SelectedValue); //Globals.JRegistry.Write("BascolType", cmbBascolType.Text); }
private void Bedehi() { if ((txtPlak1.Text != "") && (cmbPlak.Text != "") && (txtPlak2.Text != "") && (txtPlak3.Text != "") && (txtPlak1.Text.Length == 2) && (txtPlak2.Text.Length == 3) && (txtPlak3.Text.Length == 2)) { string str = txtPlak1.Text + cmbPlak.Text + txtPlak2.Text + "-" + txtPlak3.Text; lblBedehkari.Text = JWeight.GetBedehi(str, Convert.ToInt32(cmbTruck.SelectedValue.ToString())).ToString(); lblBedehkariName.Text = ""; lblB.Text = ""; if (Convert.ToInt32(lblBedehkari.Text) > 0) { lblB.Text = lblB.Text + " بدهکار به آقای"; } else if (Convert.ToInt32(lblBedehkari.Text) < 0) { lblB.Text = lblB.Text + "طلبکار از آقای "; } if (lblBedehkari.Text != "0") { txtPay.Text = (Convert.ToInt32(_Price) + Convert.ToInt32(lblBedehkari.Text)).ToString(); lblBedehkariName.Text = JWeight.GetBedehiName(str); lblBedehkariName.Text = lblB.Text + lblBedehkariName.Text + " می باشد "; if (lblBedehkariName.Text != "") { if (Convert.ToInt32(lblBedehkari.Text) < 0) { JMessages.Information(" این ماشین " + lblBedehkariName.Text + " ", "طلبکاری"); } else { JMessages.Information(" این ماشین " + lblBedehkariName.Text + " ", "بدهکاری"); } } } if (Convert.ToInt32(lblBedehkari.Text) < 0) { Talab = -1; lblBedehkari.Text = (Convert.ToInt32(lblBedehkari.Text)).ToString(); //* Talab } else { Talab = 1; } //if (ClassLibrary.JPing.Ping("192.168.3.38")) //{ // if (JReport.GetBlackList(str).Rows.Count > 0) // JMessages.Error(" این ماشین در لیست سیاه است ", ""); //} } }
public void DelBlackList(int pBascoolID) { JTransferData tmpJTransferData = new JTransferData(); JDataBase dbMain = tmpJTransferData.CreateConMainServer(false); try { dbMain.setQuery(" Delete From bascoolblacklist Where BascoolID=" + pBascoolID); if (dbMain.Query_Execute() > 0) { JMessages.Information(" ماشین از لیست سیاه حذف شد ", ""); } else { JMessages.Error(" خطا در ثبت ", ""); } } finally { dbMain.Dispose(); } }
public void AddBlackList(int pBascoolID) { JTransferData tmpJTransferData = new JTransferData(); JDataBase dbMain = tmpJTransferData.CreateConMainServer(false); try { dbMain.setQuery(" Insert into bascoolblacklist values(" + pBascoolID + ")"); if (dbMain.Query_Execute() > 0) { JMessages.Information(" ماشین در لیست سیاه قرار گرفت ", ""); } else { JMessages.Error(" خطا در ثبت ", ""); } } finally { dbMain.Dispose(); } }
private void btnEdit_Click(object sender, EventArgs e) { //JConnectionForm con = new JConnectionForm(); //con.ShowDialog(); try { JTruck tmpTruck = new JTruck(); if (tmpTruck.Update(_dtTrucks)) { JMessages.Information(" ویرایش با موفقیت انجام گردید ", ""); } else { JMessages.Error(" ویرایش با موفقیت انجام نگردید ", ""); } } catch (Exception ex) { JBase.Except.AddException(ex); JMessages.Error(" ویرایش با موفقیت انجام نگردید ", ""); } }
private void btnClear_Click(object sender, EventArgs e) { JWeight tmpWeight = new JWeight(); DataTable tmpdt; try { tmpdt = JWeights.GetLastDataTable(); if ((tmpdt != null) && (tmpdt.Rows.Count > 0)) { tmpWeight.GetData(Convert.ToInt32(tmpdt.Rows[0]["Code"])); if (tmpWeight.verify == true) { JMessages.Error(" این تورین تایید مالی شده و قابل تغییر نمی باشد ", ""); return; } tmpWeight.pay_h = Convert.ToInt32(txtPay.Text); if (tmpWeight.Update()) { JMessages.Information(" ویرایش با موفقیت انجام شد ", ""); } else { JMessages.Error(" خطا در ویرایش ", ""); } } else { JMessages.Error(" رکوردی با این کاربری پیدا نشد ", ""); } } catch (Exception ex) { JSystem.Except.AddException(ex); } }
private void btnSave_Click(object sender, EventArgs e) { bool Error = false; if (chbUsers.CheckedItems.Count == 0) { return; } if (chbUsers.CheckedItems.Count > 1) { if (JMessages.Warning("تعداد " + chbUsers.CheckedItems.Count.ToString() + " نفر جهت ارجاع انتخاب شده است. آیا مطمئن هستید؟", "ارجاع به چند نفر") != DialogResult.OK) { return; } } List <string> Recivers = new List <string>(); for (int i = 0; i < chbUsers.CheckedItems.Count; i++) { Recivers.AddRange((chbUsers.CheckedItems[i] as JKeyValue).Value.ToString().Split(';')); } JDataBase db = new JDataBase(); try { foreach (string Reciver in Recivers) { int d; if (int.TryParse(Reciver, out d)) { Employment.JEOrganizationChart jeoc = new Employment.JEOrganizationChart(d); Automation.JARefer tmprefer = new Automation.JARefer(); tmprefer.send_date_time = JDateTime.Now(); tmprefer.sender_code = JMainFrame.CurrentUserCode; tmprefer.sender_full_title = JMainFrame.CurrentPostTitle; tmprefer.sender_post_code = JMainFrame.CurrentPostCode; tmprefer.receiver_code = Convert.ToInt32(jeoc.user_code); tmprefer.receiver_full_title = jeoc.full_Name; tmprefer.receiver_post_code = d; tmprefer.register_user_code = JMainFrame.CurrentUserCode; tmprefer.register_Date_Time = JDateTime.Now(); tmprefer.status = ClassLibrary.Domains.JAutomation.JReferStatus.Current; tmprefer.is_active = true; tmprefer.ReferGroup = 1; tmprefer.parent_code = _ParentRefer; tmprefer.description = txtComment.Text; tmprefer.WorkFlowCode = ((JWorkFlow)cmbNextNodes.SelectedItem).Code; tmprefer.object_code = tmprefer.SendToAutomation(_ObjectCode, "", _title, _ClassName, _DynamicClassName, db, JMainFrame.CurrentPostTitle, JMainFrame.CurrentPostCode, JMainFrame.CurrentUserCode, false); if (tmprefer.Send(db, true) > 0) { ((JWorkFlow)cmbNextNodes.SelectedItem).RUNSQL(); ((JWorkFlow)cmbNextNodes.SelectedItem).RUNACTION(); _ReferCode = tmprefer.Code; if (_ParentRefer > 0) { jArchiveList1.ObjectCode = _ParentRefer; jArchiveList1.ArchiveList(); } } else { Error = true; JMessages.Error("اتوماسیون با خطا مواجه شد.", "اتوماسیون"); } } } if (!Error) { JMessages.Information("با موفقیت ارجاع داده شد.", "اتوماسیون"); this.Close(); DialogResult = DialogResult.OK; this.Close(); } } finally { db.Dispose(); } }
private void btnExportToBank_Click(object sender, EventArgs e) { #region Validate if (txtDesc.Text.Trim() == "") { JMessages.Error("لطفا شرح سند را وارد کنید.", ""); return; } if (grdReport.DataSource == null || grdReport.gridEX1.CurrentTable.Columns["OwnerCode"].EditType != Janus.Windows.GridEX.EditType.NoEdit || grdReport.gridEX1.CurrentTable.Columns["BusCode"].EditType != Janus.Windows.GridEX.EditType.NoEdit || grdReport.gridEX1.CurrentTable.Columns["BusNumber"].EditType != Janus.Windows.GridEX.EditType.NoEdit || grdReport.gridEX1.CurrentTable.Columns["OwnerName"].EditType != Janus.Windows.GridEX.EditType.NoEdit || grdReport.gridEX1.CurrentTable.Columns["SumPrice"].EditType != Janus.Windows.GridEX.EditType.NoEdit || grdReport.gridEX1.CurrentTable.Columns["Count"].EditType != Janus.Windows.GridEX.EditType.NoEdit) { JMessages.Error("لطفا ابتدا مشاهده خروجی را کلیک کنید.", ""); return; } if (grdReport.DataSource.Rows.Count == 0) { JMessages.Error("هیچ تراکنشی برای این تاریخ ها ثبت نشده است.", ""); return; } #endregion Validate if (JMessages.Question("پس از بستن سند، قادر به تغییرات نخواهید بود. آیا میخواهید بستن انجام شود؟", "بستن تراکنشها") == System.Windows.Forms.DialogResult.Yes) { JDataBase db = new JDataBase(); try { #region Save Document JAUTDocument document = new JAUTDocument(db, _Code); document.Description = txtDesc.Text; document.IssueDate = txtIssuDate.Date; document.AllDates = chAllDates.Checked; document.Register_Full_Title = JMainFrame.CurrentPostTitle; document.Register_Post_Code = JMainFrame.CurrentPostCode; document.Register_User_Code = JMainFrame.CurrentUserCode; db.beginTransaction("SaveDocument"); if (_Code > 0) { if (JAUTDocumentDates.DeleteDates(db, _Code) < 0) { throw new Exception(); } document.Update(db); } else { _Code = document.Insert(db); if (_Code == 0) { throw new Exception(); } } if (_Code > 0) { for (int i = 0; i < chListDates.Items.Count; i++) { JAUTDocumentDate date = (JAUTDocumentDate)chListDates.Items[i]; date.DocumentCode = _Code; date.IsIssued = chListDates.GetItemChecked(i); if (date.Insert(db) == 0) { throw new Exception(); } } } else { throw new Exception(); } #endregion Save #region Save Details DateTime[] dates = new DateTime[0]; int j = 0; for (int i = 0; i < chListDates.Items.Count; i++) { if ((!chAllDates.Checked && chListDates.GetItemChecked(i)) || chAllDates.Checked) { Array.Resize(ref dates, dates.Length + 1); dates[j++] = ((JAUTDocumentDate)chListDates.Items[i]).Date; } } int[] owners = new int[0]; DataTable SelectedOwners = grdReport.DataSource; foreach (DataRow row in SelectedOwners.Rows) { // if (Convert.ToBoolean(row["BeClosed"])) { Array.Resize(ref owners, owners.Length + 1); owners[owners.Length - 1] = Convert.ToInt32(row["OwnerCode"]); } } if (Reports.JDailyPerformanceRportOnBus.SetReportDocumentCode(db, dates, owners, _Code) < 0) { throw new Exception(); } else { JAUTDocument doc = new JAUTDocument(db, _Code); doc.IsClosed = true; doc.Update(db); #region Insert Details foreach (DataRow row in SelectedOwners.Rows) { // if (Convert.ToBoolean(row["BeClosed"])) { JAUTDocumentDetail detail = new JAUTDocumentDetail(); detail.DocumentCode = _Code; detail.CardCount = Convert.ToInt32(row["Count"]); detail.Amount = Convert.ToDecimal(row["SumPrice"]); detail.OwnerPCode = Convert.ToInt32(row["OwnerCode"]); detail.BusCode = Convert.ToInt32(row["BusCode"]); // detail.SentToBank = Convert.ToBoolean(row["BeClosed"]); if (detail.Insert(db) == 0) { throw new Exception(); } } } db.Commit(); #endregion Insert Details JMessages.Information("بستن تراکنشها با موفقیت انجام شد. از قسمت پرداخت برای ارسال اسناد به بانک اقدام فرمائید.", ""); DisableAll(); } #endregion Details } catch (Exception ex) { db.Rollback("SaveDocument"); JMessages.Error("عملیات ثبت با مشکل مواجه شده است.", ""); } finally { db.Dispose(); } } }