예제 #1
0
        public bool SendSMS(int CaseNo, Employee Emp)
        {
            SendSMS send_sms = new SendSMS();

            string MessageTextEn = string.Empty;
            string MessageTextAr = string.Empty;

            try
            {
                switch (CaseNo)
                {
                case 1:    // CreateNewAcount
                    MessageTextEn = "Create Account for user" + Emp.Employee_Name_Ar + "\n The password is" + Emp.Employee_Password;
                    MessageTextAr = "Create Account for user" + Emp.Employee_Name_Ar;
                    send_sms.SendMessage(MessageTextAr + "\n" + MessageTextEn, Emp.Employee_Phone);
                    break;

                case 2:    // ResetPassword
                    MessageTextEn = "";
                    MessageTextAr = "";
                    send_sms.SendMessage(MessageTextAr + "\n" + MessageTextEn, Emp.Employee_Phone);
                    break;

                case 3:    // NewTreatment
                    MessageTextEn = "";
                    MessageTextAr = "";
                    send_sms.SendMessage(MessageTextAr + "\n" + MessageTextEn, Emp.Employee_Phone);
                    break;

                case 4:    // Meeting
                    MessageTextEn = "";
                    MessageTextAr = "";
                    send_sms.SendMessage(MessageTextAr + "\n" + MessageTextEn, Emp.Employee_Phone);
                    break;

                case 5:    // vote
                    MessageTextEn = "";
                    MessageTextAr = "";
                    send_sms.SendMessage(MessageTextAr + "\n" + MessageTextEn, Emp.Employee_Phone);
                    break;

                default:     // code block

                    break;
                }
            }
            catch
            {
                return(false);
            }
            return(true);
        }
예제 #2
0
        private void ReadyToPay(Student std)
        {
            string         amount = string.Empty, Payment_For = string.Empty;
            int            payment_type_id = 1;
            Specialization spec            = db.Specializations.Find(std.Student_Specialization_Id);

            if (std.Student_Status_Id == 6)
            {
                amount          = spec.Specialization_Registeration_Payment.ToString();
                Payment_For     = "Registration";
                payment_type_id = 1;
            }
            else
            {
                amount          = spec.Specialization_Study_Payment.ToString();
                Payment_For     = "Study";
                payment_type_id = 2;
            }

            int    student_id  = std.Student_Id;
            string entityId    = "";
            string currency    = "SAR";
            string paymentType = "DB";

            Payment_Process payment = db.Payment_Process.Create();

            payment.Student_Id          = student_id;
            payment.Send_Amount         = float.Parse(amount);
            payment.Send_Currency       = currency;
            payment.Send_EntityId       = entityId;
            payment.Send_PaymentType    = paymentType;
            payment.Payment_IsPaid      = false;
            payment.Payment_Type_Id     = payment_type_id;
            payment.DateCreation        = DateTime.Now;
            payment.Comment             = Payment_For + " Fees";
            payment.Payment_Trackingkey = StringCipher.RandomString(5) + student_id + StringCipher.RandomString(3) + DateTime.Now.GetHashCode() + StringCipher.RandomString(5);
            payment.Payment_URL_IsValid = true;
            db.Payment_Process.Add(payment);
            db.SaveChanges();

            //Send Email
            send_ReadyToPay(std, payment, Payment_For);

            // Send SMS
            SendSMS send_sms   = new SendSMS();
            string  sever_name = Request.Url.Authority.ToString();
            string  URL        = sever_name + "/Payment/PaymentProcessDetails.aspx?Trackingkey=" + payment.Payment_Trackingkey;

            if (URL.Substring(0, 4).ToLower() != "http".ToLower())
            {
                URL = "http://" + URL;
            }

            string Text          = "Dear " + std.Student_Name_En + "\nNow you can pay the fees of " + Payment_For + "\nPlease use this link: " + URL;
            string number_Phone  = std.Student_Phone;
            string reslt_message = send_sms.SendMessage(Text, number_Phone);
        }
예제 #3
0
        private bool rest_account(string email)
        {
            email = email.Trim().ToLower();
            db.Configuration.LazyLoadingEnabled = false;
            Employee emp = db.Employees.Where(x => x.Employee_Email.ToLower() == email).FirstOrDefault();

            if (emp != null)
            {
                string New_Password       = StringCipher.RandomString(7);
                string Encrypted_Password = StringCipher.Encrypt(New_Password, "Password"); // emp.Employee_Password.ToString();
                emp.Employee_Password = Encrypted_Password;
                db.Entry(emp).State   = System.Data.EntityState.Modified;
                db.SaveChanges();

                string sever_name = Request.Url.Authority.ToString();
                // Send SMS
                SendSMS send_sms      = new SendSMS();
                string  url           = "http://registration.riyadh.edu.sa/Pages/Auth/Login.aspx";
                string  Text          = "Reset Password\n\nEmail:" + emp.Employee_Email + "\n\nPassword:"******"\n\nURL:" + url;
                string  number_Phone  = emp.Employee_Phone;
                string  reslt_message = send_sms.SendMessage(Text, number_Phone);

                SendEmail send   = new SendEmail();
                bool      result = send.ResetEmail(emp.Employee_Email, New_Password, sever_name, "Reset Password");
                if (result)
                {
                    Page.ClientScript.RegisterStartupScript(this.GetType(), "CallMyFunction", "show_model_sucess();", true);
                    txtEmail.Text = "";

                    /* Add it to log file */

                    LogData = "data:" + JsonConvert.SerializeObject(emp, logFileModule.settings);
                    logFileModule.logfile(10, "إعادة تعين كلمة السر", "reset your password", LogData);

                    return(true);
                }
                else
                {
                    Page.ClientScript.RegisterStartupScript(this.GetType(), "CallMyFunction", "show_model_error();", true);
                    return(false);
                }
            }
            else
            {
                Page.ClientScript.RegisterStartupScript(this.GetType(), "CallMyFunction", " show_model_notfound();", true);
                return(false);
            }
        }
        public async Task <JsonResult> SubmitQuote(int Id, string QuotationText)
        {
            try
            {
                QuotationText = QuotationText.Replace("\r", string.Empty);

                using (AppDBContext context = new AppDBContext())
                {
                    enquiryForAdminDetail = new ServiceRequestRepository(context).GetAllForSendQuote(Id, null, null, null, true);
                }

                EnquiryForAdminDetail model = enquiryForAdminDetail.Where(x => x.Id == Id).FirstOrDefault();

                await SendSMS.SendMessage(model.UserPhoneNumber, QuotationText);

                return(Json(new { s = "Success" }));
            }
            catch (Exception)
            {
                return(Json(new { s = "Failed" }));
            }
        }
예제 #5
0
        public bool AU_Emplooyees(int EmployeeID, string ArabicName, string EnglishName, string Email, string Phone, bool Active, int GroupID, int lang)
        {
            try
            {
                db.Configuration.LazyLoadingEnabled = false;
                Employee Emp = db.Employees.Create();
                if (EmployeeID != 0)
                {
                    Emp = db.Employees.First(x => x.Employee_Id == EmployeeID);
                }
                Emp.Employee_Name_Ar = ArabicName;
                Emp.Employee_Name_En = EnglishName;
                Emp.Employee_Email   = Email;
                if (EmployeeID == 0)
                {
                    string New_Password = StringCipher.RandomString(7);
                    Encrypted_Password    = StringCipher.Encrypt(New_Password, "Password"); // emp.Employee_Password.ToString();
                    Emp.Employee_Password = Encrypted_Password;

                    /* if (EmailResult)
                     * {
                     *   Page.ClientScript.RegisterStartupScript(this.GetType(), "CallMyFunction", "show_model_sucess();", true);
                     * }*/

                    //Send Email
                    string    Text       = "";
                    string    sever_name = Request.Url.Authority.ToString();
                    string    StuEmail   = Email;
                    SendEmail send       = new SendEmail();
                    Text = " <Strong style='font-size:16px;'>Dear " + EnglishName + "</Strong><br /><br /> " + "Now you can access the online admission system through the link: http://registration.riyadh.edu.sa" + "<br /><br />" + "User Name :" + Email + " <br />" + "Password :"******"<br /><br />" + "Best Regard," + " <br />" + "Admission System" + " <br />";
                    bool R = send.TextEmail("Riyadh Elm University", StuEmail, Text, sever_name);

                    // Send SMS
                    SendSMS send_sms      = new SendSMS();
                    string  smsText       = "Dear " + EnglishName + "\n" + "Now you can access the online admission system through the link: http://registration.riyadh.edu.sa" + "\n\n" + "User Name : " + Email + "\n" + "Password : "******" \n\n" + "Best Regard," + " \n" + "Admission System";
                    string  number_Phone  = Phone;
                    string  reslt_message = send_sms.SendMessage(smsText, number_Phone);
                }
                Emp.Employee_Phone  = Phone;
                Emp.Employee_Active = Active;
                Emp.Group_Id        = GroupID;
                Emp.Language_id     = lang;
                //Emp.Calendar_id = calander;
                string ImagepathProfile   = UploadFile(1);
                string ImagepathSignature = UploadFile(2);
                if (ImagepathProfile != "")
                {
                    Emp.Employee_Profile = ImagepathProfile;
                }
                else if (EmployeeID == 0)
                {
                    Emp.Employee_Profile = "Profile.JPG";
                }
                if (EmployeeID != 0)
                {
                    db.Entry(Emp).State = System.Data.EntityState.Modified;
                }
                else
                {
                    db.Employees.Add(Emp);
                }
                db.SaveChanges();
                /* Add it to log file */
                LogData = "data:" + JsonConvert.SerializeObject(Emp, logFileModule.settings);
                if (EmployeeID != 0)
                {
                    logFileModule.logfile(10, "تعديل بيانات موظف", "update Employee", LogData);
                }
                else
                {
                    logFileModule.logfile(10, "إضافة موظف", "Add Employee", LogData);
                }
            }
            catch { return(false); }
            return(true);
        }
        public async System.Threading.Tasks.Task <bool> confirm_To_Payment()
        {
            string Entity_ID = "";
            bool   Response  = false;

            try
            {
                /*  Start Prepare the checkout  */
                Payment_Process checkout_payment = db.Payment_Process.Where(x => x.Payment_Trackingkey == Trackingkey && x.Payment_URL_IsValid == true && x.Payment_IsPaid == false).FirstOrDefault();
                if (checkout_payment != null)
                {
                    if (PaymentType.SelectedValue == "1" || PaymentType.SelectedValue == "2")
                    {
                        Entity_ID = "8acda4ce72e5a3df0172fb754c3c488c";
                    }
                    else if (PaymentType.SelectedValue == "3")
                    {
                        Entity_ID = "8acda4ce72e5a3df0172fb75d45d4891";
                    }

                    if (PaymentType.SelectedValue != "4")
                    {
                        string paymentBrand = "VISA";
                        if (PaymentType.SelectedValue == "1")
                        {
                            paymentBrand = "VISA";
                        }
                        else if (PaymentType.SelectedValue == "2")
                        {
                            paymentBrand = "MASTER";
                        }
                        else if (PaymentType.SelectedValue == "3")
                        {
                            paymentBrand = "MADA";
                        }

                        VISA_MADA NewVM = db.VISA_MADA.Create();
                        NewVM.UUID = UUID;
                        NewVM.PaymentProcess_Id = checkout_payment.Payment_Id;
                        NewVM.Trackingkey       = checkout_payment.Payment_Trackingkey;
                        NewVM.Result_JSON       = string.Empty;
                        NewVM.DateCreation      = DateTime.Now;
                        db.VISA_MADA.Add(NewVM);
                        db.SaveChanges();

                        Dictionary <string, dynamic> responseData =
                            Prepare_Check_Payment_Request(UUID, paymentBrand, Entity_ID, checkout_payment.Send_Amount.ToString(), checkout_payment.Send_Currency, checkout_payment.Send_PaymentType, StudentName.Text, Studentsurname.Text, StudentEmail.Text, StudentCountry.SelectedValue, StudentState.Text, StudentCity.Text, StudentAddress.Text, StudentPostcode.Text);
                        if (responseData["result"]["code"] == "000.200.100")
                        {
                            checkout_payment.Result_Code        = responseData["result"]["code"];
                            checkout_payment.Result_Description = responseData["result"]["description"];
                            checkout_payment.Result_BuildNumber = responseData["buildNumber"];
                            checkout_payment.Result_Timestamp   = responseData["timestamp"];
                            checkout_payment.Result_Ndc         = responseData["ndc"];
                            checkout_payment.Result_Id          = responseData["id"];
                            checkout_payment.Send_EntityId      = Entity_ID;
                            db.Entry(checkout_payment);
                            db.SaveChanges();


                            Response = true;
                        }
                        else
                        {
                            Response = false;
                            //return false;
                        }
                        // Save Result in all cases
                        VISA_MADA VM_UpdateResult = db.VISA_MADA.Where(x => x.UUID == UUID).FirstOrDefault();
                        if (VM_UpdateResult != null)
                        {
                            VM_UpdateResult.Result_JSON     = JsonConvert.SerializeObject(responseData);
                            db.Entry(VM_UpdateResult).State = System.Data.EntityState.Modified;
                            db.SaveChanges();
                        }
                    }
                    else
                    {
                        int studentID = 0;
                        int.TryParse(checkout_payment.Student_Id.ToString(), out studentID);
                        string PayeeId = StringCipher.RandomString(10);

                        string Gender = StudentGender.SelectedValue;

                        Dictionary <string, dynamic> responseData = await Prepare_Check_Payment_Request_SADAD(checkout_payment.Payment_Id, PayeeId, UUID, checkout_payment.Send_Amount.ToString(), checkout_payment.Student.Student_SSN, checkout_payment.Send_PaymentType, StudentFirstName.Text, StudentLastName.Text, studentID, Gender);

                        if (responseData["Status"]["Code"] == 0)
                        {
                            checkout_payment.Result_Code        = (responseData["Status"]["Code"]).ToString();
                            checkout_payment.Result_Description = responseData["Status"]["Description"];
                            checkout_payment.Result_BuildNumber = responseData["SADADNumber"];
                            checkout_payment.Result_Timestamp   = responseData["Status"]["Severity"];
                            checkout_payment.Result_Ndc         = responseData["InvoiceId"];
                            db.Entry(checkout_payment).State    = System.Data.EntityState.Modified;
                            db.SaveChanges();

                            string        InvoiceId = responseData["InvoiceId"];
                            Rosom_Request Rosom     = db.Rosom_Request.FirstOrDefault(x => x.Trackingkey == Trackingkey && x.InvoiceId == InvoiceId);
                            Rosom.Response_Status_Code = (responseData["Status"]["Code"]).ToString();
                            // Rosom. = responseData["result"]["description"];
                            Rosom.Response_SADADNumber = responseData["SADADNumber"];
                            Rosom.Result_JSON          = JsonConvert.SerializeObject(responseData);
                            db.Entry(Rosom).State      = System.Data.EntityState.Modified;;
                            db.SaveChanges();

                            SADAD_Number = responseData["SADADNumber"];

                            string Text       = "";
                            string sever_name = Request.Url.Authority.ToString();
                            string StuEmail   = checkout_payment.Student.Student_Email;

                            SendEmail send = new SendEmail();
                            Text = " <Strong style='font-size:16px;'> Dear " + checkout_payment.Student.Student_Name_En + "</Strong><br /><br /> " + "The invoice number of SADAD is:<Strong>" + SADAD_Number + "</Strong>.<br />The total amount: <Strong>" + checkout_payment.Send_Amount + "</Strong> SAR.<br /><br />Please complete the payment before 48 hours." + " <br /> <br />" + "Best Regard," + " <br />";
                            bool R = send.TextEmail("Riyadh Elm University", StuEmail, Text, sever_name);

                            // Send SMS
                            SendSMS send_sms      = new SendSMS();
                            string  smsText       = "Dear " + checkout_payment.Student.Student_Name_En + "\n\n" + "The invoice number of SADAD is:" + SADAD_Number + ".\n\nThe total amount: " + checkout_payment.Send_Amount + " SAR.\n\nPlease complete the payment before 48 hours." + " \n\n" + "Best Regard";
                            string  number_Phone  = checkout_payment.Student.Student_Phone;
                            string  reslt_message = send_sms.SendMessage(smsText, number_Phone);

                            Response = true;
                        }
                        else
                        {
                            Response = false;
                            //return false;
                        }
                    }
                }
                else
                {
                    Response = false;
                    //return Response;
                }
            }
            catch (Exception er)
            {
                db.Configuration.LazyLoadingEnabled = false;
                /* Add it to log file */
                LogData = "data:" + JsonConvert.SerializeObject(er, logFileModule.settings);
                logFileModule.logfile(10, "خطأ جديد للدفع", "New Exception in Payment", LogData);
                return(false);
            }

            return(Response);
            /* End Prepare the checkout */
        }
예제 #7
0
        public bool confirm_To_Payment()
        {
            string Entity_ID = "";
            bool   Response  = false;

            try
            {
                /*  Start Prepare the checkout  */
                Payment_Process checkout_payment = db.Payment_Process.Where(x => x.Payment_Trackingkey == Trackingkey && x.Payment_URL_IsValid == true && x.Payment_IsPaid == false).FirstOrDefault();
                if (checkout_payment != null)
                {
                    if (PaymentType.SelectedValue == "1" || PaymentType.SelectedValue == "2")
                    {
                        Entity_ID = "8ac7a4c87284f6c901728e6183ff150e";
                    }
                    else if (PaymentType.SelectedValue == "3")
                    {
                        Entity_ID = "8ac7a4c87284f6c901728e633a371512";
                    }

                    if (PaymentType.SelectedValue != "4")
                    {
                        Dictionary <string, dynamic> responseData =
                            Prepare_Check_Payment_Request(Entity_ID, checkout_payment.Send_Amount.ToString(), checkout_payment.Send_Currency, checkout_payment.Send_PaymentType, StudentName.Text, Studentsurname.Text, StudentEmail.Text, StudentCountry.SelectedValue, StudentState.Text, StudentCity.Text, StudentAddress.Text, StudentPostcode.Text);
                        if (responseData["result"]["code"] == "000.200.100")
                        {
                            string        InvoiceId = responseData["InvoiceId"];
                            Rosom_Request Rosom     = db.Rosom_Request.FirstOrDefault(x => x.Trackingkey == Trackingkey && x.InvoiceId == InvoiceId);
                            Rosom.Response_Status_Code = responseData["result"]["code"];
                            // Rosom. = responseData["result"]["description"];
                            Rosom.Response_SADADNumber = responseData["SADADNumber"];
                            Rosom.Result_JSON          = responseData.ToString();
                            db.Entry(Rosom).State      = System.Data.Entity.EntityState.Modified;;
                            db.SaveChanges();

                            SADAD_Number = responseData["SADADNumber"];

                            string Text       = "";
                            string sever_name = Request.Url.Authority.ToString();
                            string StuEmail   = checkout_payment.Student.Student_Email;

                            SendEmail send = new SendEmail();
                            Text = " <Strong style='font-size:16px;'> Dear " + checkout_payment.Student.Student_Name_En + "</Strong><br /><br /> " + "Thank you for completed the application from at Riyadh Elm University. We will contact you within 48 hours." + " <br /> <br />" + "Best Regard," + " <br />" + "Admission System" + " <br /> ";
                            bool R = send.TextEmail("Riyadh Elm University", StuEmail, Text, sever_name);

                            // Send SMS
                            SendSMS send_sms      = new SendSMS();
                            string  smsText       = "Dear " + checkout_payment.Student.Student_Name_En + "\n" + "Thank you for completed the application form at Riyadh Elm University. We will contact you within 48 hours." + " \n" + "Best Regard," + " \n" + "Admission System";
                            string  number_Phone  = checkout_payment.Student.Student_Phone;
                            string  reslt_message = send_sms.SendMessage(smsText, number_Phone);

                            Response = true;
                        }
                        else
                        {
                            Response = false;
                            //return false;
                        }
                    }
                    else
                    {
                        int studentID = 0;
                        int.TryParse(checkout_payment.Student_Id.ToString(), out studentID);
                        Dictionary <string, dynamic> responseData =
                            Prepare_Check_Payment_Request_SADAD(UUID, checkout_payment.Send_Amount.ToString(), checkout_payment.Student.Student_SSN, checkout_payment.Send_PaymentType, StudentFirstName.Text, StudentLastName.Text, studentID);
                        if (responseData["Status"]["Code"] == 0)
                        {
                            checkout_payment.Result_Code        = responseData["InvoiceId"];
                            checkout_payment.Result_Description = responseData["SADADNumber"];
                            checkout_payment.Result_BuildNumber = responseData["Status"]["Code"];
                            checkout_payment.Result_Timestamp   = responseData["Status"]["Description"];
                            checkout_payment.Result_Ndc         = responseData["Status"]["Severity"];
                            db.Entry(checkout_payment).State    = System.Data.Entity.EntityState.Modified;
                            db.SaveChanges();
                            Response = true;
                        }
                        else
                        {
                            Response = false;
                            //return false;
                        }
                    }
                }
                else
                {
                    Response = false;
                    //return Response;
                }
            }
            catch (Exception er)
            {
                db.Configuration.LazyLoadingEnabled = false;
                /* Add it to log file */
                LogData = "data:" + JsonConvert.SerializeObject(er, logFileModule.settings);
                logFileModule.logfile(10, "خطأ جديد التجهيز للدفع", "New Exception in Checkout", LogData);
                return(false);
            }

            return(Response);
            /* End Prepare the checkout */
        }