コード例 #1
0
ファイル: FormDelete.cs プロジェクト: amirrasooli69/Service
 private void Search_Eshterak()
 {
     try
     {
         using (var context = new StimulsoftEntities())
         {
             var find = context.User.Where(current => current.Eshterak.Contains(txtEshterak.Text)).ToList();
             dgDelete.DataSource = find;
             //-----------------
             dgDelete.Columns[0].HeaderText = "اشتراک";
             dgDelete.Columns[1].HeaderText = "نام";
             //dgDelete.Columns[2].Visible = false;
             dgDelete.Columns[2].HeaderText = " تاریخ";
             //dgDelete.Columns[3].Visible = false;
             dgDelete.Columns[3].HeaderText = "شماره تماس";
             //dgDelete.Columns[4].Visible = false;
             dgDelete.Columns[4].HeaderText = "ایمیل";
             // dgDelete.Columns[5].Visible = false;
             dgDelete.Columns[5].HeaderText = "تاریخ تولد";
             //dgDelete.Columns[6].Visible = false;
             dgDelete.Columns[6].HeaderText = "آدرس";
             dgDelete.Columns[7].HeaderText = "کد پستی";
             dgDelete.Columns[8].Visible    = false;
             dgDelete.Columns[8].HeaderText = "شماره ";
             //-----------------
             dgDelete.Show();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
コード例 #2
0
ファイル: FormDelete.cs プロジェクト: amirrasooli69/Service
        public void Refresh_dgService()
        {
            using (var context = new StimulsoftEntities())
            {
                dgDelete.DataSource            = context.Service.Where(current => current.Eshterak != null).ToList();
                dgDelete.DataSource            = context.Service.Where(current => current.Eshterak != null).ToList();
                dgDelete.Columns[0].HeaderText = "اشتراک";
                dgDelete.Columns[1].HeaderText = "نام";
                dgDelete.Columns[2].HeaderText = "تاریخ سرویس";
                dgDelete.Columns[2].DefaultCellStyle.Format = "0000/00/00";

                dgDelete.Columns[3].HeaderText = "شماره تماس";
                dgDelete.Columns[4].HeaderText = "بیعانه";
                dgDelete.Columns[5].HeaderText = "پرداختی";
                dgDelete.Columns[6].HeaderText = "تخفیف ";
                dgDelete.Columns[7].HeaderText = "ارزش افزوده";
                //dgDelete.Columns[8].Visible = false;
                dgDelete.Columns[8].HeaderText  = "مبلغ";
                dgDelete.Columns[9].HeaderText  = "کد رهگیری";
                dgDelete.Columns[10].HeaderText = "تعداد";
                dgDelete.Columns[11].HeaderText = "تاریخ آماده";
                dgDelete.Columns[11].DefaultCellStyle.Format = "0000/00/00";

                dgDelete.Columns[12].HeaderText = "تعداد پیامک آماده";
                dgDelete.Columns[13].HeaderText = "توضیحات ";
                dgDelete.Columns[14].HeaderText = "شماره ";
                dgDelete.Columns[14].Visible    = false;
                dgDelete.Columns[15].HeaderText = " سفارش";
                dgDelete.Columns[16].HeaderText = " میز";
                dgDelete.Columns[16].Visible    = false;
                dgDelete.Columns[17].HeaderText = " پرداخت";
                //dgDelete.Columns[17].Visible = false;
            }
        }
コード例 #3
0
ファイル: FormDelete.cs プロジェクト: amirrasooli69/Service
 public void Refresh_dgUser()
 {
     try
     {
         using (var context = new StimulsoftEntities())
         {
             dgDelete.DataSource            = context.User.Where(current => current.Eshterak != null).ToList();
             dgDelete.Columns[0].HeaderText = "اشتراک";
             dgDelete.Columns[1].HeaderText = "نام";
             //dgDelete.Columns[2].Visible = false;
             dgDelete.Columns[2].HeaderText = " تاریخ";
             //dgDelete.Columns[3].Visible = false;
             dgDelete.Columns[3].HeaderText = "شماره تماس";
             //dgDelete.Columns[4].Visible = false;
             dgDelete.Columns[4].HeaderText = "ایمیل";
             // dgDelete.Columns[5].Visible = false;
             dgDelete.Columns[5].HeaderText = "تاریخ تولد";
             //dgDelete.Columns[6].Visible = false;
             dgDelete.Columns[6].HeaderText = "آدرس";
             dgDelete.Columns[7].HeaderText = "کد پستی";
             dgDelete.Columns[8].Visible    = false;
             dgDelete.Columns[8].HeaderText = "شماره ";
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
コード例 #4
0
        private void txtCodeProdoct_TextChanged(object sender, EventArgs e)
        {
            StimulsoftEntities context = new StimulsoftEntities();

            if (context.AnbarProdoct.Count() > 0)
            {
                if (txtCodeProdoct.TextLength <= 0)
                {
                    dgProdoct.DataSource = context.AnbarProdoct.ToList();
                }
                else
                {
                    long x             = long.Parse(txtCodeProdoct.Text);
                    var  selectProdoct = context.AnbarProdoct.Where(c => c.Code == x).ToList();
                    dgProdoct.DataSource = selectProdoct;
                }
                dgProdoct.Columns[0].Visible    = false;
                dgProdoct.Columns[1].Visible    = false;
                dgProdoct.Columns[2].HeaderText = "نام کالا";
                dgProdoct.Columns[3].HeaderText = "کد کالا";
                dgProdoct.Columns[4].HeaderText = "توضیحات";
                dgProdoct.Columns[5].HeaderText = "بارکد";
                dgProdoct.Columns[6].HeaderText = "تگ شناسایی";
                //dgProdoct.Columns[7].Visible = false;
                //dgProdoct.Columns[8].Visible = false;
            }
        }
コード例 #5
0
ファイル: FormDelete.cs プロジェクト: amirrasooli69/Service
        private void FormDelete_Load(object sender, EventArgs e)
        {
            StimulsoftEntities context = new StimulsoftEntities();

            if (lbldel.Text == "2")
            {
                //lblEshterak.Text = "شماره سرویس";
                Refresh_dgService();
                return;
            }
            if (lbldel.Text == "1")
            {
                lblEshterak.Text = "شماره اشتراک";
                Refresh_dgUser();
                //-----

                var      select   = context.User.ToList();
                string[] eshterak = new string[select.Count];
                for (int i = 0; i < select.Count; i++)
                {
                    eshterak[i] = select[i].Eshterak.ToString();
                }
                txtEshterak.AutoCompleteSource = AutoCompleteSource.CustomSource;
                AutoCompleteStringCollection suggest = new AutoCompleteStringCollection();
                txtEshterak.AutoCompleteCustomSource = suggest;
                suggest.AddRange(eshterak);
            }
        }
コード例 #6
0
 private void btnSearchMotorOil_Click(object sender, EventArgs e)
 {
     lblError.Text = "";
     try
     {
         if (txtKindKala.Text == "" || txtServisPrice.Text == "")
         {
             using (var context = new StimulsoftEntities())
             {
                 var update = context.ServicesPrice.Where(current => current.ServiseName.Contains(txtKindKala.Text)).ToList();
                 if (update != null)
                 {
                     dgShow.DataSource = update;
                     //editMotorOil = txtKindKala.Text;
                 }
                 else
                 {
                     lblError.ForeColor = Color.Red;
                     lblError.Text      = "هیچ موردی پیدا نشد";
                 }
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
コード例 #7
0
 private void btnSave_Click(object sender, EventArgs e)
 {
     using (var context = new StimulsoftEntities())
     {
         if (context.Unit.Count() > 0)
         {
             bool existUnit = context.Unit.Where(c => c.Name == txtUnitName.Text).Any();
             if (existUnit)
             {
                 MessageBox.Show("این واحد وجود دارد", "واحد", MessageBoxButtons.OK, MessageBoxIcon.Warning);
             }
             else
             {
                 Unit newUnit = new Unit();
                 newUnit.Name = txtUnitName.Text;
                 context.Unit.Add(newUnit);
                 context.SaveChanges();
                 MessageBox.Show("واحد ثبت شد", "ثبت", MessageBoxButtons.OK, MessageBoxIcon.Information);
                 txtUnitName.Text = "";
                 txtUnitName.Focus();
             }
         }
         else
         {
             Unit newUnit = new Unit();
             newUnit.Name = txtUnitName.Text;
             context.Unit.Add(newUnit);
             context.SaveChanges();
             MessageBox.Show("واحد ثبت شد", "ثبت", MessageBoxButtons.OK, MessageBoxIcon.Information);
             txtUnitName.Text = "";
             txtUnitName.Focus();
         }
     }
 }
コード例 #8
0
 private void FormSms_Load(object sender, EventArgs e)
 {
     dtSearch.Text = Practical.Today_Date();
     comRemeberBirthDay.SelectedIndex = 0;
     try
     {
         using (var context = new StimulsoftEntities())
         {
             var set = context.Setting.FirstOrDefault();
             if (set != null)
             {
                 txtSignature.Text = set.Signature;
                 txtSMSnumber.Text = set.NumberSms;
             }
             else
             {
                 MessageBox.Show("از بخش تنظیمات امضا و شماره پیامک را وارد کنید", "هشدار", MessageBoxButtons.OK, MessageBoxIcon.Warning);
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
コード例 #9
0
ファイル: FormWorks.cs プロジェクト: amirrasooli69/Service
        public void select(string coderahgiri)
        {
            try
            {
                StimulsoftEntities context = new StimulsoftEntities();
                var search = context.ReportService.Where(c => c.CodeRahgiri == coderahgiri).ToList();
                dgSearch.DataSource = search;
                Works_Refresh();
                for (int i = 0; i < search.Count; i++)
                {
                    switch (search[i].Ready)
                    {
                    case "0":
                    {
                        dgSearch.Rows[i].Cells[12].Value = true;
                        break;
                    }

                    case "1":
                    {
                        dgSearch.Rows[i].Cells[12].Value = false;
                        break;
                    }

                    case null:
                    {
                        dgSearch.Rows[i].Cells[12].Value = true;
                        break;
                    }
                    }
                }
            }
            catch (Exception)
            { }
        }
コード例 #10
0
        private void btnDeleteMotorOil_Click(object sender, EventArgs e)
        {
            lblError.Text = "";
            try
            {
                using (var context = new StimulsoftEntities())
                {
                    int x = Convert.ToInt16(dgShow.CurrentRow.Cells[4].Value.ToString());

                    ServicesPrice del = context.ServicesPrice.Where(current => current.Id == x).FirstOrDefault();
                    context.ServicesPrice.Remove(del);
                    context.SaveChanges();
                    lblError.ForeColor = Color.Green;
                    lblError.Text      = "خدمت با موفقیت حذف شد";
                    context.Dispose();



                    Refresh_Price();
                    comGroup.Text       = "";
                    txtServiceName.Text = "";
                    txtKindKala.Text    = "";
                    txtServisPrice.Text = "";
                }
            }
            catch (Exception)
            {
                lblError.ForeColor = Color.Red;
                lblError.Text      = "عملیات حذف با مشکل مواجه شد";
            }
        }
コード例 #11
0
        private void FormReportServices_Load(object sender, EventArgs e)
        {
            //--------
            try
            {
                using (var context = new StimulsoftEntities())
                {
                    var user = context.ReportService.Where(c => c.CodeRahgiri == label1.Text).ToList();

                    dgSearch.DataSource = user;
                    Design_GrideView_Report_Service();
                    for (int i = 0; i < user.Count; i++)
                    {
                        if (dgSearch.Rows[i].Cells[12].Value == null)
                        {
                            dgSearch.Rows[i].Cells[12].Value = true;
                        }
                        else if (dgSearch.Rows[i].Cells[12].Value.ToString() == "1")
                        {
                            dgSearch.Rows[i].Cells[12].Value = false;
                        }
                        else if (dgSearch.Rows[i].Cells[12].Value.ToString() == "0")
                        {
                            dgSearch.Rows[i].Cells[12].Value = true;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("سفارش انتخاب شده کد رهگیری ندارد.ریزگزارش \n " + ex.Message);
            }
        }
コード例 #12
0
 private void dgSearch_CellContentClick(object sender, DataGridViewCellEventArgs e)
 {
     try
     {
         if (e.ColumnIndex == 11)
         {
             int selectId = int.Parse(dgSearch.CurrentRow.Cells[10].Value.ToString());
             using (var context = new StimulsoftEntities())
             {
                 var select = context.ReportService.Where(c => c.Id == selectId).FirstOrDefault();
                 if (select.Ready == "1")
                 {
                     select.Ready = "0";
                     context.SaveChanges();
                     dgSearch.CurrentCell.Value = true;
                     return;
                 }
                 if (select.Ready == "0")
                 {
                     select.Ready = "1";
                     context.SaveChanges();
                     dgSearch.CurrentCell.Value = false;
                     return;
                 }
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("عوض کردن وضعیت آماده جستجو" + "\n" + ex.Message);
     }
 }
コード例 #13
0
        } // mohasebe mahsool mande dar anbar hamrah ba darj dar datagridview

        public bool Select_Prodoct_Name() // entekhab mahsool
        {
            //if (count > 1)
            //{
            StimulsoftEntities context = new StimulsoftEntities();
            var getId = context.AnbarProdoct.Where(c => c.Name == comProdoct.Text).FirstOrDefault();

            if (getId != null)
            {
                var getProdocts = context.Anbar.Where(c => c.IdProdoct == getId.Code).ToList();
                //dgSearch.DataSource = getProdocts;
                int dateFirst = int.Parse(DateFirst.Text.Replace("/", ""));
                int dateEnd   = int.Parse(DateEnd.Text.Replace("/", ""));
                //for (int i = 0; i < getProdocts.Count; i++)
                //{
                var prodoct = getProdocts.Where(c => c.DateExpierd >= dateFirst && c.DateExpierd <= dateEnd).ToList();
                dgSearch.DataSource = prodoct;
                //}
                return(true);
            }
            else
            {
                return(false);
            }



            //}
        }
コード例 #14
0
ファイル: FormReports.cs プロジェクト: amirrasooli69/Service
        private void btnReportProdoct_Click(object sender, EventArgs e)
        {
            try
            {
                dgSearch.DataSource = null;
                using (var context = new StimulsoftEntities())
                {
                    int startDate = int.Parse(dtStart1.Text.Replace("/", ""));
                    int endDate   = int.Parse(dtEnd1.Text.Replace("/", ""));

                    var findProdoct = context.ReportService.Where(c => c.Date >= startDate && c.Date <= endDate).ToList();
                    //dgSearch.DataSource = findDate;

                    findProdoct         = findProdoct.Where(c => c.Kind == comCategory.Text && c.Kala == comProdoct.Text).ToList();
                    dgSearch.DataSource = findProdoct;

                    lblTotalResive.Text = findProdoct.Count.ToString();
                }
                Design_GrideView_Report_Service();

                lblTotalPrice.Text = Jame_Kole_Mahsool().ToString();
            }
            catch (Exception ex)
            {
                MessageBox.Show("بعضی از مقادیر وارد نشده \n" + ex.Message);
            }
        }
コード例 #15
0
ファイル: FormReports.cs プロジェクト: amirrasooli69/Service
        private void txtEshterak_TextChanged(object sender, EventArgs e)
        {
            try
            {
                using (var context = new StimulsoftEntities())
                {
                    var find = context.Service.Where(c => c.Eshterak == txtEshterak.Text).ToList();

                    dgSearch.DataSource = find;
                }
                Design_GrideView_Service();


                string [] ret = Calculate.Remaining_Total(txtEshterak.Text).Split(',');
                lblTotalMande.Text  = ret[0];
                lblBestankar.Text   = ret[1];
                lblTotalPrice.Text  = ret[2];
                lblTotalResive.Text = ret[3];

                lblTotallTakhfif.Text = ret[4];
            }
            catch (Exception ex)
            {
                MessageBox.Show("بعضی از مقادیر وارد نشده \n" + ex.Message);
            }
        }
コード例 #16
0
ファイル: FormReports.cs プロジェクト: amirrasooli69/Service
        private void btnReportUser_Click(object sender, EventArgs e)
        {
            try
            {
                if (txtEshterak.Text == "")
                {
                    txtEshterak.Focus();
                }
                using (var context = new StimulsoftEntities())
                {
                    var find = context.Service.Where(c => c.Eshterak == txtEshterak.Text).ToList();

                    dgSearch.DataSource = find;
                }
                Design_GrideView_Service();
                lblTotalPrice.Text    = Jame_Kole_Karkard().ToString();
                lblTotalResive.Text   = Jame_Kole_Daryafti().ToString();
                lblTotalMande.Text    = Jame_Kole_Mande().ToString();
                lblTotallTakhfif.Text = Jame_Kole_Takhfif().ToString();
            }
            catch (Exception ex)
            {
                MessageBox.Show("بعضی از مقادیر وارد نشده \n" + ex.Message);
            }
        }
コード例 #17
0
        private void btnSaveProdoct_Click(object sender, EventArgs e)
        {
            if (majhool[0] == "editProdoct") // baraye edit kardane mahsool
            {
                using (var context = new StimulsoftEntities())
                {
                    Int32 id            = Int32.Parse(majhool[1]);
                    var   selectProdoct = context.AnbarProdoct.Where(c => c.Id == id).FirstOrDefault();
                    if (selectProdoct == null)
                    {
                        MessageBox.Show("این نام محصول تکراری است", "ثبت", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                    else
                    {
                        selectProdoct.Name        = txtNameProdoct.Text;
                        selectProdoct.Code        = int.Parse(txtCodeProdoct.Text);
                        selectProdoct.IdUnit      = comUnit.SelectedIndex;
                        selectProdoct.Description = txtDetails.Text;
                        selectProdoct.Barcode     = txtBarcode.Text;
                        selectProdoct.RfID        = txtRFID.Text;
                        context.SaveChanges();
                        MessageBox.Show("ویرایش انجام شد", "ویرایش", MessageBoxButtons.OK, MessageBoxIcon.Information);

                        this.Close();
                        FormAnbar frmAnbar = new FormAnbar();
                        frmAnbar.Refresh_dgProdoct();
                    }
                }
            }
        }
コード例 #18
0
ファイル: FormEditUser.cs プロジェクト: amirrasooli69/Service
        //**************

        private void btnEdit_Click(object sender, EventArgs e)
        {
            try
            {
                lblError.Text = "";
                if (txtPhone.TextLength > 11 || txtPhone.TextLength < 11)
                {
                    lblError.ForeColor = Color.Red;
                    lblError.Text      = "شماره موبایل 11 عدد نیست";
                    //txtPhone.Text = "0";
                    return;
                }
                using (var context = new StimulsoftEntities())
                {
                    var findPhone = context.User.Where(c => c.Phone == txtPhone.Text).ToList();
                    if (phoneNumber != txtPhone.Text || phoneNumber != txtPhone.Text)
                    {
                        if (findPhone != null)
                        {
                            lblError.Text = "این شماره تماس قبلا ثبت شده";
                            return;
                        }
                    }
                    var editUser = context.User.Where(c => c.Eshterak == txtEshterak.Text).FirstOrDefault();


                    editUser.Name  = txtName.Text;
                    editUser.Phone = txtPhone.Text;
                    //editUser.Eshterak = txtEshterak.Text;
                    if (txtEnter.Text == "    /  /")
                    {
                        editUser.Date = 0;
                    }
                    else
                    {
                        editUser.Date = Int64.Parse(txtEnter.Text.Replace("/", ""));
                    }
                    editUser.Email     = txtEmail.Text;
                    editUser.Address   = txtAddress.Text;
                    editUser.PostiCode = txtPostiCode.Text;
                    if (txtBirthDay.Text == "    /  /")
                    {
                        editUser.BirthDayDate = 0;
                    }
                    else
                    {
                        editUser.BirthDayDate = Int64.Parse(txtBirthDay.Text.Replace("/", ""));
                    }
                    //************
                    context.SaveChanges();
                    lblError.ForeColor = Color.Green;
                    lblError.Text      = "اطلاعات با موفقیت ثبت شد";
                }
            }
            catch (Exception)
            {
                lblError.Text = "";
            }
        }
コード例 #19
0
ファイル: FormReports.cs プロジェクト: amirrasooli69/Service
 //**************
 private void FormReports_Load(object sender, EventArgs e)
 {
     //------
     using (var context = new StimulsoftEntities())
     {
         if (PanelUser.Visible == true) // amade kardane panel user baraye gozaresh bar asase moshtari
         {
             var      select   = context.Service.ToList();
             string[] eshterak = new string[select.Count];
             for (int i = 0; i < select.Count; i++)
             {
                 eshterak[i] = select[i].Eshterak.ToString();
             }
             AutoCompleteStringCollection suggestEshterak = new AutoCompleteStringCollection();
             txtEshterak.AutoCompleteCustomSource = suggestEshterak;
             suggestEshterak.AddRange(eshterak);
             //-------
             string[] phone = new string[select.Count];
             for (int i = 0; i < select.Count; i++)
             {
                 phone[i] = select[i].Mobile.ToString();
             }
             AutoCompleteStringCollection suggestPhone = new AutoCompleteStringCollection();
             txtPhone.AutoCompleteCustomSource = suggestPhone;
             suggestPhone.AddRange(phone);
         }
         if (panelProdoct.Visible == true)// amade kardane panel prodoct baraye gozaresh bar asase mahsool
         {
             panelProdoct.BringToFront();
             var category = context.Category.ToList();
             if (category.Count > 0)
             {
                 comCategory.DataSource    = category;
                 comCategory.DisplayMember = "Name";
             }
             //---------
             var prodoct = context.Prodoct.Where(c => c.NameService == comCategory.Text).ToList();
             comProdoct.DataSource    = prodoct;
             comProdoct.DisplayMember = "Name";
             //----------
             dtStart1.Text = Practical.Today_Date();
             dtEnd1.Text   = Practical.Today_Date();
             //----------
             label4.Text              = "تعداد:";
             label7.Visible           = false;
             label9.Visible           = false;
             lblTotalMande.Visible    = false;
             lblTotallTakhfif.Visible = false;
         }
     }
     //-----------
     if (PanelDate.Visible == true) // amade kardane panel date baraye gozaresh bar asase zaman
     {
         dtStart.Today_Click(null, null);
         dtEnd.Today_Click(null, null);
     }
     //------
 }
コード例 #20
0
ファイル: FormWorks.cs プロジェクト: amirrasooli69/Service
 public void Incomplete() // entekhabe anjam nashodeha
 {
     try
     {
         StimulsoftEntities context = new StimulsoftEntities();
         var works = context.ReportService.Where(c => c.Ready == "1").ToList();
         dgSearch.DataSource = works;
     }
     catch (Exception)
     { }
 }
コード例 #21
0
        private void Design_GrideView_Edit_Report_Service()
        {
            StimulsoftEntities context = new StimulsoftEntities();

            dgSearch.DataSource = null;
            dgSearch.Rows.Clear();
            dgSearch.Columns.Clear();
            var user = context.ReportService.Where(c => c.CodeRahgiri == label1.Text).ToList();

            dgSearch.DataSource = user;

            DataGridViewCheckBoxColumn chk = new DataGridViewCheckBoxColumn();

            dgSearch.Columns.Add(chk);
            //dgSearch.Columns[0].DefaultCellStyle = chk;
            chk.HeaderText   = "آماده بودن";
            chk.Name         = "Ready";
            chk.DisplayIndex = 0;
            //dgSearch.Columns[0].Visible = false;
            //dgSearch.Columns[0].HeaderText = "آماده بودن";
            //dgSearch.Columns[0].DefaultCellStyle = data
            //dgSearch.Columns[0].HeaderText = "آماده بودن";
            dgSearch.Columns[0].Visible = false;
            //dgSearch.Columns[0].DisplayIndex = 11;
            dgSearch.Columns[1].HeaderText = "اشتراک";
            dgSearch.Columns[2].HeaderText = "تاریخ";
            dgSearch.Columns[2].DefaultCellStyle.Format = "0000/00/00";
            //dgSearch.Columns[3].Visible = false;
            dgSearch.Columns[3].HeaderText = "دسته";
            //dgSearch.Columns[4].Visible = false;
            dgSearch.Columns[4].HeaderText = "محصول";
            //dgSearch.Columns[5].Visible = false;
            dgSearch.Columns[5].HeaderText = "سرویس";
            //dgSearch.Columns[6].Visible = false;
            dgSearch.Columns[6].HeaderText = "تعداد";
            //dgSearch.Columns[7].Visible = false;
            dgSearch.Columns[7].HeaderText  = "مبلغ";
            dgSearch.Columns[8].HeaderText  = "کد رهگیری";
            dgSearch.Columns[9].Visible     = false;
            dgSearch.Columns[9].HeaderText  = " شماره";
            dgSearch.Columns[10].Visible    = false;
            dgSearch.Columns[10].HeaderText = "تعداد مراجعه";
            //dgSearch.Columns[11].DisplayIndex = 0;
            dgSearch.Columns[11].HeaderText = "ارزش افزوده";

            var btnDeleteRow = new DataGridViewButtonColumn();

            btnDeleteRow.Name = "btnDeleteRow";
            btnDeleteRow.Text = "حذف";
            btnDeleteRow.UseColumnTextForButtonValue = true;
            btnDeleteRow.HeaderText = "";
            btnDeleteRow.Width      = 75;
            this.dgSearch.Columns.Add(btnDeleteRow);
        }
コード例 #22
0
 private void btnSaveUser_Click(object sender, EventArgs e)
 {
     try
     {
         using (var context = new StimulsoftEntities())
         {
             Colleague colleague = new Colleague();
             colleague.Name  = txtName.Text;
             colleague.Phone = txtPhone.Text;
             colleague.Tel   = txtTel.Text;
             //----
             string selectDay = dateEnter.Text.Replace("/", "");
             selectDay = selectDay.Replace(" ", "");
             if (selectDay == "")
             {
                 colleague.DateEnter = 0;
             }
             else
             {
                 colleague.DateEnter = int.Parse(selectDay);
             }
             selectDay = dateBirthDay.Text.Replace("/", "");
             selectDay = selectDay.Replace(" ", "");
             if (selectDay == "")
             {
                 colleague.DateBirthDay = 0;
             }
             else
             {
                 colleague.DateBirthDay = int.Parse(selectDay);
             }
             if (radFemale.Enabled)
             {
                 colleague.Sex = "زن";
             }
             else
             {
                 colleague.Sex = "مرد";
             }
             colleague.Address       = txtAddress.Text;
             colleague.CardNumber    = mtxtCardNumber.Text;
             colleague.AccountNumber = txtAccountNumber.Text;
             colleague.Description   = txtDescription.Text;
             colleague.Email         = txtEmail.Text;
             colleague.Eshterak      = txtEshterak.Text;
             context.Colleague.Add(colleague);
             context.SaveChanges();
         }
     }
     catch (Exception)
     {
         MessageBox.Show("مشکل در ثبت همکار", "همکار", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
コード例 #23
0
ファイル: FormSearch.cs プロジェクト: amirrasooli69/Service
        private void Search_Code_Rahgiri()
        {
            //try
            //{
            //    using (var context = new LundryEntities2())
            //    {
            //        dgSearch.DataSource = null;
            //        var user = context.ReportServices.Where(c => c.CodeRahgiri == txtSearch.Text).ToList();
            //        if (user != null)
            //        {
            //            dgSearch.DataSource = user;
            //            Design_GrideView_Report_Service();
            //            for (int i = 0; i < user.Count; i++)
            //            {
            //                if (dgSearch.Rows[i].Cells[0].Value == null)
            //                    dgSearch.Rows[i].Cells[11].Value = true;
            //                else if (dgSearch.Rows[i].Cells[0].Value.ToString() == "0")
            //                    dgSearch.Rows[i].Cells[11].Value = true;
            //                else if (dgSearch.Rows[i].Cells[0].Value.ToString() == "1")
            //                    dgSearch.Rows[i].Cells[11].Value = false;


            //            }

            //        }
            //    }

            //}
            //catch (Exception ex)
            //{

            //    MessageBox.Show("سفارش انتخاب شده کد رهگیری ندارد.کدرهگیری جستجو \n " + ex.Message);
            //}

            try
            {
                using (var context = new StimulsoftEntities())
                {
                    dgSearch.DataSource = null;
                    var find = context.ReportService.Where(current => current.CodeRahgiri == txtSearch.Text).ToList();
                    dgSearch.DataSource = find;
                    //-----------------
                    Design_GrideView_Report_Service();
                    //-----------------

                    dgSearch.Show();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
コード例 #24
0
        public void load_Access()
        {
            try
            {
                //FormMain1 frmMain = new FormMain1();

                using (var context = new StimulsoftEntities())
                {
                    var select = context.Manage.Where(current => current.UserName == label6.Text).FirstOrDefault();

                    if (select.NewService == "1")
                    {
                        chxNewService.Checked = true;
                    }
                    //-----
                    if (select.Tools == "1")
                    {
                        chxTools.Checked = true;
                    }
                    //-----
                    if (select.Search == "1")
                    {
                        chxSearch.Checked = true;
                    }
                    //-----
                    if (select.Sms == "1")
                    {
                        chxSms.Checked = true;
                    }
                    //----
                    if (select.Report == "1")
                    {
                        chxReport.Checked = true;
                    }
                    //----
                    if (select.Backup == "1")
                    {
                        chxBackup.Checked = true;
                    }
                    //----
                    if (select.Setting == "1")
                    {
                        chxSetting.Checked = true;
                    }
                    //----
                    //comAccess.SelectedIndex = int.Parse(select.Access);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("load access" + "\n" + ex.Message);
            }
        }
コード例 #25
0
        private void btnUpdatePriceOilMotor_Click(object sender, EventArgs e)
        {
            lblError.Text = "";
            try
            {
                using (var context = new StimulsoftEntities())
                {
                    Int64 price   = Convert.ToInt64(txtServisPrice.Text);
                    var   service = context.ServicesPrice.Where(current => current.ServisKind == comGroup.Text && current.ServiceKala == txtKindKala.Text && current.ServiseName == txtServiceName.Text && current.ServicePrice == price).ToList();
                    if (service.Count == 0)
                    {
                        int x      = Convert.ToInt16(dgShow.CurrentRow.Cells[4].Value.ToString());
                        var update = context.ServicesPrice.Where(current => current.Id == x).FirstOrDefault();
                        if (update != null)
                        {
                            update.ServisKind  = comGroup.Text;
                            update.ServiceKala = txtKindKala.Text;
                            update.ServiseName = txtServiceName.Text;

                            if (txtServisPrice.Text != "")
                            {
                                update.ServicePrice = Convert.ToInt64(txtServisPrice.Text);
                            }
                            else
                            {
                                update.ServicePrice = 0;
                            }
                            context.SaveChanges();
                            context.Dispose();
                        }



                        lblError.ForeColor = Color.Green;
                        lblError.Text      = "ویرایش با موفقبت اتجام شد";
                        Refresh_Price();
                    }
                    else
                    {
                        lblError.ForeColor = Color.Red;
                        lblError.Text      = " خدمت با این مقادیر وجود دارد";
                    }
                }
            }

            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
コード例 #26
0
        private void FormReportAnbar_Load(object sender, EventArgs e)
        {
            DateFirst.Text = Practical.Today_Date();
            DateEnd.Text   = Practical.Today_Date();
            StimulsoftEntities context = new StimulsoftEntities();

            if (context.AnbarProdoct.Count() > 0)
            {
                var prodocts = context.AnbarProdoct.ToList();
                comProdoct.DataSource    = prodocts;
                comProdoct.DisplayMember = "Name";
                Refresh_dgSearch();
            }
        }
コード例 #27
0
        public void Refresh_Price()
        {
            using (var context = new StimulsoftEntities())
            {
                dgShow.DataSource = context.ServicesPrice.ToList();

                dgShow.Columns[0].HeaderText = "دسته";
                dgShow.Columns[1].HeaderText = "محصول";
                dgShow.Columns[2].HeaderText = "سرویس";
                dgShow.Columns[3].HeaderText = "قیمت";
                dgShow.Columns[4].HeaderText = "شماره";
                //dgShow.Columns[4].Visible = false;
            }
        }
コード例 #28
0
 private void btnSearchNumber_Click(object sender, EventArgs e)
 {
     try
     {
         dgSearch.DataSource = null;
         using (var context = new StimulsoftEntities())
         {
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
コード例 #29
0
        public string Count_Prodct_Anbar(string NameProdoct) // tedad mojoodi anbar
        {
            StimulsoftEntities context = new StimulsoftEntities();
            var getId = context.AnbarProdoct.Where(c => c.Name == NameProdoct).FirstOrDefault();

            if (getId != null)
            {
                var getProdocts = context.Anbar.Where(c => c.IdProdoct == getId.Code).ToList();
                //dgSearch.DataSource = getProdocts;
                //************
                //************
                long existing = 0;
                if (getProdocts.Count > 0)
                {
                    for (int i = 0; i < getProdocts.Count; i++)
                    {
                        long selectCase     = Int32.Parse(getProdocts[i].IdParent.ToString());
                        var  findParentCase = context.AnbarParent.Where(c => c.Id == selectCase).FirstOrDefault();
                        if (findParentCase != null)
                        {
                            switch (findParentCase.Case)
                            {
                            case 0:     // reside khard (mojoodi ezafe shavad)
                            case 3:     // resid tolid (mojoodi ezafe shavad)
                            case 4:     // bargasgt kala foroosh (mojoodi ezafe shavad)
                            case 5:     // bargashte kala masraf (mojoodi ezafe shavad)
                            case 7:     // bargasht kala amani (mojoodi ezafe shavad)
                            {
                                existing = existing + Int32.Parse(getProdocts[i].Positiv.ToString());
                                break;
                            }


                            case 1:     // havale foroosh (mojoodi kam shavad)
                            case 2:     // havale masraf (mojoodi kam shavad)
                            case 6:     // havale anbar amani (mojoodi kam shavad)
                            {
                                existing = existing - Int32.Parse(getProdocts[i].Negativ.ToString());
                                break;
                            }
                            }
                        }
                    }
                }
                return(existing.ToString());
            }

            return("0");
        }
コード例 #30
0
ファイル: FormReports.cs プロジェクト: amirrasooli69/Service
 private void comCategory_SelectedIndexChanged(object sender, EventArgs e)
 {
     try
     {
         using (var context = new StimulsoftEntities())
         {
             var prodoct = context.Prodoct.Where(c => c.NameService == comCategory.Text).ToList();
             comProdoct.DataSource    = prodoct;
             comProdoct.DisplayMember = "Name";
         }
     }
     catch (Exception)
     {
     }
 }