public static void FreeDate() { var bank = new LinqDataContext(); var query = from p in bank.sarbazs // where p.Id_Sarbaz == Id_sarbaz select p; foreach (var items in query) { var x = items.مدت_كسر_خدمت_به_روز; var y = items.خدمت_قبلی_روز; var z = items.مدت_اضافه_خدمت_روز; if (x == "" || x == null) { x = "0"; } if (y == "" || y == null) { y = "0"; } if (z == "" || z == null) { z = "0"; } int Day_variable = -Convert.ToInt32(x) - Convert.ToInt32(y) + Convert.ToInt32(z); PersianCalendar pcalender = new PersianCalendar(); PersianDate pDateObj = new PersianDate(); int year = Convert.ToDateTime(items.تاریخ_اعزام).Year; int month = Convert.ToDateTime(items.تاریخ_اعزام).Month; int day = Convert.ToDateTime(items.تاریخ_اعزام).Day; pDateObj.increasePersianMonth(ref year, ref month, 21); DateTime date = pcalender.ToDateTime(year, month, day, 0, 0, 0, 0, 0 ); // DateTime date_FreeDate = date.AddMonths(21); DateTime date_FreeDate1 = date.AddDays(Day_variable); items.تاریخ_ترخیص = pcalender.GetYear(date_FreeDate1) + "/" + pcalender.GetMonth(date_FreeDate1) + "/" + pcalender.GetDayOfMonth(date_FreeDate1); } //return date_FreeDate; bank.SubmitChanges(); }
private void FrmApply_S_Load(object sender, EventArgs e) { txt_JazbDate.Text = PersianDate.GetPersianDate(); var bank = new LinqDataContext(); var query = (from p in bank.Gradetbls orderby p.Id_Grade select new { p.Id_Grade, p.Grade }).Distinct(); comboBox_Grade.DataSource = query; comboBox_Grade.DisplayMember = "Grade"; comboBox_Grade.ValueMember = "Id_Grade"; var query1 = (from p in bank.Darajes orderby p.ID select new { p.ID, p.NameDaraje }).Distinct(); comboBox_Darajeh.DataSource = query1; comboBox_Darajeh.DisplayMember = "NameDaraje"; comboBox_Darajeh.ValueMember = "ID"; }