Beispiel #1
0
        public static async Task <bool> CreateBackUp(string dbName, string fileName, BackUpSettingBussines cls)
        {
            try
            {
                var path           = Path.Combine(cls.BackUpAddress, fileName);
                var command        = @"BACKUP DATABASE " + dbName + "  TO Disk='" + path + "'";
                var dataConnection = new SqlConnection(Properties.Resources.ConnectionString);
                if (dataConnection.State != ConnectionState.Open)
                {
                    dataConnection.Open();
                }
                var cmd = new SqlCommand {
                    Connection = dataConnection, CommandText = command
                };
                cmd.ExecuteNonQuery();
                cls.LastBackUpDate = DateConvertor.M2SH(DateTime.Now);
                cls.LastBackUpTime = DateTime.Now.Hour + ":" + DateTime.Now.Minute;
                await cls.SaveAsync();

                RaiseEvent();

                if (cls.IsSendInTelegram)
                {
                    await SendBackUpToTelegram(path);
                }
                return(true);
            }
            catch (Exception e)
            {
                WebErrorLog.ErrorInstence.StartErrorLog(e);
                return(false);
            }
        }
        private async void btnFinish_Click(object sender, EventArgs e)
        {
            try
            {
                btnFinish.Enabled = false;
                if (cls.Guid == Guid.Empty)
                {
                    cls.Guid     = Guid.NewGuid();
                    cls.DateSabt = DateConvertor.M2SH(DateTime.Now);
                }

                cls.ChanelForAds = txtBackUpChannel.Text.Trim();
                cls.Status       = true;
                cls.Token        = txtToken.Text.Trim();
                await cls.SaveAsync();

                WebErrorLog.ErrorInstence.StartErrorLog("اطلاعات ذخیره شد", true);
                Close();
            }
            catch (Exception ex)
            {
                WebErrorLog.ErrorInstence.StartErrorLog(ex);
            }
            finally
            {
                btnFinish.Enabled = true;
            }
        }
        private async void btnFinish_Click(object sender, EventArgs e)
        {
            try
            {
                if (cls.Guid == Guid.Empty)
                {
                    cls.Guid     = Guid.NewGuid();
                    cls.DateSabt = DateConvertor.M2SH(DateTime.Now);
                }
                if (string.IsNullOrEmpty(txtLineNumber.Text))
                {
                    WebErrorLog.ErrorInstence.StartErrorLog("شماره خط پنل نمی تواند خالی باشد", false);
                    txtLineNumber.Focus();
                    return;
                }
                if (txtLineNumber.Text.ParseToLong() == 0)
                {
                    WebErrorLog.ErrorInstence.StartErrorLog("شماره خط معتبر نمی باشد", false);
                    txtLineNumber.Focus();
                    return;
                }
                cls.Status     = true;
                cls.LineNumber = txtLineNumber.Text.ParseToLong();
                cls.PanelGuid  = (Guid)cmbPanel.SelectedValue;
                await cls.SaveAsync();

                Clear();
                grpAccount.Enabled = false;
                await LoadData();
            }
            catch (Exception exception)
            {
                WebErrorLog.ErrorInstence.StartErrorLog(exception);
            }
        }
        private async void btnFinish_Click(object sender, EventArgs e)
        {
            try
            {
                btnFinish.Enabled = false;
                if (cls.Guid == Guid.Empty)
                {
                    cls.Guid     = Guid.NewGuid();
                    cls.DateSabt = DateConvertor.M2SH(DateTime.Now);
                }

                cls.BackUpAddress    = txtAddress.Text;
                cls.AutoBackUp       = chbAuto.Checked;
                cls.Status           = true;
                cls.IsSendInTelegram = chbIsSentToTelegram.Checked;
                cls.AutoTime         = txtAutoSecond.Text.ParseToInt() * 60;
                cls.IsSendInEmail    = chbIsSendToEmail.Checked;
                cls.EmailAddress     = txtEmailAddress.Text;
                await cls.SaveAsync();

                WebErrorLog.ErrorInstence.StartErrorLog("اطلاعات ذخیره شد", true);
                SetData();
            }
            catch (Exception ex)
            {
                WebErrorLog.ErrorInstence.StartErrorLog(ex);
            }
            finally
            {
                btnFinish.Enabled = true;
            }
        }
 public List <int> GetAdvCountInSpecialMounthAsync(int dayCount, AdvertiseType type)
 {
     try
     {
         var lstReturn  = new List <int>();
         var firstDate  = DateTime.Now.AddDays(-dayCount);
         var secondDate = DateTime.Now;
         using (var contex = new dbContext())
         {
             for (var i = firstDate; i <= secondDate; i = i.AddDays(1))
             {
                 var counter = 0;
                 var strI    = DateConvertor.M2SH(i);
                 if (type != AdvertiseType.All)
                 {
                     counter = contex.AdvertiseLog.AsNoTracking()
                               .Count(q => q.DateSabt == strI && q.AdvType == type);
                 }
                 else
                 {
                     counter = contex.AdvertiseLog.AsNoTracking()
                               .Count(q => q.DateSabt == strI);
                 }
                 lstReturn.Add(counter);
             }
         }
         return(lstReturn);
     }
     catch (Exception ex)
     {
         WebErrorLog.ErrorInstence.StartErrorLog(ex);
         return(null);
     }
 }
Beispiel #6
0
        public async Task <IActionResult> OnPostAsync(IFormFile sliderImageUp, string startTime, string endTime)
        {
            Slider.SliderImage = sliderImageUp.ToString();
            if (!ModelState.IsValid)
            {
                return(Page());
            }

            if (Slider.SliderType == 2)
            {
                var startDate     = startTime.Split("/");
                var endDate       = endTime.Split("/");
                var ys            = DateConvertor.PersianIntToEn(startDate[0]);
                var ms            = DateConvertor.PersianIntToEn(startDate[1]);
                var ds            = DateConvertor.PersianIntToEn(startDate[2]);
                var ye            = DateConvertor.PersianIntToEn(endDate[0]);
                var me            = DateConvertor.PersianIntToEn(endDate[1]);
                var de            = DateConvertor.PersianIntToEn(endDate[2]);
                var startDateTime = new DateTime(ys, ms, ds).ToMiladiDate();
                var endDateTime   = new DateTime(ye, me, de).ToMiladiDate();
                Slider.SliderStartTime = startDateTime;
                Slider.SliderEndTime   = endDateTime;
            }
            await _sliderService.AddNewSlider(Slider, sliderImageUp);

            return(RedirectToPage("./Index"));
        }
 private void mnuLog_Click(object sender, EventArgs e)
 {
     try
     {
         var date = DateConvertor.M2SH(DateTime.Now);
         date = date.Replace("/", "_") + "_" + DateTime.Now.Hour + "_" + DateTime.Now.Minute + ".txt";
         var sfd = new SaveFileDialog {
             Filter = "Text Files(*.txt)|*.txt", DefaultExt = ".txt", FileName = date
         };
         if (sfd.ShowDialog() != DialogResult.OK)
         {
             return;
         }
         var list = new List <string>();
         for (var i = 0; i < DGrid.RowCount; i++)
         {
             list.Add(DGrid[dgNumber.Index, i].Value.ToString());
         }
         File.WriteAllLines(sfd.FileName, list);
     }
     catch (Exception exception)
     {
         WebErrorLog.ErrorInstence.StartErrorLog(exception);
     }
 }
        private async void btnFinish_Click(object sender, EventArgs e)
        {
            try
            {
                if (cls.Guid == Guid.Empty)
                {
                    cls.Guid     = Guid.NewGuid();
                    cls.DateSabt = DateConvertor.M2SH(DateTime.Now);
                }
                if (string.IsNullOrEmpty(txtName.Text))
                {
                    WebErrorLog.ErrorInstence.StartErrorLog("عنوان گروه نمی تواند خالی باشد", false);
                    txtName.Focus();
                    return;
                }
                if (!AdvGroupBussines.Check_Name(txtName.Text, cls.Guid))
                {
                    WebErrorLog.ErrorInstence.StartErrorLog("عنوان وارد شده تکراری است", false);
                    txtName.Focus();
                    return;
                }

                cls.Status     = true;
                cls.Name       = txtName.Text.Trim();
                cls.ParentGuid = (Guid)cmbParent.SelectedValue;
                await cls.SaveAsync();

                DialogResult = DialogResult.OK;
                Close();
            }
            catch (Exception exception)
            {
                WebErrorLog.ErrorInstence.StartErrorLog(exception);
            }
        }
Beispiel #9
0
 private async void btnInsSetting_Click(object sender, EventArgs e)
 {
     var r = new SettingBussines
     {
         Guid = Guid.NewGuid(),
         DateSabt = DateConvertor.M2SH(DateTime.Now),
         Status = true,
         //DivarCat3 = txtD_Cat3.Text,
         //DivarCat1 = txtD_Cat1.Text,
         //DivarPicPath = txtD_Address.Text,
         //CountAdvInDayDivar = int.Parse(txtD_CountInDay.Text),
         //CountAdvInDaySheypoor = int.Parse(txtSh_CountInDay.Text),
         //CountAdvInIPDivar = int.Parse(txtD_CountInIP.Text),
         //CountAdvInIPSheypoor = int.Parse(txtSh_CountInIP.Text),
         //CountAdvInMounthDivar = int.Parse(txtD_CountInMounth.Text),
         //CountAdvInMounthSheypoor = int.Parse(txtSh_CountInMounth.Text),
        // DivarCat2 = txtD_Cat2.Text,
        // DivarDayCountForUpdateState = 10,
         //SheypoorCat1 = txtSh_Cat1.Text,
         //SheypoorCat2 = txtSh_Cat2.Text,
         //SheypoorCat3 = txtSh_Cat3.Text,
        // SheypoorDayCountForUpdateState = 10,
        // SheypoorPicPath = txtSh_Address.Text,
         //DivarMaxImgCount = int.Parse(txtDivarMaxImg.Text),
         //SheypoorMaxImgCount = int.Parse(txtSheypoorMaxImg.Text)
     };
     await r.SaveAsync();
 }
Beispiel #10
0
        private void BtnFinish_Click(object sender, EventArgs e)
        {
            try
            {
                btnFinish.Enabled = false;
                if (anbar.Guid == Guid.Empty)
                {
                    anbar.DateSabt = DateConvertor.M2SH(DateTime.Now);
                    anbar.Guid     = Guid.NewGuid();
                }

                if (cmbGroup.SelectedValue == null)
                {
                    frmMessage f = new frmMessage(EnumMessageFlag.ShowFlag, Color.Red, "گروه انبار را وارد نمایید");
                    f.ShowDialog();
                    cmbGroup.Focus();
                    return;
                }

                if (string.IsNullOrWhiteSpace(txtName.Text))
                {
                    frmMessage f = new frmMessage(EnumMessageFlag.ShowFlag, Color.Red, "عنوان انبار را وارد نمایید");
                    f.ShowDialog();
                    txtName.Focus();
                    return;
                }

                if (!AnbarBussines.Check_Name(txtName.Text.Trim(), anbar.Guid))
                {
                    frmMessage f = new frmMessage(EnumMessageFlag.ShowFlag, Color.Red,
                                                  "عنوان انبار وارد شده تکراری است");
                    f.ShowDialog();
                    txtName.Focus();
                    return;
                }

                anbar.AnbarGroup  = (Guid)cmbGroup.SelectedValue;
                anbar.Description = txtDescription.Text;
                anbar.Name        = txtName.Text;
                anbar.Status      = true;
                anbar.Manfi       = chbManfi.Checked;
                if (anbar.Save())
                {
                    frmMessage f = new frmMessage(EnumMessageFlag.ShowFlag, Color.Green, "عملیات با موفقیت انجام شد");
                    f.ShowDialog();
                    this.DialogResult = DialogResult.OK;
                    this.Close();
                }
            }
            catch (Exception exception)
            {
                frmMessage frm = new frmMessage(EnumMessageFlag.ShowFlag, Color.Red, exception.Message);
                frm.ShowDialog();
            }
            finally
            {
                btnFinish.Enabled = true;
            }
        }
Beispiel #11
0
        public async Task <IActionResult> Register(RegisterViewModel child, List <int> options)
        {
            if (!ModelState.IsValid)
            {
                var items = await _userServices.GetAllGradesAsync();

                ViewData["GradeList"]  = items;
                ViewData["Error"]      = true;
                ViewData["EmployeeId"] = child.EmployeeId;

                return(View(child));
            }

            var birthday = DateConvertor.ToMiladi(child.Birthday);
            var maxDate  = _settingServices.GetBirthDayLimitation();

            if (birthday < maxDate)
            {
                var items = await _userServices.GetAllGradesAsync();

                ViewData["GradeList"]  = items;
                ViewData["Error"]      = true;
                ViewData["EmployeeId"] = child.EmployeeId;

                ModelState.AddModelError("", "تاریخ تولد صحیح نمی باشد");
                return(View(child));
            }


            child.ChildId = await _userServices.AddChildAsync(child);

            await _userServices.AddOptionForChild(child.ChildId, options);

            if (child.OptionalDetailsSampadImages != null)
            {
                child.OptionalSampadDetail = new OptionalDetails()
                {
                    DetailTitleId = 1,
                    ChildId       = child.ChildId
                };

                await _userServices.AddOptionalDetails(child.ChildId, child.OptionalSampadDetail,
                                                       child.OptionalDetailsSampadImages);
            }

            if (child.OptionalDetailsUniversityImages != null)
            {
                child.OptionalUniversityDetails = new OptionalDetails()
                {
                    DetailTitleId = 2,
                    ChildId       = child.ChildId
                };

                await _userServices.AddOptionalDetails(child.ChildId, child.OptionalUniversityDetails,
                                                       child.OptionalDetailsUniversityImages);
            }

            return(Redirect("/Userpanel"));
        }
Beispiel #12
0
        public IActionResult SetBirthday(string date)
        {
            DateTime newDate = DateConvertor.ToMiladi(date);

            _settingServices.SetBirthDayLimitation(newDate);
            ViewData["Time"] = _settingServices.GetBirthDayLimitation().ToShamsi();
            return(View());
        }
Beispiel #13
0
 private void InitializeClass(NepaliDate fromNepaliDate, NepaliDate toNepaliDate, int fiscalYearID)
 {
     _fromNepaliDate = fromNepaliDate;
     _toNepaliDate   = toNepaliDate;
     _fiscalYearID   = fiscalYearID;
     //now convert the Nepali Date to english date
     _fromEnglishDate = DateConvertor.GetEnglishDate(_fromNepaliDate.ToString());
     _toEnglishDate   = DateConvertor.GetEnglishDate(_toNepaliDate.ToString());
 }
Beispiel #14
0
        private async void picState_Click(object sender, EventArgs e)
        {
            try
            {
                var allcit = await StateBussiness.GetAllAsync();

                if (allcit.Count > 0)
                {
                    if (FarsiMessegeBox.Show(
                            "استان ها پیش از این مقداردهی شده اند در صورت ادامه باید تمامی تنظیمات سیمکارت ها و آگهی ها دوباره انجام دهید. آیا ادامه میدهید؟.",
                            "هشدار", FMessegeBoxButtons.YesNo, FMessegeBoxIcons.Information) == DialogResult.No)
                    {
                        return;
                    }
                }
                var path = Path.Combine(Application.StartupPath, "State.txt");
                if (!File.Exists(path))
                {
                    FarsiMessegeBox.Show(
                        $"مسیر فایل نامعتبر می باشد. لطفا فایل متنی لیست استان ها را در مسیر زیر قرار دهید" + "\r\n" +
                        path);
                    return;
                }

                var list = File.ReadAllLines(path);

                var all = await StateBussiness.GetAllAsync();

                if (all.Count > 0)
                {
                    if (!StateBussiness.RemoveAll(all))
                    {
                        return;
                    }
                }

                foreach (var item in list)
                {
                    var stat = new StateBussiness
                    {
                        Guid     = Guid.NewGuid(),
                        Name     = item,
                        DateSabt = DateConvertor.M2SH(DateTime.Now),
                        Status   = true
                    };
                    await stat.SaveAsync();
                }

                WebErrorLog.ErrorInstence.StartErrorLog($"تعداد {list.Count()} استان بروزرسانی شد", true);
            }
            catch (Exception exception)
            {
                WebErrorLog.ErrorInstence.StartErrorLog(exception);
            }
        }
Beispiel #15
0
        private static NaqzBussines SetNaqz(string message)
        {
            var naqz = new NaqzBussines
            {
                Guid     = Guid.NewGuid(),
                Message  = message,
                DateSabt = DateConvertor.M2SH(DateTime.Now),
                Status   = true,
            };

            return(naqz);
        }
Beispiel #16
0
        private async void btnFinish_Click(object sender, EventArgs e)
        {
            try
            {
                if (cls.Guid == Guid.Empty)
                {
                    cls.Guid     = Guid.NewGuid();
                    cls.DateSabt = DateConvertor.M2SH(DateTime.Now);
                }
                if (string.IsNullOrEmpty(txtName.Text))
                {
                    WebErrorLog.ErrorInstence.StartErrorLog("عنوان پنل نمی تواند خالی باشد", false);
                    txtName.Focus();
                    return;
                }
                if (string.IsNullOrEmpty(txtAPI.Text))
                {
                    WebErrorLog.ErrorInstence.StartErrorLog("api پنل نمی تواند خالی باشد", false);
                    txtAPI.Focus();
                    return;
                }
                if (string.IsNullOrEmpty(txtUserName.Text))
                {
                    WebErrorLog.ErrorInstence.StartErrorLog("نام کاربری نمی تواند خالی باشد", false);
                    txtUserName.Focus();
                    return;
                }
                if (string.IsNullOrEmpty(txtPassword.Text))
                {
                    WebErrorLog.ErrorInstence.StartErrorLog("رمز عبور نمی تواند خالی باشد", false);
                    txtPassword.Focus();
                    return;
                }

                cls.Status   = true;
                cls.Name     = txtName.Text.Trim();
                cls.API      = txtAPI.Text.Trim();
                cls.Password = txtPassword.Text.Trim();
                cls.UserName = txtUserName.Text.Trim();
                await cls.SaveAsync();

                Clear();
                grpAccount.Enabled        = false;
                expandablePanel1.Expanded = false;
                await LoadData();
            }
            catch (Exception exception)
            {
                WebErrorLog.ErrorInstence.StartErrorLog(exception);
            }
        }
        private void BtnFinish_Click(object sender, EventArgs e)
        {
            try
            {
                btnFinish.Enabled = false;
                if (_group.Guid == Guid.Empty)
                {
                    _group.DateSabt = DateConvertor.M2SH(DateTime.Now);
                    _group.Guid     = Guid.NewGuid();
                }


                if (string.IsNullOrWhiteSpace(txtName.Text))
                {
                    var f = new frmMessage(EnumMessageFlag.ShowFlag, Color.Red, "عنوان حساب را وارد نمایید");
                    f.ShowDialog();
                    txtName.Focus();
                    return;
                }

                if (!PerssonelGroupBussines.Check_Name(txtName.Text.Trim(), _group.Guid))
                {
                    var f = new frmMessage(EnumMessageFlag.ShowFlag, Color.Red,
                                           "عنوان حساب وارد شده تکراری است");
                    f.ShowDialog();
                    txtName.Focus();
                    return;
                }
                _group.Description = txtDescription.Text;
                _group.Name        = txtName.Text;
                _group.Status      = true;

                if (_group.Save())
                {
                    frmMessage f = new frmMessage(EnumMessageFlag.ShowFlag, Color.Green, "عملیات با موفقیت انجام شد");
                    f.ShowDialog();
                    this.DialogResult = DialogResult.OK;
                    this.Close();
                }
            }
            catch (Exception exception)
            {
                frmMessage frm = new frmMessage(EnumMessageFlag.ShowFlag, Color.Red, exception.Message);
                frm.ShowDialog();
            }
            finally
            {
                btnFinish.Enabled = true;
            }
        }
Beispiel #18
0
        public static bool CompareListCreateTimeWithTimeNow()
        {
            //int i = DateTime.Compare(t1, t2);
            //if t1 is less than t2 then result is Less than zero
            //if t1 equals t2 then result is Zero
            //if t1 is greater than t2 then result isGreater zero

            int cmp = DateTime.Compare(DateConvertor.TimeNowFull(), Convert.ToDateTime(RetListCreateTime().AddMinutes(1)));

            if (cmp > 0)
            {
                return(true);
            }
            return(false);
        }
Beispiel #19
0
 private async void btnState_Click(object sender, EventArgs e)
 {
     var path = Path.Combine(Application.StartupPath, "State.txt");
     var list = File.ReadAllLines(path);
     foreach (var item in list)
     {
         var stat = new StateBussiness
         {
             Guid = Guid.NewGuid(),
             Name = item,
             DateSabt = DateConvertor.M2SH(DateTime.Now),
             Status = true
         };
         await stat.SaveAsync();
     }
 }
Beispiel #20
0
        private async void btnFinish_Click(object sender, EventArgs e)
        {
            try
            {
                btnFinish.Enabled = false;
                if (cls.Guid == Guid.Empty)
                {
                    cls.Guid     = Guid.NewGuid();
                    cls.DateSabt = DateConvertor.M2SH(DateTime.Now);
                }

                if (string.IsNullOrWhiteSpace(txtServer.Text))
                {
                    WebErrorLog.ErrorInstence.StartErrorLog("لطفا نام سرور را وارد نمایید", false);
                    txtServer.Focus();
                    return;
                }

                if (string.IsNullOrWhiteSpace(txtPort.Text))
                {
                    WebErrorLog.ErrorInstence.StartErrorLog("لطفا شماره پورت را وارد نمایید", false);
                    txtPort.Focus();
                    return;
                }

                cls.Password = txtPassword.Text;
                cls.Port     = txtPort.Text.ParseToInt();
                cls.Secret   = txtSecret.Text;
                cls.UserName = txtUserName.Text;
                cls.Server   = txtServer.Text;
                cls.Type     = rbtnMtproto.Checked ? ProxyType.MtProto : ProxyType.Socks5;
                cls.Status   = true;

                await cls.SaveAsync();

                cls = new ProxyBussines();
            }
            catch (Exception exception)
            {
                WebErrorLog.ErrorInstence.StartErrorLog(exception);
            }
            finally
            {
                btnFinish.Enabled = true;
                await Set_Data();
            }
        }
Beispiel #21
0
        void Filter()
        {
            using (UnitOfWork db = new UnitOfWork())
            {
                List <DateLayer.Acconting> resualt = new List <DateLayer.Acconting>();
                DateTime?startTime;
                DateTime?EndTime;

                if (txtfromDate.Text != "    /  /")
                {
                    startTime = Convert.ToDateTime(txtfromDate.Text);
                    startTime = DateConvertor.Tomiladi(startTime.Value);
                    resualt   = resualt.Where(r => r.DateTime >= startTime.Value).ToList();
                }
                if (txttoDate.Text != "    /  /")
                {
                    EndTime = Convert.ToDateTime(txttoDate.Text);
                    EndTime = DateConvertor.Tomiladi(EndTime.Value);
                    resualt = resualt.Where(r => r.DateTime <= EndTime.Value).ToList();
                }



                if ((int)cbCustomer.SelectedValue != 0)
                {
                    int CustomerId = int.Parse(cbCustomer.SelectedValue.ToString());
                    resualt.AddRange(db.AccontingRepository.Get(a => a.TypeID == TypeID && a.CustomerID == CustomerId));
                }
                else
                {
                    resualt.AddRange(db.AccontingRepository.Get());
                }



                //var resualt = db.AccontingRepository.Get(a => a.TypeID == TypeID);
                // dgvReport.AutoGenerateColumns = false;
                //dgvReport.DataSource = resualt;
                dgvReport.Rows.Clear();
                foreach (var acconting in resualt)
                {
                    string CustomerName = db.customerRepository.GetCustomerNameByID(acconting.CustomerID);
                    dgvReport.Rows.Add(acconting.ID, CustomerName, acconting.Amount, acconting.DateTime.Toshamsi(), acconting.Description);
                }
            }
        }
        public void WriteToCsv(List <Employee> employeeList)
        {
            string        databasePath = ConfigurationManager.AppSettings["CsvDatabasePath"];
            StreamWriter  sw           = new StreamWriter(databasePath, false);
            StringBuilder sb           = new StringBuilder();

            foreach (var employee in employeeList)
            {
                string stringDOB       = DateConvertor.DateObjectToString(employee.DOB);
                string stringStartDate = DateConvertor.DateObjectToString(employee.StartDate);
                string employeeDetails = $"{employee.EmployeeId},{employee.FirstName},{employee.LastName},{stringDOB},{stringStartDate},{employee.HomeTown},{employee.Department}\n";
                sb.Append(employeeDetails);
            }
            sw.WriteLine(sb);
            sw.Close();
            return;
        }
Beispiel #23
0
 private async void btnInsSim_Click(object sender, EventArgs e)
 {
     var a = new SimcardBussines
     {
         Guid = Guid.NewGuid(),
         OwnerName = txtOwner.Text,
         DateSabt = DateConvertor.M2SH(DateTime.Now),
         Status = true,
         Number = long.Parse(txtNumber.Text),
         //NextUseDivar = DateTime.Now,
         //NextUseSheypoor = DateTime.Now,
         //NextUseDivarChat = DateTime.Now,
         Operator = txtOperator.Text,
         UserName = txtUserName.Text
     };
     await a.SaveAsync();
 }
Beispiel #24
0
        public async Task <ActionResult> Contact_US(string Name, string Phone, string Email, string Message, string CaptchaText)
        {
            if (CaptchaText.ToLower() == HttpContext.Session["captchastring"].ToString().ToLower())
            {
                Session.Remove("captchastring");
                var _objEntityMessage = new RepositoryPattern <Comment>(new ApplicationDbContext());
                var NewItem           = new Comment
                {
                    FullName    = Name,
                    PhoneNumber = Phone,
                    Email       = Email,
                    CommentUser = Message,
                    SendDate    = DateConvertor.DateToNumber(DateConvertor.TodayDate()),
                    SendTime    = DateConvertor.TimeNow(),
                    Is_Read     = "0"
                };
                _objEntityMessage.Insert(NewItem);
                _objEntityMessage.Save();
                _objEntityMessage.Dispose();

                try
                {
                    OpratingClasses.EmailService emailService = new OpratingClasses.EmailService();
                    var strSubject = " نام و نام خانوادگی : " + NewItem.FullName;
                    var strMessage =
                        " ارتباط با مديريت وب سايت" +
                        "  <br />  " + NewItem.CommentUser +
                        "  <br />  " + " ایمیل : " + NewItem.Email +
                        "  <br />  " + " شماره همراه : " + NewItem.PhoneNumber +
                        "  <br />  " + " تاریخ و ساعت ارسال : " + NewItem.SendDate + " - " + NewItem.SendTime;

                    await emailService.SendMail(strSubject, strMessage);
                }
                catch (Exception)
                {
                }

                return(Json("OK"));
            }
            else
            {
                return(Json("CaptchaTextMistake"));
                //ViewBag.Message = "CAPTCHA verification failed!";
            }
        }
Beispiel #25
0
 public ActionResult ReturnCom([Bind(Include = "id,ComputerID,UserID,ComputerName,DeliveryDate,ReturnDate")] Deliver deliver)
 {
     if (ModelState.IsValid && deliver.DeliveryDate < deliver.ReturnDate)
     {
         deliver.ReturnDate      = deliver.ReturnDate == null ? deliver.ReturnDate : DateConvertor.ToMiladi((DateTime)deliver.ReturnDate);
         deliver.DeliveryDate    = DateConvertor.ToMiladi((DateTime)deliver.DeliveryDate);
         db.Entry(deliver).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     if (deliver.DeliveryDate >= deliver.ReturnDate)
     {
         ViewBag.error = true;
     }
     ViewBag.ComputerID = new SelectList(db.Computer, "Computer_ID", "Computer_ID", deliver.ComputerID);
     ViewBag.UserID     = new SelectList(db.User, "userID", "UserName", deliver.UserID);
     return(View(deliver));
 }
        public ActionResult Edit([Bind(Include = "ID,dateOfService,Computer_ID,SoftwareID,Action,DisablementID,ICTUser,PeriodicVisitsID,TypeOfServices")] service service)
        {
            if (ModelState.IsValid)
            {
                service.dateOfService   = DateConvertor.ToMiladi(service.dateOfService);
                db.Entry(service).State = EntityState.Modified;
                db.SaveChanges();
                return(RedirectToAction("Index", new { comid = service.Computer_ID }));
            }
            ViewBag.Action           = new SelectList(db.Action, "ActionID", "Title", service.Action);
            ViewBag.Computer_ID      = new SelectList(db.Computer, "Computer_ID", "Computer_ID", service.Computer_ID);
            ViewBag.DisablementID    = new SelectList(db.Disablement, "ID", "ComputerID", service.DisablementID);
            ViewBag.PeriodicVisitsID = new SelectList(db.PeriodicVisits, "ID", "Title", service.PeriodicVisitsID);
            ViewBag.SoftwareID       = new SelectList(db.Software, "ID", "Name", service.SoftwareID);
            ViewBag.TypeOfServices   = new SelectList(db.TypeOFService, "ID", "Title", service.TypeOfServices);

            return(View(service));
        }
 public int GetAllAdvInDayFromIP(string ip)
 {
     try
     {
         using (var contex = new dbContext())
         {
             var date = DateConvertor.M2SH(DateTime.Now);
             var acc  = contex.AdvertiseLog.AsNoTracking().Count(q =>
                                                                 q.IP == ip && q.DateSabt == date);
             return(acc);
         }
     }
     catch (Exception exception)
     {
         WebErrorLog.ErrorInstence.StartErrorLog(exception);
         return(0);
     }
 }
 private async void btnBackUp_Click(object sender, EventArgs e)
 {
     try
     {
         var date = DateConvertor.M2SH(DateTime.Now);
         date     = date.Replace("/", "_") + "_" + DateTime.Now.Hour + "_" + DateTime.Now.Minute + ".bak";
         FilePath = Path.Combine(cls.BackUpAddress, date);
         FileName = date;
         if (await Utility.CreateBackUp("Ads", date, cls))
         {
             WebErrorLog.ErrorInstence.StartErrorLog("پشتیبان گیری با موفقیت انجام شد", true);
         }
     }
     catch (Exception exception)
     {
         WebErrorLog.ErrorInstence.StartErrorLog(exception);
     }
 }
Beispiel #29
0
 private async void btnIns_DivarSimCity_Click(object sender, EventArgs e)
 {
     for (int i = 0; i < dgDivarSimCity.RowCount; i++)
     {
         if ((bool)dgDivarSimCity[dg_Is_Checked.Index, i].Value)
         {
             var a = new DivarSimCityBussines()
             {
                 Guid = Guid.NewGuid(),
                 DateSabt = DateConvertor.M2SH(DateTime.Now),
                 Status = true,
                 SimcardGuid = (Guid)cmbSim2.SelectedValue,
                 CityGuid = (Guid)dgDivarSimCity[dg_Guid.Index, i].Value
             };
             await a.SaveAsync();
         }
     }
 }
Beispiel #30
0
        private async void btnInsSimcardAds_Click(object sender, EventArgs e)
        {
            for (int i = 0; i < dgSimcardAds.RowCount; i++)
            {
                if ((bool)dgSimcardAds[dg_isChecked.Index, i].Value)
                {
                    var a = new SimcardAdsBussines()
                    {
                        Guid = Guid.NewGuid(),
                        DateSabt = DateConvertor.M2SH(DateTime.Now),
                        Status = true,
                        SimcardGuid = (Guid)cmbSimcard.SelectedValue,
                       // Advertise = dgSimcardAds[dg_AdvName.Index, i].Value.ToString()
                    };
                    await a.SaveAsync();
                }
            }

        }