public EquipSelectedScreen(SimulatorContext context, IList <PlayerCharacter> _list, BaseGoods goods) : base(context) { _goods = goods; list = _list; bg = Context.Util.GetFrameBitmap(16 * 5 + 6, 6 + 16 * list.Count); itemsText = ExtensionFunction.DyadicArrayByte(list.Count, 11);//new byte[list.Count][11]; for (int i = 0; i < itemsText.Length; i++) { itemsText[i] = new byte[11]; } for (int i = 0; i < itemsText.Length; i++) { for (int j = 0; j < 10; j++) { itemsText[i][j] = (byte)' '; } try { byte[] tmp = list[i].Name.GetBytes(); Array.Copy(tmp, 0, itemsText[i], 0, tmp.Length); } catch (Exception ex) { Debug.WriteLine(ex); } } }
private void globalHelpEnactmentForm_Load(object sender, EventArgs e) { typeComboBox.DropDownStyle = ComboBoxStyle.DropDownList; enactmentTextbox.SelectionAlignment = HorizontalAlignment.Center; if (this.Text == "ویرایش کمک جمعی با مصوبه") { this.BackColor = Color.Yellow; delButton.Visible = true; SqlConnection con = new SqlConnection(this.connection); con.Open(); SqlCommand cmdget = new SqlCommand("select type, fee, packets, startdate, enactmentId, status, metric, description, subdate from GlobalHelps where id = @id;", con); cmdget.Parameters.AddWithValue("@id", this.id); using (SqlDataReader reader = cmdget.ExecuteReader()) { if (reader.Read()) { this.type = typeComboBox.Text = reader.GetString(0); this.fee = feeNumericUpDown.Value = reader.GetDecimal(1); startDateTimePickerX.SelectedDateInDateTime = Convert.ToDateTime(String.Format("{0}", reader["startdate"])).Date; enactmentTextbox.Text = ExtensionFunction.EnglishToPersian(reader.GetString(4)); this.packets = reader.GetInt32(2); packetNumericUpDown.Value = Convert.ToDecimal(this.packets); this.status = reader.GetString(5); this.metric = reader.GetDecimal(6); explainTextBox.Text = String.Format("{0}", reader["description"]); this.subdate = Convert.ToDateTime(String.Format("{0}", reader["subdate"])).Date; } } if (this.status != "تعریف شده") { delButton.Enabled = startDateTimePickerX.Enabled = packetNumericUpDown.Enabled = feeNumericUpDown.Enabled = false; } con.Close(); } }
private void editMemeberButton_Click(object sender, EventArgs e) { string id; if (!editMemberTextbox.Text.Any(char.IsWhiteSpace) && editMemberTextbox.Text.All(char.IsDigit)) { id = ExtensionFunction.PersianToEnglish(editMemberTextbox.Text); SqlConnection con = new SqlConnection(this.connection); con.Open(); SqlCommand cmdcheck = new SqlCommand("select count(*) as existance from member where id = @id", con); cmdcheck.Parameters.AddWithValue("@id", id); int exist = 0; using (SqlDataReader reader = cmdcheck.ExecuteReader()) { if (reader.Read()) { exist = int.Parse(String.Format("{0}", reader["existance"])); } } con.Close(); if (exist == 1) { var newform = new editMemberForm2(id); newform.ShowDialog(this); } else { FMessegeBox.FarsiMessegeBox.Show("عضوی با این شماره ملی وجود ندارد!", "خطا!", FMessegeBox.FMessegeBoxButtons.Ok, FMessegeBox.FMessegeBoxIcons.Error, FMessegeBox.FMessegeBoxDefaultButton.button1); } } else { FMessegeBox.FarsiMessegeBox.Show("!شماره ملی باید شامل اعداد و بدون هیچ فاصلهای باشد", "خطا!", FMessegeBox.FMessegeBoxButtons.Ok, FMessegeBox.FMessegeBoxIcons.Error, FMessegeBox.FMessegeBoxDefaultButton.button1); } }
private void editHelperForm2_Load(object sender, EventArgs e) { idTextBox.SelectionAlignment = HorizontalAlignment.Center; nameTextBox.SelectionAlignment = HorizontalAlignment.Center; familyTextBox.SelectionAlignment = HorizontalAlignment.Center; phoneTextBox.SelectionAlignment = HorizontalAlignment.Center; addressTextBox.SelectionAlignment = HorizontalAlignment.Center; SqlConnection con = new SqlConnection(this.connection); con.Open(); SqlCommand cmdget = new SqlCommand("select name, family, phone, address from helper where id = @id;", con); cmdget.Parameters.AddWithValue("@id", this.id); using (SqlDataReader reader = cmdget.ExecuteReader()) { if (reader.Read()) { idTextBox.Text = ExtensionFunction.EnglishToPersian(this.id); nameTextBox.Text = reader.GetString(0); familyTextBox.Text = reader.GetString(1); phoneTextBox.Text = ExtensionFunction.EnglishToPersian(reader.GetString(2)); addressTextBox.Text = ExtensionFunction.EnglishToPersian(reader.GetString(3)); } } con.Close(); }
private void otherHelpIndivPresentForm_Load(object sender, EventArgs e) { idTextBox.SelectionAlignment = HorizontalAlignment.Center; mIdTextbox.SelectionAlignment = HorizontalAlignment.Center; feeTextBox.SelectionAlignment = HorizontalAlignment.Center; idTextBox.Text = ExtensionFunction.EnglishToPersian(this.id); SqlConnection con = new SqlConnection(this.connection); con.Open(); SqlCommand cmdget; if (this.Text == "ارائه کمک متفرقه فردی") { feeTextBox.Visible = label3.Visible = true; cmdget = new SqlCommand("select mId, OtherHelpsIndiv.description, OtherHelpIndivReq.description, fee, cashtype from OtherHelpsIndiv, OtherHelpIndivReq where OtherHelpsIndiv.reqId = OtherHelpIndivReq.id and OtherHelpsIndiv.id = @id;", con); cmdget.Parameters.AddWithValue("@id", this.id); using (SqlDataReader reader = cmdget.ExecuteReader()) { if (reader.Read()) { explainTextBox.Text = reader.GetString(2) + " " + reader.GetString(1); this.mId = reader.GetString(0); mIdTextbox.Text = ExtensionFunction.EnglishToPersian(this.mId); feeTextBox.Text = ExtensionFunction.EnglishToPersian(Convert.ToUInt64(reader.GetDecimal(3)).ToString()); this.fee = reader.GetDecimal(3); this.cashtype = reader.GetString(4); } } } else { this.BackColor = Color.Yellow; visitPreReceiptButton.Visible = delButton.Visible = true; receiptLabel.BackColor = Color.YellowGreen; label22.Location = new Point(label22.Location.X, label22.Location.Y - 12); receiptLabel.Location = new Point(receiptLabel.Location.X, receiptLabel.Location.Y - 12); receiptAddFileButton.Location = new Point(receiptAddFileButton.Location.X, receiptAddFileButton.Location.Y - 12); feeTextBox.Visible = label3.Visible = true; cmdget = new SqlCommand("select mId, OtherHelpsIndiv.description, OtherHelpIndivReq.description, presdescription, fee, cashtype, bankAccountName, bankAccountId from OtherHelpsIndiv, OtherHelpIndivReq where OtherHelpsIndiv.reqId = OtherHelpIndivReq.id and OtherHelpsIndiv.id = @id;", con); cmdget.Parameters.AddWithValue("@id", this.id); using (SqlDataReader reader = cmdget.ExecuteReader()) { if (reader.Read()) { explainTextBox.Text = reader.GetString(2) + " " + reader.GetString(1) + " " + reader.GetString(3); this.explain = reader.GetString(3); this.mId = reader.GetString(0); mIdTextbox.Text = ExtensionFunction.EnglishToPersian(this.mId); feeTextBox.Text = ExtensionFunction.EnglishToPersian(Convert.ToUInt64(reader.GetDecimal(4)).ToString()); this.fee = reader.GetDecimal(4); this.cashtype = reader.GetString(5); this.prebId = reader.GetString(7); bankAccountNumberTextBox.Text = ExtensionFunction.EnglishToPersian(this.prebId); bankAccountNameComboBox.Text = reader.GetString(6); } } } if (cashtype == "غیرنقدی") { bankAccountNameComboBox.Enabled = false; } con.Close(); }
private void bankAccountEditForm2_Load(object sender, EventArgs e) { enactmentTextbox.SelectionAlignment = HorizontalAlignment.Center; bankAccountNameTextBox.SelectionAlignment = HorizontalAlignment.Center; bankAccountNumberTextBox.SelectionAlignment = HorizontalAlignment.Center; bankNameTextBox.SelectionAlignment = HorizontalAlignment.Center; bankAccountOwnerNameTextBox.SelectionAlignment = HorizontalAlignment.Center; SqlConnection con = new SqlConnection(this.connection); con.Open(); SqlCommand cmdget = new SqlCommand("select name, bankName, ownerName from bankAccount where id = @id;", con); cmdget.Parameters.AddWithValue("@id", this.id); using (SqlDataReader reader = cmdget.ExecuteReader()) { if (reader.Read()) { bankAccountNumberTextBox.Text = ExtensionFunction.EnglishToPersian(this.id); bankAccountNameTextBox.Text = reader.GetString(0); bankNameTextBox.Text = reader.GetString(1); bankAccountOwnerNameTextBox.Text = reader.GetString(2); } } con.Close(); }
private void addButton_Click(object sender, EventArgs e) { if (String.IsNullOrWhiteSpace(explainTextBox.Text)) { explainTextBox.BackColor = Color.Tomato; FMessegeBox.FarsiMessegeBox.Show("توضیحات وارد نشده است!", "خطا!", FMessegeBox.FMessegeBoxButtons.Ok, FMessegeBox.FMessegeBoxIcons.Error, FMessegeBox.FMessegeBoxDefaultButton.button1); return; } SqlConnection con = new SqlConnection(this.connection); con.Open(); SqlCommand cmd = new SqlCommand("BEGIN TRY begin tran t1; insert into backAccountInfoHistory (id, name, bankName, ownerName, subdate, enactmentId, description) Values (@id, @name, @bname, @oname, @sdate, @eId, @des); delete from bankAccount where id = @id; commit tran t1; END TRY BEGIN CATCH ROLLBACK END CATCH", con); cmd.Parameters.AddWithValue("@id", ExtensionFunction.PersianToEnglish(bankAccountNumberTextBox.Text)); cmd.Parameters.AddWithValue("@name", bankAccountNameTextBox.Text); cmd.Parameters.AddWithValue("@bname", bankNameTextBox.Text); cmd.Parameters.AddWithValue("@oname", bankAccountOwnerNameTextBox.Text); cmd.Parameters.AddWithValue("@sdate", endDateTimePickerX.SelectedDateInDateTime.Date); cmd.Parameters.AddWithValue("@eId", ExtensionFunction.PersianToEnglish(enactmentTextbox.Text)); cmd.Parameters.AddWithValue("@des", "(حذف حساب) " + explainTextBox.Text); cmd.ExecuteNonQuery(); con.Close(); FMessegeBox.FarsiMessegeBox.Show("حساب با موفقیت حذف شد!", "تبریک!", FMessegeBox.FMessegeBoxButtons.Ok, FMessegeBox.FMessegeBoxIcons.Information, FMessegeBox.FMessegeBoxDefaultButton.button1); this.Close(); }
/// <summary> /// 多人装备选择界面 /// </summary> /// <param name="context"></param> /// <param name="characters">角色列表</param> /// <param name="goods">当前选择进行装备的装备</param> public MutilCharacterEquipScreen(SimulatorContext context, List <PlayerCharacter> characters, BaseGoods goods) : base(context) { //HACK 此处需要测试是否正常运行 _characters = characters; _goods = goods; _background = Context.Util.GetFrameBitmap(16 * 5 + 6, 6 + 16 * _characters.Count); _names = ExtensionFunction.DyadicArrayByte(_characters.Count, 11);//new byte[list.Count][11]; for (int i = 0; i < _names.Length; i++) { for (int j = 0; j < 10; j++) { _names[i][j] = (byte)' '; } try { byte[] tmp = _characters[i].Name.GetBytes(); Array.Copy(tmp, 0, _names[i], 0, tmp.Length); } catch (Exception ex) { Debug.WriteLine(ex); } } }
private void marryHelpReqForm_Load(object sender, EventArgs e) { idTextbox.SelectionAlignment = HorizontalAlignment.Center; if (this.Text == "ثبت درخواست کمک ازدواج") { idTextbox.Text = ExtensionFunction.EnglishToPersian(this.mId); } else { this.BackColor = Color.Yellow; delButton.Visible = true; marryDocLabel.BackColor = reqLabel.BackColor = Color.YellowGreen; SqlConnection con = new SqlConnection(this.connection); con.Open(); SqlCommand cmdget = new SqlCommand("select mId, reqdate, description from MarryHelpReq where id = @id;", con); cmdget.Parameters.AddWithValue("@id", this.id); using (SqlDataReader reader = cmdget.ExecuteReader()) { if (reader.Read()) { idTextbox.Text = reader.GetString(0); reqDateTimePickerX.SelectedDateInDateTime = Convert.ToDateTime(String.Format("{0}", reader["reqdate"])).Date; explainTextBox.Text = reader.GetString(2); } } con.Close(); } }
private void comebackButton_Click(object sender, EventArgs e) { string id; id = ExtensionFunction.PersianToEnglish(comebackTextbox.Text); SqlCommand cmdcheck; SqlConnection con = new SqlConnection(this.connection); con.Open(); if (this.Text == "رجعت عضو") { cmdcheck = new SqlCommand("select count(*) as existance from abandoned where id = @id", con); cmdcheck.Parameters.AddWithValue("@id", id); int exist = 0; using (SqlDataReader reader = cmdcheck.ExecuteReader()) { if (reader.Read()) { exist = int.Parse(String.Format("{0}", reader["existance"])); } } con.Close(); if (exist == 1) { var newform = new comebackForm2(id); newform.ShowDialog(this); } else { FMessegeBox.FarsiMessegeBox.Show("!عضوی با این شماره ملی در لیست اعضای معلق وجود ندارد", "خطا!", FMessegeBox.FMessegeBoxButtons.Ok, FMessegeBox.FMessegeBoxIcons.Error, FMessegeBox.FMessegeBoxDefaultButton.button1); } } else { cmdcheck = new SqlCommand("select count(*) as existance from member, Inmember where member.id = Inmember.id and Inmember.kickdate is Null and member.id = @id", con); cmdcheck.Parameters.AddWithValue("@id", id); int exist = 0; using (SqlDataReader reader = cmdcheck.ExecuteReader()) { if (reader.Read()) { exist = int.Parse(String.Format("{0}", reader["existance"])); } } con.Close(); if (exist == 1) { var newform = new comebackForm2(id); newform.ShowDialog(this); } else { FMessegeBox.FarsiMessegeBox.Show("!عضوی با این شماره ملی در لیست اعضای رجعت یافته وجود ندارد", "خطا!", FMessegeBox.FMessegeBoxButtons.Ok, FMessegeBox.FMessegeBoxIcons.Error, FMessegeBox.FMessegeBoxDefaultButton.button1); } } }
private void searchButton_Click(object sender, EventArgs e) { var newform = new searchForm("ویرایش اطلاعات مددکار"); newform.ShowDialog(this); if (newform.Text.StartsWith("choose")) { idTextbox.Text = ExtensionFunction.EnglishToPersian(newform.Text.Substring(6)); } }
private void searchButton_Click(object sender, EventArgs e) { var newform = new searchEnactmentForm(); newform.ShowDialog(this); if (newform.Text.StartsWith("choose")) { enactmentTextbox.Text = ExtensionFunction.EnglishToPersian(newform.Text.Substring(6)); } }
private void searchButton_Click(object sender, EventArgs e) { var newform = new searchEnactmentForm(); newform.ShowDialog(this); if (newform.Text == "choose") { enactmentTextbox.Text = ExtensionFunction.EnglishToPersian(Clipboard.GetText()); } }
private void searchApplicantButton_Click(object sender, EventArgs e) { var newform = new searchForm("تقاضا جدید متقاضی"); newform.ShowDialog(this); if (newform.Text.StartsWith("choose")) { idTextbox.Text = ExtensionFunction.EnglishToPersian(newform.Text.Substring(6)); // ExtensionFunction.PersianToEnglish(idTextbox.Text); } }
private void marrySendIntroForm_Load(object sender, EventArgs e) { idTextBox.SelectionAlignment = HorizontalAlignment.Center; idTextBox.Text = ExtensionFunction.EnglishToPersian(this.id); SqlConnection con = new SqlConnection(this.connection); SqlCommand cmdget; con.Open(); if (this.Text == "ارسال معرفینامه جهیزیه") { cmdget = new SqlCommand("select reqId, MarryHelps.description, MarryHelps.enactmentId, MarryHelpReq.description from MarryHelps, MarryHelpReq where MarryHelps.reqId = MarryHelpReq.id and MarryHelps.id = @id;", con); cmdget.Parameters.AddWithValue("@id", this.id); using (SqlDataReader reader = cmdget.ExecuteReader()) { if (reader.Read()) { this.rId = reader.GetString(0); explainTextBox.Text = reader.GetString(3) + " " + reader.GetString(1); this.eId = reader.GetString(2); } } } else { this.BackColor = Color.Yellow; delButton.Visible = visitPreIntroButton.Visible = true; introLabel.BackColor = Color.YellowGreen; label22.Location = new Point(label22.Location.X, label22.Location.Y - 12); introLabel.Location = new Point(introLabel.Location.X, introLabel.Location.Y - 12); introAddFileButton.Location = new Point(introAddFileButton.Location.X, introAddFileButton.Location.Y - 12); cmdget = new SqlCommand("select reqId, MarryHelps.description, MarryHelps.enactmentId, MarryHelpReq.description, introdescription from MarryHelps, MarryHelpReq where MarryHelps.reqId = MarryHelpReq.id and MarryHelps.id = @id;", con); cmdget.Parameters.AddWithValue("@id", this.id); using (SqlDataReader reader = cmdget.ExecuteReader()) { if (reader.Read()) { this.rId = reader.GetString(0); explainTextBox.Text = reader.GetString(3) + " " + reader.GetString(1) + " " + reader.GetString(4); this.explain = reader.GetString(4); this.eId = reader.GetString(2); } } } cmdget = new SqlCommand("select docpath from enactment where id = @eId;", con); cmdget.Parameters.AddWithValue("@eId", this.eId); using (SqlDataReader reader = cmdget.ExecuteReader()) { if (reader.Read()) { this.ePath = reader.GetString(0); } } con.Close(); }
public ActionResult EquipmentUserActivity(int id, string Puser, string statusvalue) { equipmetAcceptUser PEquipmentAccreptUser = new equipmetAcceptUser(); PEquipmentAccreptUser.equipmentId = id; PEquipmentAccreptUser.userName = Puser; PEquipmentAccreptUser.statusSelected = statusvalue; PEquipmentAccreptUser.registerDate = ExtensionFunction.ToPersian(DateTime.Now); Context.equipmetAcceptUsers.Add(PEquipmentAccreptUser); Context.SaveChanges(); return(RedirectToAction("listEquipments")); }
private void searchButton_Click(object sender, EventArgs e) { var newform = new searchEnactmentForm(); newform.ShowDialog(this); if (newform.Text.StartsWith("choose")) { enactmentTextbox.Text = ExtensionFunction.EnglishToPersian(newform.Text.Substring(6)); } if (this.Text == "ویرایش تایید معرفینامه تحصیلی") { setButton.Enabled = true; } }
private void exportButton_Click(object sender, EventArgs e) { // creating Excel Application Microsoft.Office.Interop.Excel._Application app = new Microsoft.Office.Interop.Excel.Application(); // creating new WorkBook within Excel application Microsoft.Office.Interop.Excel._Workbook workbook = app.Workbooks.Add(Type.Missing); // creating new Excelsheet in workbook Microsoft.Office.Interop.Excel._Worksheet worksheet = null; // get the reference of first sheet. By default its name is Sheet1. // store its reference to worksheet worksheet = workbook.Sheets["Sheet1"]; worksheet = workbook.ActiveSheet; // changing the name of active sheet //worksheet.Name = "Exported from gridview"; worksheet.DisplayRightToLeft = true; DialogResult res = FMessegeBox.FarsiMessegeBox.Show("نسبت به گرفتن خروجی اکسل اطمینان دارید؟", "پرسش", FMessegeBox.FMessegeBoxButtons.YesNo, FMessegeBox.FMessegeBoxIcons.Question, FMessegeBox.FMessegeBoxDefaultButton.button1); if (res != DialogResult.Yes) { app.Quit(); return; } for (int i = 1; i < membersView.Columns.Count + 1; i++) { worksheet.Cells[1, i] = membersView.Columns[i - 1].HeaderText; } // storing Each row and column value to excel sheet for (int i = 0; i < membersView.Rows.Count; i++) { for (int j = 0; j < membersView.Columns.Count; j++) { if (membersView.Rows[i].Cells[j].Value.GetType().ToString() == "System.DateTime") { worksheet.Cells[i + 2, j + 1] = ExtensionFunction.ToPersian(Convert.ToDateTime(membersView.Rows[i].Cells[j].Value.ToString())); } else { worksheet.Cells[i + 2, j + 1] = membersView.Rows[i].Cells[j].Value.ToString(); } } } // see the excel sheet behind the program app.Visible = true; // save the application //workbook.SaveAs("c:\\output.xls", Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Microsoft.Office.Interop.Excel.XlSaveAsAccessMode.xlExclusive, Type.Missing, Type.Missing, Type.Missing, Type.Missing); // Exit from the application //app.Quit(); }
private void denyButton_Click(object sender, EventArgs e) { SqlConnection con = new SqlConnection(this.connection); con.Open(); SqlCommand cmd = new SqlCommand("update MarryHelpReq Set status = @rstat, enactmentId = @eId where id = @rId;", con); cmd.Parameters.AddWithValue("@rId", this.rId); cmd.Parameters.AddWithValue("@eId", ExtensionFunction.PersianToEnglish(enactmentTextbox.Text)); cmd.Parameters.AddWithValue("@rstat", "رد شده"); cmd.ExecuteNonQuery(); con.Close(); FMessegeBox.FarsiMessegeBox.Show("درخواست با موفقیت رد شد!", "تبریک!", FMessegeBox.FMessegeBoxButtons.Ok, FMessegeBox.FMessegeBoxIcons.Information, FMessegeBox.FMessegeBoxDefaultButton.button1); this.Close(); }
public ActionResult UserActivity(int id, string Puser, string statusvalue) { melkAcceptUser PmelkAccreptUser = new melkAcceptUser(); PmelkAccreptUser.melkId = id; PmelkAccreptUser.userName = Puser; PmelkAccreptUser.statusSelected = statusvalue; PmelkAccreptUser.RegisterDate = ExtensionFunction.ToPersian(DateTime.Now); Context.melkAcceptUsers.Add(PmelkAccreptUser); Context.SaveChanges(); return(RedirectToAction("GetMelkInfo")); }
public ActionResult JobUserActivity(int id, string Puser, string statusvalue) { jobAcceptUser PJobAccreptUser = new jobAcceptUser(); PJobAccreptUser.jobId = id; PJobAccreptUser.userName = Puser; PJobAccreptUser.statusSelected = statusvalue; PJobAccreptUser.registerDate = ExtensionFunction.ToPersian(DateTime.Now); Context.jobAcceptUsers.Add(PJobAccreptUser); Context.SaveChanges(); return(RedirectToAction("listJobs")); }
private void editBuyHelpsForm2_Load(object sender, EventArgs e) { typeComboBox.DropDownStyle = ComboBoxStyle.DropDownList; buyerNameTextBox.SelectionAlignment = HorizontalAlignment.Center; bankAccountNumberTextBox.SelectionAlignment = HorizontalAlignment.Center; bankAccountNameComboBox.DropDownStyle = ComboBoxStyle.DropDownList; enactmentTextbox.SelectionAlignment = HorizontalAlignment.Center; SqlConnection con = new SqlConnection(this.connection); con.Open(); SqlCommand cmdget = new SqlCommand("select id, name from bankAccount;", con); using (SqlDataReader reader = cmdget.ExecuteReader()) { while (reader.Read()) { li.Add(new KeyValuePair <string, string>(reader.GetString(0), reader.GetString(1))); bankAccountNameComboBox.Items.Add(reader.GetString(1)); } } cmdget = new SqlCommand("select type, fee, packet, buyerName, buydate, bankAccountId ,bankAccountName, description from buyHelps where id = @id;", con); cmdget.Parameters.AddWithValue("@id", this.id); using (SqlDataReader reader = cmdget.ExecuteReader()) { if (reader.Read()) { pretype = typeComboBox.Text = reader.GetString(0); this.preFee = feeNumericUpDown.Value = reader.GetDecimal(1); packetNumericUpDown.Value = reader.GetInt32(2); buyerNameTextBox.Text = reader.GetString(3); buyDateTimePickerX.SelectedDateInDateTime = Convert.ToDateTime(String.Format("{0}", reader["buydate"])).Date; bankAccountNumberTextBox.Text = ExtensionFunction.EnglishToPersian(reader.GetString(5)); this.prebId = reader.GetString(5); bankAccountNameComboBox.Text = reader.GetString(6); explainTextBox.Text = reader.GetString(7); } } cmdget = new SqlCommand("select docpath from doc where id = @id;", con); cmdget.Parameters.AddWithValue("@id", this.id); using (SqlDataReader reader = cmdget.ExecuteReader()) { if (reader.Read()) { preFile = reader.GetString(0); } } con.Close(); }
private void delButton_Click(object sender, EventArgs e) { DialogResult res = FMessegeBox.FarsiMessegeBox.Show("آیا نسیت به حذف ارائه این کمک اطمینان دارید؟", "پرسش", FMessegeBox.FMessegeBoxButtons.YesNo, FMessegeBox.FMessegeBoxIcons.Question, FMessegeBox.FMessegeBoxDefaultButton.button1); if (res != DialogResult.Yes) { return; } SqlConnection con = new SqlConnection(this.connection); con.Open(); string dpath = System.IO.Directory.GetFiles(this.helpPath + "\\" + this.id + "\\receipt")[0]; System.IO.File.Delete(dpath); if (cashtype == "نقدی") { decimal stock = 0; SqlCommand cmdget = new SqlCommand("select stock from bankAccount where id = @bId;", con); cmdget.Parameters.AddWithValue("@bId", ExtensionFunction.PersianToEnglish(bankAccountNumberTextBox.Text)); using (SqlDataReader reader = cmdget.ExecuteReader()) { if (reader.Read()) { stock = reader.GetDecimal(0); } } SqlCommand cmd = new SqlCommand("BEGIN TRY begin tran t1; update OtherHelpsIndiv Set presdescription = Null, enddate = Null, status = @stat where id = @bId; update bankAccount set stock = @st where id = @id; delete from doc where id = @id and doctype = @dtype; commit tran t1; END TRY BEGIN CATCH ROLLBACK END CATCH", con); cmd.Parameters.AddWithValue("@id", this.id); cmd.Parameters.AddWithValue("@stat", "ارائه"); cmd.Parameters.AddWithValue("@bId", ExtensionFunction.PersianToEnglish(bankAccountNumberTextBox.Text)); cmd.Parameters.AddWithValue("@st", stock + fee); cmd.Parameters.AddWithValue("@dtype", "OIhelp:receipt"); cmd.ExecuteNonQuery(); } else { SqlCommand cmd = new SqlCommand("BEGIN TRY begin tran t1; update OtherHelpsIndiv Set presdescription = Null, enddate = Null, status = @stat where id = @id; update bankAccount set stock = @st where id = @id; delete from doc where id = @id and doctype = @dtype; commit tran t1; END TRY BEGIN CATCH ROLLBACK END CATCH", con); cmd.Parameters.AddWithValue("@id", this.id); cmd.Parameters.AddWithValue("@stat", "ارائه"); cmd.Parameters.AddWithValue("@dtype", "OIhelp:receipt"); cmd.ExecuteNonQuery(); } con.Close(); FMessegeBox.FarsiMessegeBox.Show("ارائه کمک با موفقیت حذف شد!", "تبریک!", FMessegeBox.FMessegeBoxButtons.Ok, FMessegeBox.FMessegeBoxIcons.Information, FMessegeBox.FMessegeBoxDefaultButton.button1); this.Close(); }
private void searchButton_Click(object sender, EventArgs e) { if (this.Text == "بررسی تقاضا" || this.Text == "ویرایش تقاضا") { var newform = new searchForm("ویرایش تقاضا"); newform.ShowDialog(this); if (newform.Text.StartsWith("choose")) { idTextbox.Text = ExtensionFunction.EnglishToPersian(newform.Text.Substring(6));; } } else if (this.Text == "ثبت ارائه معرفینامه" || this.Text == "ویرایش بررسی") { searchForm newform; if (this.Text == "ویرایش بررسی") { newform = new searchForm("ویرایش بررسی"); } else { newform = new searchForm("ثبت ارائه معرفینامه"); } newform.ShowDialog(this); if (newform.Text.StartsWith("choose")) { idTextbox.Text = ExtensionFunction.EnglishToPersian(newform.Text.Substring(6));; } } else if (this.Text == "ویرایش مصوبه") { var newform = new searchForm("ویرایش مصوبه"); newform.ShowDialog(this); if (newform.Text.StartsWith("choose")) { idTextbox.Text = ExtensionFunction.EnglishToPersian(newform.Text.Substring(6));; } } else { var newform = new searchForm("ویرایش ارائه معرفینامه"); newform.ShowDialog(this); if (newform.Text.StartsWith("choose")) { idTextbox.Text = ExtensionFunction.EnglishToPersian(newform.Text.Substring(6));; } } }
private void chooseButton_Click(object sender, EventArgs e) { if (membersView.Rows[membersView.SelectedCells[0].RowIndex].Cells[7].Value.ToString() == "نامشخص") { FMessegeBox.FarsiMessegeBox.Show("این تقاضا فایل یا اطلاعات بیشتری ندارد!", "توجه", FMessegeBox.FMessegeBoxButtons.Ok, FMessegeBox.FMessegeBoxIcons.Information, FMessegeBox.FMessegeBoxDefaultButton.button1); } else if(membersView.Rows[membersView.SelectedCells[0].RowIndex].Cells[6].Value.ToString() == "") { var newform = new observereqForm2_2(ExtensionFunction.PersianToEnglish(membersView.Rows[membersView.SelectedCells[0].RowIndex].Cells[membersView.SelectedCells[0].ColumnIndex].Value.ToString())); newform.ShowDialog(this); } else { var newform = new observereqForm3_2(ExtensionFunction.PersianToEnglish(membersView.Rows[membersView.SelectedCells[0].RowIndex].Cells[membersView.SelectedCells[0].ColumnIndex].Value.ToString())); newform.ShowDialog(this); } }
private void setButton_Click(object sender, EventArgs e) { SqlConnection con = new SqlConnection(this.connection); con.Open(); SqlCommand cmdmember = new SqlCommand("select count(*) from member where id = @id and id = supporter_id;", con); cmdmember.Parameters.AddWithValue("@id", ExtensionFunction.PersianToEnglish(idTextbox.Text)); int c = 0; using (SqlDataReader reader = cmdmember.ExecuteReader()) { if (reader.Read()) { c = reader.GetInt32(0); } } if (c != 0) { var newform = new newReqForm2(ExtensionFunction.PersianToEnglish(idTextbox.Text), "member"); newform.ShowDialog(this); } else { SqlCommand cmdapplicant = new SqlCommand("select count(*) from otherApplicant where id = @id;", con); cmdapplicant.Parameters.AddWithValue("@id", ExtensionFunction.PersianToEnglish(idTextbox.Text)); c = 0; using (SqlDataReader reader = cmdapplicant.ExecuteReader()) { if (reader.Read()) { c = reader.GetInt32(0); } } if (c != 0) { var newform = new newReqForm2(ExtensionFunction.PersianToEnglish(idTextbox.Text), "applicant"); newform.ShowDialog(this); } else { FMessegeBox.FarsiMessegeBox.Show("شماره ملی عضو موجود نیست!", "خطا!", FMessegeBox.FMessegeBoxButtons.Ok, FMessegeBox.FMessegeBoxIcons.Error, FMessegeBox.FMessegeBoxDefaultButton.button1); } } con.Close(); }
private void setButton_Click(object sender, EventArgs e) { DialogResult res = FMessegeBox.FarsiMessegeBox.Show("آیا نسبت به ثبت بودجه اطمینان دارید؟", "پرسش", FMessegeBox.FMessegeBoxButtons.YesNo, FMessegeBox.FMessegeBoxIcons.Question, FMessegeBox.FMessegeBoxDefaultButton.button1); if (res != DialogResult.Yes) { return; } SqlConnection con = new SqlConnection(this.connection); con.Open(); SqlCommand cmdsavehistory = new SqlCommand("BEGIN TRY begin tran t1; insert into budgetsCurrenciesHistory select @y, * from budgetsCurrencies; update budgetsCurrencies set amount = 0 where typename like '%Consume'; commit tran t1; END TRY BEGIN CATCH ROLLBACK END CATCH", con); SqlCommand cmdgetbsid = new SqlCommand("select max(id) from budgetsets;", con); string bsid = "1398"; using (SqlDataReader reader = cmdgetbsid.ExecuteReader()) { if (reader.Read()) { bsid = reader.GetString(0); } } cmdsavehistory.Parameters.AddWithValue("@y", bsid); cmdsavehistory.ExecuteNonQuery(); string d = DateTime.Now.Date.ToPersian(); d = d.Substring(0, 4) + d.Substring(5, 2) + d.Substring(8, 2); SqlCommand cmd = new SqlCommand("insert into budgetsets (id, subdate, enactmentId) Values(@id, @sdate, @eId);", con); cmd.Parameters.AddWithValue("@id", "bs" + d); cmd.Parameters.AddWithValue("@sdate", DateTime.Now.Date); cmd.Parameters.AddWithValue("@eId", ExtensionFunction.PersianToEnglish(enactmentTextbox.Text)); cmd.ExecuteNonQuery(); NumericUpDown nu; foreach (var budget in budgets) { cmd = new SqlCommand("update budgetsCurrencies Set amount = @amount where typename = @tname;", con); nu = (NumericUpDown)this.Controls.Find(budget + "NumericUpDown", true)[0]; cmd.Parameters.AddWithValue("@amount", nu.Value); cmd.Parameters.AddWithValue("@tname", budget + "Budget"); cmd.ExecuteNonQuery(); } FMessegeBox.FarsiMessegeBox.Show("بودجه با موفقیت تعیین شد!", "تبریک!", FMessegeBox.FMessegeBoxButtons.Ok, FMessegeBox.FMessegeBoxIcons.Information, FMessegeBox.FMessegeBoxDefaultButton.button1); con.Close(); this.Close(); con.Close(); }
private void searchButton_Click(object sender, EventArgs e) { searchForm newform; if (this.Text == "ویرایش متقاضی") { newform = new searchForm("متقاضی سایر"); } else { newform = new searchForm("متقاضی"); } newform.ShowDialog(this); if (newform.Text.StartsWith("choose")) { idTextbox.Text = ExtensionFunction.EnglishToPersian(newform.Text.Substring(6));; } }
private void chooseButton_Click(object sender, EventArgs e) { SqlConnection con = new SqlConnection(this.connection); con.Open(); SqlCommand cmd = new SqlCommand("select docpath from enactment where id = @id;", con); cmd.Parameters.AddWithValue("@id", ExtensionFunction.PersianToEnglish(membersView.Rows[membersView.SelectedCells[0].RowIndex].Cells[membersView.SelectedCells[0].ColumnIndex + membersView.ColumnCount - 1].Value.ToString())); string p = ""; using (SqlDataReader reader = cmd.ExecuteReader()) { if (reader.Read()) { p = reader.GetString(0); } } con.Close(); System.Diagnostics.Process.Start(p); }
private void searchButton_Click(object sender, EventArgs e) { if (this.typ == "خانوار") { var newform = new searchForm("انتخاب خانوار"); newform.ShowDialog(this); if (newform.Text.StartsWith("choose")) { idTextbox.Text = ExtensionFunction.EnglishToPersian(newform.Text.Substring(6)); } } else { var newform = new searchForm("ویرایش عضو"); newform.ShowDialog(this); if (newform.Text.StartsWith("choose")) { idTextbox.Text = ExtensionFunction.EnglishToPersian(newform.Text.Substring(6)); } } }