Example #1
0
 public void Refresh_dgUser()
 {
     try
     {
         using (var context = new kitchenEntities())
         {
             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);
     }
 }
Example #2
0
        private void Search_Service()
        {
            try
            {
                using (var context = new kitchenEntities())
                {
                    var find = context.Service.Where(current => current.Eshterak.Contains(txtEshterak.Text)).ToList();
                    dgDelete.DataSource = find;
                    //--------------------

                    dgDelete.Columns[0].HeaderText  = "اشتراک";
                    dgDelete.Columns[1].HeaderText  = "نام";
                    dgDelete.Columns[2].HeaderText  = "تاریخ سرویس";
                    dgDelete.Columns[3].HeaderText  = "شماره تماس";
                    dgDelete.Columns[4].HeaderText  = "بیعانه";
                    dgDelete.Columns[5].HeaderText  = "باقیمانده";
                    dgDelete.Columns[6].HeaderText  = " مبلغ";
                    dgDelete.Columns[7].Visible     = false;
                    dgDelete.Columns[7].HeaderText  = "تصفیه";
                    dgDelete.Columns[8].HeaderText  = "کد رهگیری";
                    dgDelete.Columns[9].HeaderText  = "تعداد";
                    dgDelete.Columns[10].HeaderText = "تاریخ آماده";
                    dgDelete.Columns[11].HeaderText = "تعداد پیامک آماده";
                    dgDelete.Columns[12].HeaderText = "مبلغ تخفیف";
                    dgDelete.Columns[13].HeaderText = "توضیحات";
                    dgDelete.Columns[14].Visible    = false;

                    dgDelete.Show();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Example #3
0
 private void FormSms_Load(object sender, EventArgs e)
 {
     dtSearch.Today_Click(null, null);
     comRemeberBirthDay.SelectedIndex = 0;
     try
     {
         using (var context = new kitchenEntities())
         {
             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);
     }
 }
Example #4
0
 private void Search_Eshterak()
 {
     try
     {
         using (var context = new kitchenEntities())
         {
             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);
     }
 }
Example #5
0
        private void FormEditSmallReport_Load(object sender, EventArgs e)
        {
            try
            {
                using (var context = new kitchenEntities())
                {
                    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[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);
            }
        }
Example #6
0
        private void btnDeleteMotorOil_Click(object sender, EventArgs e)
        {
            lblError.Text = "";
            try
            {
                using (var context = new kitchenEntities())
                {
                    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      = "عملیات حذف با مشکل مواجه شد";
            }
        }
 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 kitchenEntities())
             {
                 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);
     }
 }
Example #8
0
 private void btnSearchMotorOil_Click(object sender, EventArgs e)
 {
     lblError.Text = "";
     try
     {
         if (txtKindKala.Text == "" || txtServisPrice.Text == "")
         {
             using (var context = new kitchenEntities())
             {
                 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);
     }
 }
 //**************
 private void FormReports_Load(object sender, EventArgs e)
 {
     //------
     using (var context = new kitchenEntities())
     {
         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);
     }
     //-----------
     dtStart.Today_Click(null, null);
     dtEnd.Today_Click(null, null);
     //------
 }
        private void btnReportUser_Click(object sender, EventArgs e)
        {
            try
            {
                if (txtEshterak.Text == "")
                {
                    txtEshterak.Focus();
                }
                using (var context = new kitchenEntities())
                {
                    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);
            }
        }
Example #11
0
 private void btnSaveNumber_Click(object sender, EventArgs e)
 {
     try
     {
         using (var context = new kitchenEntities())
         {
             var save = context.Setting.FirstOrDefault();
             //---------------bekhatere inke table faghat 1 record dashte bashad if gozashtam
             if (save != null)
             {
                 save.NumberSms = txtNumberSms.Text;
                 context.SaveChanges();
                 MessageBox.Show(" شماره ویرایش شد", "وضعیت", MessageBoxButtons.OK, MessageBoxIcon.Information);
                 return;
             }
             else
             {
                 Setting setting = new Setting();
                 setting.NumberSms = txtNumberSms.Text;
                 context.Setting.Add(setting);
                 context.SaveChanges();
                 MessageBox.Show(" شماره ثبت شد", "وضعیت", MessageBoxButtons.OK, MessageBoxIcon.Information);
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Example #12
0
 private void chxInviteCluoeSms_Click(object sender, EventArgs e)
 {
     try
     {
         using (var context = new kitchenEntities())
         {
             var setting = context.Setting.FirstOrDefault();
             if (setting.InviteClubeSms == "true")
             {
                 setting.InviteClubeSms = "false";
                 context.SaveChanges();
                 return;
             }
             else
             {
                 setting.InviteClubeSms = "true";
                 context.SaveChanges();
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Example #13
0
 private void btnEnter_Click(object sender, EventArgs e)
 {
     try
     {
         using (var context = new kitchenEntities())
         {
             var userManage = context.Manage.Where(current => current.UserName == txtUsername.Text).FirstOrDefault();//ya avali o miyare ya hichi
             if (userManage == null)
             {
                 MessageBox.Show("نام کاربری یا رمز عبور اشتباه است", "هشدار", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                 txtUsername.Focus();
                 return;
             }
             else
             {
                 if (userManage.Password == txtPassword.Text)
                 {
                     FormMain1 frmMain = new FormMain1();
                     frmMain.stripLblLogin.Text = txtUsername.Text;
                     frmMain.Show();
                     this.Close();
                 }
                 else
                 {
                     MessageBox.Show("نام کاربری یا رمز عبور اشتباه است", "هشدار", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                     txtUsername.Focus();
                 }
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Example #14
0
        private void FormDelete_Load(object sender, EventArgs e)
        {
            kitchenEntities context = new kitchenEntities();

            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);
            }
        }
        //**************

        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 kitchenEntities())
                {
                    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 = "";
            }
        }
Example #16
0
        public void First_Enter() //vorod baraye avalin bar
        {
            try
            {
                using (var context = new kitchenEntities())
                {
                    string date = DateTime.Now.ToShortDateString().Replace("/", "");
                    //string hard = Get_Serial_Hard();
                    Reg reg = new Reg();
                    reg.State = IDGenerator.GetCPUId();
                    reg.Date  = int.Parse(date);
                    //string version = "1";
                    //string s = hard + version + date;
                    //reg.Serial1 = s;
                    reg.CountOpen = 1;
                    //version = exsistSerial.CountOpen.ToString();

                    context.Reg.Add(reg);
                    //-----
                    Setting avlie = new Setting();
                    avlie.EndCreateCodeRahgiri = 0;
                    context.Setting.Add(avlie);

                    //-----
                    bool exsist = context.Manage.Where(c => c.UserName == "admin").Any();
                    if (exsist == false)
                    {
                        Manage manage = new Manage();
                        manage.UserName   = "******";
                        manage.Password   = "******";
                        manage.Access     = "0";
                        manage.NewService = "0";
                        manage.Tools      = "0";
                        manage.Search     = "0";
                        manage.Sms        = "0";
                        manage.Report     = "0";
                        manage.Backup     = "0";
                        manage.Setting    = "0";
                        context.Manage.Add(manage);
                        context.SaveChanges();
                    }
                    //-----
                    var whhiteSms = context.WhiteSms.Where(c => c.Id == 1).FirstOrDefault();
                    whhiteSms.R11 = "8a1e98m"; //baraye register
                    whhiteSms.R10 = "0";       //baraye ersal code rigister ba panel sms papiloo


                    context.SaveChanges();
                    strlblVersion.Text = "نسخه آزمایشی";
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("خطا در ورود اولیه:\n" + ex.Message);
            }
        }
        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 kitchenEntities())
                {
                    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);
            }
        }
Example #18
0
        public void load_Access()
        {
            try
            {
                //FormMain1 frmMain = new FormMain1();

                using (var context = new kitchenEntities())
                {
                    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);
            }
        }
Example #19
0
        private void btnUpdatePriceOilMotor_Click(object sender, EventArgs e)
        {
            lblError.Text = "";
            try
            {
                using (var context = new kitchenEntities())
                {
                    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);
            }
        }
Example #20
0
 private void btnSearchNumber_Click(object sender, EventArgs e)
 {
     try
     {
         dgSearch.DataSource = null;
         using (var context = new kitchenEntities())
         {
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Example #21
0
        public void Refresh_Price()
        {
            using (var context = new kitchenEntities())
            {
                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;
            }
        }
Example #22
0
        private void Design_GrideView_Report_Service()
        {
            kitchenEntities context = new kitchenEntities();

            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].Visible    = false;
            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;

            var btnDeleteRow = new DataGridViewButtonColumn();

            btnDeleteRow.Name = "btnDeleteRow";
            btnDeleteRow.Text = "حذف";
            btnDeleteRow.UseColumnTextForButtonValue = true;
            btnDeleteRow.HeaderText = "";
            btnDeleteRow.Width      = 75;
            this.dgSearch.Columns.Add(btnDeleteRow);
        }
Example #23
0
 public void Active() //Active kamel ba code hard barabar
 {
     try
     {
         using (var context = new kitchenEntities())
         {
             strlblVersion.Text = "برنامه کامل";
             Accsess();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(" خطا در برنامه کامل:\n" + ex.Message);
     }
 }
Example #24
0
 private void txtWarningCreadit_Leave(object sender, EventArgs e)
 {
     try
     {
         using (var context = new kitchenEntities())
         {
             var select = context.WhiteSms.FirstOrDefault();
             select.R10 = txtWarningCreadit.Text;
             context.SaveChanges();
         }
     }
     catch (Exception)
     {
         MessageBox.Show("مشکل در هشدار اعتبار");
     }
 }
Example #25
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            lblError.Text = "";
            try
            {
                using (var context = new kitchenEntities())
                {
                    var delete = context.Manage.Where(current => current.UserName.Contains(txtUsername.Text)).ToList();
                    if (delete.Count == 0)
                    {
                        var result = MessageBox.Show("کاربر مورد نظر پیدا نشد،آیا همه موارد را میخواهید؟", "مدیریت", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
                        if (result == DialogResult.Yes)
                        {
                            dgManage.DataSource = context.Manage.ToList();
                            Refresh_Manage();
                        }
                        else
                        {
                            txtUsername.Focus();
                        }
                    }
                    if (delete.Count == 1)
                    {
                        Manage del = context.Manage.Where(current => current.UserName == txtUsername.Text).FirstOrDefault();
                        context.Manage.Remove(del);
                        context.SaveChanges();
                        lblError.ForeColor = Color.Green;
                        lblError.Text      = "کاربر با موفقیت حذف شد";
                        context.Dispose();



                        Refresh_Manage(); txtUsername.Text = ""; txtPassword.Text = ""; txtConfrimPasword.Text = "";
                    }
                    if (delete.Count > 1)
                    {
                        dgManage.DataSource = delete.ToList();
                    }
                }
            }
            catch (Exception)
            {
                lblError.ForeColor = Color.Red;
                lblError.Text      = "عملیات حذف با مشکل مواجه شد";
            }
        }
 private void txtEshterak_TextChanged(object sender, EventArgs e)
 {
     using (var context = new kitchenEntities())
     {
         bool isContact = context.User.Where(check => check.Eshterak == txtEshterak.Text).Any();
         if (isContact)
         {
             //MessageBox.Show("کاربری بااین شماره اشتراک وجود دارد", "اشتراک", MessageBoxButtons.OK, MessageBoxIcon.Warning);
             lblError.ForeColor = Color.Red;
             lblError.Text      = "کاربری بااین شماره اشتراک وجود دارد";
         }
         else
         {
             lblError.Text = "";
         }
     }
 }
 private void btnSearch_Click(object sender, EventArgs e)
 {
     try
     {
         using (var context = new kitchenEntities())
         {
             int date    = Find_BirthDay(dtBirthDay.Text, int.Parse(comRemeberBirthDay.Text));
             var tavalod = context.User.Where(c => c.BirthDayDate == date).ToList();
             dgSearch.DataSource = tavalod;
         }
         Design_GrideView_BirthDay();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
 private void Search_Compelete_Name()
 {
     try
     {
         using (var context = new kitchenEntities())
         {
             var find = context.User.Where(c => c.Name.StartsWith(txtSearch.Text)).ToList();
             dgSearch.DataSource = find;
             //-----------------
             Design_GrideView_User();
             //-----------------
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Example #29
0
 public void Refresh_Manage()//tanzim deta gride
 {
     using (var context = new kitchenEntities())
     {
         dgManage.DataSource            = context.Manage.Where(ex => ex.UserName != null).ToList();
         dgManage.Columns[0].HeaderText = "نام کاربری";
         dgManage.Columns[1].HeaderText = "کلمه عبور";
         dgManage.Columns[2].HeaderText = "دسترسی";
         dgManage.Columns[3].HeaderText = "شماره";
         dgManage.Columns[3].Visible    = false;
         dgManage.Columns[4].Visible    = false;
         dgManage.Columns[5].Visible    = false;
         dgManage.Columns[6].Visible    = false;
         dgManage.Columns[7].Visible    = false;
         dgManage.Columns[8].Visible    = false;
         dgManage.Columns[9].Visible    = false;
         dgManage.Columns[10].Visible   = false;
     }
 }
Example #30
0
 public void Accsess()  //dastresiha
 {
     try
     {
         using (var context = new kitchenEntities())
         {
             var Access = context.Manage.Where(current => current.UserName == stripLblLogin.Text).FirstOrDefault();
             if (Access.NewService == "1")
             {
                 toolCreateServiceToolStripMenuItem.Visible = false;
             }
             if (Access.Tools == "1")
             {
                 toolToolsToolStripMenuItem.Visible = false;
             }
             if (Access.Search == "1")
             {
                 toolSearchToolStripMenuItem.Visible = false;
             }
             if (Access.Sms == "1")
             {
                 toolSmsToolStripMenuItem.Visible = false;
             }
             if (Access.Report == "1")
             {
                 toolReports.Visible = false;
             }
             if (Access.Backup == "1")
             {
                 toolBackupRestore.Visible = false;
             }
             if (Access.Setting == "1")
             {
                 toolManageToolStripMenuItem.Visible = false;
             }
             //----
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("خطا در دسترسی:\n" + ex.Message);
     }
 }