// POST: api/Rosom
        public string Post([FromBody] Rosom_Response Rosom)
        {
            Rosom_Request rosom_resquest = db.Rosom_Request.Where(x => x.Response_SADADNumber == Rosom.SADADNumber).FirstOrDefault();

            if (rosom_resquest != null)
            {
                Rosom.Trackingkey        = rosom_resquest.Trackingkey;
                Rosom.Payment_Process_Id = rosom_resquest.Payment_Process_Id;
                Rosom.Rosom_Request_Id   = rosom_resquest.Id;
                db.Rosom_Response.Add(Rosom);
                db.SaveChanges();

                Payment_Process Pay_process = rosom_resquest.Payment_Process;
                Pay_process.Payment_IsPaid      = true;
                Pay_process.Payment_URL_IsValid = false;
                db.Entry(Pay_process).State     = System.Data.Entity.EntityState.Modified;
                db.SaveChanges();

                Student std           = Pay_process.Student;
                int     new_Status_Id = (int)std.Student_Status_Id + 1;
                std.Student_Status_Id = new_Status_Id;
                db.Entry(std).State   = System.Data.Entity.EntityState.Modified;
                db.SaveChanges();

                // isnert new Sequences record to paid
                Sequence seq = db.Sequences.Create();
                seq.Emp_Id       = 1;
                seq.Status_Id    = new_Status_Id;
                seq.Student_Id   = std.Student_Id;
                seq.Note         = "Auto payment";
                seq.DateCreation = DateTime.Now;
                db.Sequences.Add(seq);
                db.SaveChanges();


                db.Configuration.LazyLoadingEnabled = false;
                /* Add it to log file */
                Student stdLogFile = db.Students.Find(std.Student_Id);
                stdLogFile.Employee = db.Employees.Find(seq.Emp_Id);
                stdLogFile.Status   = db.Status.Find(seq.Status_Id);

                LogData = "data:" + JsonConvert.SerializeObject(stdLogFile, logFileModule.settings);
                logFileModule.logfile(10, "تغير الحالة تلقائي", "Update Status Automatic", LogData);

                Payment_Process paymentLogFile = db.Payment_Process.Find(Pay_process.Payment_Id);
                LogData = "data:" + JsonConvert.SerializeObject(paymentLogFile, logFileModule.settings);
                logFileModule.logfile(10, "اضافة عملية دفع", "add payment process", LogData);

                return("{'Status': {'Code': 0,'Description': 'Success','Severity': 'Info'}}");
            }

            return("{'Status': {'Code': 2000,'Description': 'Bill not found','Severity': 'Info'}}");
        }
Example #2
0
        private void LoadStudentInfo(Student_Concat std)
        {
            try
            {
                if (std != null)
                {
                    // select the color based on status id
                    db.Configuration.LazyLoadingEnabled = true;
                    int index = (int)std.Student_Concat_Status - 1;
                    if (index > Color.Length)
                    {
                        index = 4;
                    }

                    txtStudent_SSN.Text   = std.Student_Concat_Id.ToString();
                    txtStudent_Name.Text  = std.Student_Concat_Name;
                    txtStudent_Phone.Text = std.Student_Concat_Phone;
                    txtStudent_Email.Text = std.Student_Concat_Email;
                    txtCreationDate.Text  = std.Student_Concat_CreationDate.ToString();
                    txtMessage.Text       = std.Student_Concat_Message;

                    // Change status to pendding if it's new
                    if (std.Student_Concat_Status == 1)
                    {
                        std.Student_Concat_Status = 2;
                        db.Entry(std).State       = System.Data.Entity.EntityState.Modified;
                        db.SaveChanges();
                        index = (int)std.Student_Concat_Status - 1;
                        if (index > Color.Length)
                        {
                            index = 1;
                        }
                    }
                    else if (std.Student_Concat_Status == 14 || std.Student_Concat_Status == 15)
                    {
                        DivAction.Visible = false;
                    }

                    if (SessionWrapper.LoggedUser.Language_id == 1)
                    {
                        txtStatus.Text = "<span class='label label-warning' style='background:" + Color[index] + " !important;'>" + std.Status.Status_Name_Ar + "</span>";
                    }
                    else
                    {
                        txtStatus.Text = "<span class='label label-warning' style='background:" + Color[index] + " !important;'>" + std.Status.Status_Name_En + "</span>";
                    }

                    SessionWrapper.BoardColor = (int)std.Student_Concat_Status;
                }
            }
            catch { Response.Redirect("~/Pages/Contact/ListContact.aspx"); }
        }
        private bool AddPermission(string arabic_name, string english_name, int parent_id, string url, string icon)
        {
            try
            {
                db.Configuration.LazyLoadingEnabled = false;
                Permission Per = db.Permissions.Create();
                Per.Permission_Name_Ar = arabic_name;
                Per.Permission_Name_En = english_name;
                Per.Parent             = parent_id;
                Per.Url_Path           = url;
                Per.Permission_Icon    = icon;
                Per.System_Id          = 1;
                db.Permissions.Add(Per);
                db.SaveChanges();

                /* Add it to log file */
                LogData = "data:" + JsonConvert.SerializeObject(Per, logFileModule.settings);
                logFileModule.logfile(10, "إضافة صلاحية جديدة", "add new permission", LogData);

                Page.ClientScript.RegisterStartupScript(this.GetType(), "CallMyFunction", "HideTheModel(); notify('top', 'right', 'fa fa-check', 'success', 'animated fadeInRight', 'animated fadeOutRight','  Save Status : ','  The Permission add successfully ! ');", true);
                //PriorityDataSource.DataBind();
            }
            catch { Page.ClientScript.RegisterStartupScript(this.GetType(), "CallMyFunction", "notify('top', 'right', 'fa fa-delete', 'danger', 'animated fadeInRight', 'animated fadeOutRight','  Save Status : ','System Error');", true); return(false); }
            return(true);
        }
 public void logfile(int controlId, string logName, string logDescription, String noteData)
 {
     try
     {
         using (var dbLog = new REU_RegistrationEntities())
         {
             Log_File logFileInsert = dbLog.Log_File.Create();
             logFileInsert.Log_Date = DateTime.Now;
             if (controlId != 0)
             {
                 if (SessionWrapper.LoggedUser != null)
                 {
                     logFileInsert.Login_Id = SessionWrapper.LoggedUser.Employee_Id;
                 }
                 else
                 {
                     logFileInsert.Login_Id = 1;
                 }
                 logFileInsert.Form_Id = currentPage();
             }
             logFileInsert.Log_Name        = logName;
             logFileInsert.Log_Description = logDescription;
             logFileInsert.Log_Note        = noteData;
             dbLog.Log_File.Add(logFileInsert);
             dbLog.SaveChanges();
         }
     }
     catch (Exception er) { }
 }
        public bool DeleteFileID(int FileID, int studentID)
        {
            LogFileModule logFileModule = new LogFileModule();
            String        LogData = "";
            string        str_En = string.Empty, str_Ar = string.Empty;

            try
            {
                db.Configuration.LazyLoadingEnabled = false;
                File file = db.Files.First(x => x.File_Id == FileID);
                file.Student_Id = studentID;
                str_En          = "Delete File";
                str_Ar          = "حذف ملف";

                db.Entry(file).State = System.Data.Entity.EntityState.Deleted;
                db.SaveChanges();

                file.Student_Id = studentID;

                /* Add it to log file */
                LogData = "data:" + JsonConvert.SerializeObject(file, logFileModule.settings);
                logfile(10, str_Ar, str_En, LogData);
            }
            catch (Exception e)
            {
                return(false);
            }
            return(true);
        }
        public bool DeleteStudents(int StudentID)
        {
            LogFileModule logFileModule = new LogFileModule();
            String        LogData = "";
            string        str_En = string.Empty, str_Ar = string.Empty;

            try
            {
                db.Configuration.LazyLoadingEnabled = false;
                Student Stu = db.Students.First(x => x.Student_Id == StudentID);
                if (Stu.Suspended == null || Stu.Suspended == 0)
                {
                    Stu.Suspended = 1;
                    str_En        = "Delete Student";
                    str_Ar        = "حذف طالب";
                }
                else
                {
                    Stu.Suspended = 0;
                    str_En        = "Restore Student";
                    str_Ar        = "استعادة طالب";
                }
                db.Entry(Stu).State = System.Data.Entity.EntityState.Modified;
                db.SaveChanges();

                /* Add it to log file */
                LogData = "data:" + JsonConvert.SerializeObject(Stu, logFileModule.settings);
                logfile(10, str_Ar, str_En, LogData);
            }
            catch (Exception e)
            {
                return(false);
            }
            return(true);
        }
        public bool AU_Specialization(string SpecializationNameAr, string SpecializationNameEn, int collegeId, string SpecializationIcon, string HighSchoolPercent, string CapabilitiesPercent, string MyAchievementPercent, string WeightedRatioPercent, string SpecializationDescriptionAr, string SpecializationDescriptionEn, string Speech, string Minutes, double registerationPaymentVal, double studyPaymentVal)
        {
            try
            {
                db.Configuration.LazyLoadingEnabled = false;
                Specialization Specl = db.Specializations.Create();
                if (SpecializationId != 0)
                {
                    Specl = db.Specializations.First(x => x.Specialization_Id == SpecializationId);
                }
                Specl.Specialization_Name_Ar               = SpecializationNameAr;
                Specl.Specialization_Name_En               = SpecializationNameEn;
                Specl.Collage_Id                           = collegeId;
                Specl.Specialization_Icon                  = SpecializationIcon;
                Specl.High_School_Percent                  = HighSchoolPercent;
                Specl.Capabilities_Percent                 = CapabilitiesPercent;
                Specl.My_Achievement_Percent               = MyAchievementPercent;
                Specl.Weighted_Ratio_Percent               = WeightedRatioPercent;
                Specl.Specialization_Description_Ar        = SpecializationDescriptionAr;
                Specl.Specialization_Description_En        = SpecializationDescriptionEn;
                Specl.Condition_Ar                         = Speech;
                Specl.Condition_En                         = Minutes;
                Specl.Specialization_Registeration_Payment = registerationPaymentVal;
                Specl.Specialization_Study_Payment         = studyPaymentVal;
                string ImagepathProfile = UploadFile(1);
                if (ImagepathProfile != "")
                {
                    Specl.Specialization_Image = ImagepathProfile;
                }
                else if (SpecializationId == 0)
                {
                    ImagepathProfile = "blue-and-silver.jpg";
                }

                if (SpecializationId != 0)
                {
                    db.Entry(Specl).State = System.Data.Entity.EntityState.Modified;
                }
                else
                {
                    db.Specializations.Add(Specl);
                }
                db.SaveChanges();

                /* Add it to log file */
                LogData = "data:" + JsonConvert.SerializeObject(Specl, logFileModule.settings);
                if (SpecializationId != 0)
                {
                    logFileModule.logfile(10, "تعديل بيانات تخصص", "Update Specialization", LogData);
                }
                else
                {
                    logFileModule.logfile(10, "إضافة تخصص جديد", "Add New Specialization", LogData);
                }
                SpecializationId = Specl.Specialization_Id;
            }
            catch { return(false); }
            return(true);
        }
 private bool AddGroup(string arabic_name, string english_name)
 {
     try
     {
         db.Configuration.LazyLoadingEnabled = false;
         Group group = db.Groups.Create();
         group.Group_Name_Ar = arabic_name;
         group.Group_Name_En = english_name;
         db.Groups.Add(group);
         db.SaveChanges();
         /* Add it to log file */
         LogData = "data:" + JsonConvert.SerializeObject(group, logFileModule.settings);
         logFileModule.logfile(10, "إنشاء مجموعة جديدة", "create new group", LogData);
         //PriorityDataSource.DataBind();
     }
     catch { return(false); }
     return(true);
 }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (SessionWrapper.LoggedUser == null)
            {
                Response.Redirect("~/Pages/Auth/Login.aspx");
            }

            if (Request["Payment_Process_ID"] != null)
            {
                int.TryParse(Request["Payment_Process_ID"], out Payment_Process_ID);
                if (Payment_Process_ID != 0)
                {
                    Payment_Process payment_process = db.Payment_Process.Find(Payment_Process_ID);
                    if (payment_process != null && payment_process.Payment_IsPaid == false)
                    {
                        payment_process.Payment_IsPaid      = true;
                        payment_process.Payment_URL_IsValid = false;
                        payment_process.Result_Description  = "Manual";
                        db.Entry(payment_process).State     = System.Data.EntityState.Modified;
                        db.SaveChanges();
                        logfile(payment_process);
                        Response.Redirect("~/Payment/StudentsPaid.aspx");
                    }
                    else if (payment_process != null && payment_process.Payment_IsPaid == true)
                    {
                        payment_process.Payment_SMS_Result = "Done";
                        db.Entry(payment_process).State    = System.Data.EntityState.Modified;
                        db.SaveChanges();
                        logfile(payment_process);
                        Response.Redirect("~/Payment/StudentsPaid.aspx");
                    }
                }
            }

            if (!IsPostBack)
            {
                PaymentProcessList = db.Payment_Process.ToList();

                LoadStudent();
                //Page.ClientScript.RegisterStartupScript(this.GetType(), "CallMyFunction", "exportdata();", true);
            }
        }
        public bool AU_Emplooyees(int EmployeeID, string Email, string Phone, int lang, int calander)
        {
            bool refresh = false;

            try
            {
                db.Configuration.LazyLoadingEnabled = false;
                Employee Emp = db.Employees.First(x => x.Employee_Id == EmployeeID);
                Emp.Employee_Email = Email;
                Emp.Employee_Phone = Phone;
                if (lang != Emp.Language_id)
                {
                    refresh = true;
                }
                Emp.Language_id = lang;
                //Emp.Calendar_id = calander;
                string ImagepathProfile   = UploadFile(1);
                string ImagepathSignature = UploadFile(2);
                if (ImagepathProfile != "")
                {
                    Emp.Employee_Profile = ImagepathProfile;
                }
                db.Entry(Emp).State = System.Data.EntityState.Modified;
                db.SaveChanges();
                /* Add it to log file */
                LogData = "data:" + JsonConvert.SerializeObject(Emp, logFileModule.settings);
                logFileModule.logfile(10, "تعديل بيانات الموظف", "Update Employee Info", LogData);
                SessionWrapper.LoggedUser = Emp;
                SessionWrapper.Language   = db.Lanuage_Detials.Where(x => x.Language_Master_Id == lang).ToList();
                if (refresh)
                {
                    Response.Redirect("~/Pages/UserManagment/Profile.aspx");
                }
            }
            catch { return(false); }
            return(true);
        }
Example #11
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);
            }
        }
 private bool AddGroup(string arabic_name, string english_name)
 {
     try
     {
         db.Configuration.LazyLoadingEnabled = false;
         Resource group = db.Resources.Create();
         group.Resource_Name_Ar = arabic_name;
         group.Resource_Name_En = english_name;
         db.Resources.Add(group);
         db.SaveChanges();
         /* Add it to log file */
         LogData = "data:" + JsonConvert.SerializeObject(group, logFileModule.settings);
         logFileModule.logfile(10, "إنشاء مصدر معرفة", "create new Resources", LogData);
         db.Entry(group).Reload();
         ResourceGridView.DataBind();
     }
     catch { return(false); }
     return(true);
 }
        private bool rest_account(string email)
        {
            db.Configuration.LazyLoadingEnabled = false;
            Employee emp = db.Employees.Where(x => x.Employee_Email == 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.Entity.EntityState.Modified;
                db.SaveChanges();

                string    sever_name = Request.Url.Authority.ToString();
                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);
            }
        }
Example #14
0
        public static string DeleteEmplooye(int Employee_Id)
        {
            string        returnDeleteEmp = "0";
            LogFileModule logFileModule   = new LogFileModule();
            String        LogData         = "";

            try
            {
                REU_RegistrationEntities db = new REU_RegistrationEntities();
                var DelEmp = db.Employees.First(x => x.Employee_Id == Employee_Id);
                db.Employees.Remove(DelEmp);
                db.SaveChanges();
                returnDeleteEmp = "1";
                //  Add it to log file
                LogData = "data:" + JsonConvert.SerializeObject(DelEmp, logFileModule.settings);
                logFileModule.logfile(10, "حذف الموظف", "Delete Employee", LogData);
            }
            catch (Exception e)
            {
            }
            return(JsonConvert.SerializeObject(returnDeleteEmp));
        }
        public static string DeleteEmplooye(int AjaxSpecialization_Id)
        {
            string        returnDeleteEmp = "0";
            LogFileModule logFileModule   = new LogFileModule();
            String        LogData         = "";

            try
            {
                REU_RegistrationEntities db = new REU_RegistrationEntities();

                var DelSep = db.Specializations.First(x => x.Specialization_Id == AjaxSpecialization_Id);
                db.Specializations.Remove(DelSep);
                db.SaveChanges();
                returnDeleteEmp = "1";
                /* Add it to log file */
                LogData = "data:" + JsonConvert.SerializeObject(DelSep, logFileModule.settings);
                logFileModule.logfile(10, "حذف التخصص", "Delete Specialization", LogData);
            }
            catch (Exception e)
            {
            }
            return(JsonConvert.SerializeObject(returnDeleteEmp));
        }
Example #16
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);
        }
Example #17
0
        // POST: api/Rosom
        public string Post([FromBody] Rosom_Response Rosom)
        {
            try
            {
                Rosom_Request rosom_resquest = db.Rosom_Request.Where(x => x.Response_SADADNumber == Rosom.SADADNumber).FirstOrDefault();
                if (rosom_resquest != null)
                {
                    Rosom.Trackingkey        = rosom_resquest.Trackingkey;
                    Rosom.Payment_Process_Id = rosom_resquest.Payment_Process_Id;
                    Rosom.Rosom_Request_Id   = rosom_resquest.Id;
                    db.Rosom_Response.Add(Rosom);
                    //db.SaveChanges();

                    Payment_Process Pay_process = rosom_resquest.Payment_Process;
                    if (Pay_process.Payment_IsPaid == true && Pay_process.Payment_URL_IsValid == false)
                    {
                        return("{'Status': {'Code': 0,'Description': 'Success','Severity': 'Info'}}");
                    }

                    Pay_process.Payment_IsPaid      = true;
                    Pay_process.Payment_URL_IsValid = false;
                    db.Entry(Pay_process).State     = System.Data.EntityState.Modified;
                    db.SaveChanges();

                    Student std           = Pay_process.Student;
                    int     new_Status_Id = (int)std.Student_Status_Id + 1;
                    std.Student_Status_Id = new_Status_Id;
                    db.Entry(std).State   = System.Data.EntityState.Modified;
                    db.SaveChanges();

                    // isnert new Sequences record to paid
                    Sequence seq = db.Sequences.Create();
                    seq.Emp_Id       = 1;
                    seq.Status_Id    = new_Status_Id;
                    seq.Student_Id   = std.Student_Id;
                    seq.Note         = "Auto payment";
                    seq.DateCreation = DateTime.Now;
                    db.Sequences.Add(seq);
                    db.SaveChanges();


                    db.Configuration.LazyLoadingEnabled = false;
                    /* Add it to log file */
                    Student stdLogFile = db.Students.Find(std.Student_Id);
                    stdLogFile.Employee = db.Employees.Find(seq.Emp_Id);
                    stdLogFile.Status   = db.Status.Find(seq.Status_Id);

                    LogData = "data:" + JsonConvert.SerializeObject(stdLogFile, logFileModule.settings);
                    logFileModule.logfile(10, "تغير الحالة تلقائي", "Update Status Automatic", LogData);

                    Payment_Process paymentLogFile = db.Payment_Process.Find(Pay_process.Payment_Id);
                    LogData = "data:" + JsonConvert.SerializeObject(paymentLogFile, logFileModule.settings);
                    logFileModule.logfile(10, "اضافة عملية دفع", "add payment process", LogData);

                    bool            Make_Equation = false;
                    List <Sequence> seq_Check     = db.Sequences.Where(x => x.Student_Id == std.Student_Id && x.Status_Id == 1016).ToList(); // 1016 : Certificate Equation Completed
                    if (seq_Check.Count > 0)
                    {
                        Make_Equation = true;
                    }

                    // InCase if student not new
                    if (std.Student_Status_Id == 7 && std.Student_Type_Id != 1 && !Make_Equation)
                    {
                        try
                        {
                            // Update student record to Equation
                            int new_Status_Id_Tran = 19;//معادلة الشهادة
                            std.Student_Status_Id = new_Status_Id_Tran;
                            db.Entry(std).State   = System.Data.EntityState.Modified;
                            db.SaveChanges();

                            // isnert new Sequences record to paid
                            Sequence seq2 = db.Sequences.Create();
                            seq2.Emp_Id       = 1;
                            seq2.Status_Id    = new_Status_Id_Tran;
                            seq2.Student_Id   = std.Student_Id;
                            seq2.Note         = "Auto Transaction";
                            seq2.DateCreation = DateTime.Now;
                            db.Sequences.Add(seq2);
                            db.SaveChanges();


                            db.Configuration.LazyLoadingEnabled = false;
                            /* Add it to log file */
                            Student stdLogFile2 = db.Students.Find(std.Student_Id);
                            stdLogFile2.Employee = db.Employees.Find(seq2.Emp_Id);
                            stdLogFile2.Status   = db.Status.Find(seq2.Status_Id);

                            LogData = "data:" + JsonConvert.SerializeObject(stdLogFile2, logFileModule.settings);
                            logFileModule.logfile(10, "تغير الحالة تلقائي", "Update Status Automatic", LogData);
                        }
                        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 checkPayment Status", LogData);
                        }
                    }

                    return("{'Status': {'Code': 0,'Description': 'Success','Severity': 'Info'}}");
                }

                return("{'Status': {'Code': 2000,'Description': 'Bill not found','Severity': 'Info'}}");
            }
            catch (Exception er) { return("{'Status': {'Code': 2000,'Description': 'Bill not found','Severity': 'Info'}}"); }
        }
Example #18
0
        private void LoadStudentInfo(Student std)
        {
            try
            {
                if (std != null)
                {
                    //Check If He Has Permission
                    CheckIfHeHasPermission(std);

                    // select the color based on status id
                    int index = (int)std.Student_Status_Id - 1;
                    if (index > Color.Length)
                    {
                        index = 1;
                    }

                    // Set profile image
                    if (std.Student_Image_Profile == null || std.Student_Image_Profile == "")
                    {
                        txtProfileImage.ImageUrl = "~/media/StudentProfile/Profile.jpg";
                    }
                    else
                    {
                        txtProfileImage.ImageUrl = "~/media/StudentProfile/" + std.Student_Image_Profile;
                    }


                    // load other data
                    txtStudent_Id.Text  = std.Student_Id.ToString();
                    txtStudent_SSN.Text = std.Student_SSN;
                    if (SessionWrapper.LoggedUser.Language_id == 1)
                    {
                        txtStudent_Name.Text = std.Student_Name_Ar;
                    }
                    else
                    {
                        txtStudent_Name.Text = std.Student_Name_En;
                    }
                    txtStudent_Phone.Text   = std.Student_Phone;
                    txtStudent_Email.Text   = std.Student_Email;
                    txtStudent_Address.Text = std.Student_Address;
                    if (SessionWrapper.LoggedUser.Language_id == 1)
                    {
                        txtSpecialization.Text = std.Specialization.Specialization_Name_Ar;
                    }
                    else
                    {
                        txtSpecialization.Text = std.Specialization.Specialization_Name_En;
                    }
                    if (SessionWrapper.LoggedUser.Language_id == 1)
                    {
                        txtStatus.Text = "<span class='label label-warning' style='background:" + Color[index] + " !important;'>" + std.Status.Status_Name_Ar + "</span>";
                    }
                    else
                    {
                        txtStatus.Text = "<span class='label label-warning' style='background:" + Color[index] + " !important;'>" + std.Status.Status_Name_En + "</span>";
                    }
                    if (SessionWrapper.LoggedUser.Language_id == 1)
                    {
                        txtStudent_Nationality.Text = std.Nationality.Nationality_Name_Ar;
                    }
                    else
                    {
                        txtStudent_Nationality.Text = std.Nationality.Nationality_Name_En;
                    }

                    if (SessionWrapper.LoggedUser.Language_id == 1)
                    {
                        txtStudent_Resource.Text = std.Resource.Resource_Name_Ar;
                    }
                    else
                    {
                        txtStudent_Resource.Text = std.Resource.Resource_Name_En;
                    }

                    txtStudent_Capabilities_Degree.Text   = " " + std.Student_Capabilities_Degree + "";
                    txtStudent_High_School_Degree.Text    = " " + std.Student_High_School_Degree + "";
                    txtStudent_My_Achievement_Degree.Text = " " + std.Student_My_Achievement_Degree + "";

                    int str_index = (std.Student_Total.ToString()).IndexOf('.');
                    if (str_index != -1)
                    {
                        txtStudent_Total.Text = (std.Student_Total.ToString()).Substring(0, str_index + 2);
                    }
                    else
                    {
                        str_index = (std.Student_Total.ToString()).IndexOf(',');
                        if (str_index != -1)
                        {
                            txtStudent_Total.Text = (std.Student_Total.ToString()).Substring(0, str_index + 2);
                        }
                        else
                        {
                            txtStudent_Total.Text = std.Student_Total + "%";
                        }
                    }

                    DateTime date = DateTime.Parse(std.Student_CreationDate.ToString());
                    txtStudent_CreationDate.Text = date.ToShortDateString();

                    if (std.Student_Status_Id == 7 || std.Student_Status_Id == 9)
                    {
                        txtURL_Video.Visible       = true;
                        txtURL_Video_Label.Visible = true;
                    }

                    // Change status to pendding if it's new
                    if (std.Status.Status_Code == 1)
                    {
                        std.Student_Status_Id = 2;
                        db.Entry(std).State   = System.Data.Entity.EntityState.Modified;

                        Sequence seq = db.Sequences.Create();

                        seq.Emp_Id       = SessionWrapper.LoggedUser.Employee_Id;
                        seq.Status_Id    = 2;
                        seq.Student_Id   = std.Student_Id;
                        seq.DateCreation = DateTime.Now;

                        if (SessionWrapper.LoggedUser.Language_id == 1)
                        {
                            txtStatus.Text = "<span class='label label-warning' style='background:" + Color[index + 1] + " !important;'>" + std.Status.Status_Name_Ar + "</span>";
                        }
                        else
                        {
                            txtStatus.Text = "<span class='label label-warning' style='background:" + Color[index + 1] + " !important;'>" + std.Status.Status_Name_En + "</span>";
                        }

                        db.Sequences.Add(seq);
                        db.SaveChanges();


                        db.Configuration.LazyLoadingEnabled = false;
                        /* Add it to log file */
                        Student stdLogFile = db.Students.Find(std.Student_Id);
                        stdLogFile.Employee = db.Employees.Find(seq.Emp_Id);
                        stdLogFile.Status   = db.Status.Find(seq.Status_Id);

                        LogData = "data:" + JsonConvert.SerializeObject(stdLogFile, logFileModule.settings);
                        logFileModule.logfile(10, "تغير الحالة", "Update Status", LogData);
                    }

                    // Set action if it's allow
                    int emp_id = 0;
                    if (std.Student_Employee_Id != null)
                    {
                        emp_id = (int)std.Student_Employee_Id;
                    }
                    IsAllowToTakeAction((int)std.Student_Status_Id, emp_id, std);

                    //Set Action
                    SetActions();

                    // Load Files
                    LoadStudentFiles(std.Student_Id);

                    //Load sequence
                    LoadSequence(std.Student_Id);

                    //Button Names
                    btnReject.Text  = GetRejectStatusName((int)std.Student_Status_Id);
                    btnApprove.Text = GetApproveStatusName((int)std.Student_Status_Id);
                }
            }
            catch { Response.Redirect("~/Pages/RegistrationProcess/ListView.aspx"); }
        }
        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 */
        }
Example #20
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 */
        }
Example #21
0
        public async void PaymentProcessFunction()
        {
            try
            {
                int counter   = 0;
                int newStatus = 0;
                List <Payment_Process> ListPayment = db.Payment_Process.Where(x => x.Payment_IsPaid == false && x.Payment_URL_IsValid == false).ToList();
                for (int i = 0; i < ListPayment.Count; i++)
                {
                    Dictionary <string, dynamic> responseData = Request(ListPayment[i].Send_EntityId);
                    if (responseData["result"]["code"] == "000.200.100")
                    {
                        Payment_Process PaymentProcess_update = db.Payment_Process.Find(ListPayment[i].Payment_Id);
                        PaymentProcess_update.Payment_IsPaid     = true;
                        PaymentProcess_update.Result_Code        = responseData["result"]["code"];
                        PaymentProcess_update.Result_Description = responseData["result"]["description"];
                        PaymentProcess_update.Result_BuildNumber = responseData["buildNumber"];
                        PaymentProcess_update.Result_Timestamp   = responseData["timestamp"];
                        PaymentProcess_update.Result_Ndc         = responseData["ndc"];
                        PaymentProcess_update.Result_Id          = responseData["id"];
                        PaymentProcess_update.Payment_Date       = DateTime.Now;
                        db.Entry(PaymentProcess_update).State    = System.Data.Entity.EntityState.Modified;
                        db.SaveChanges();
                        counter++;


                        Student std = db.Students.Find(PaymentProcess_update.Student_Id);
                        if (std.Student_Status_Id == 6)
                        {
                            newStatus = 7;
                        }
                        else if (std.Student_Status_Id == 11)
                        {
                            newStatus = 10;
                        }

                        std.Student_Status_Id = newStatus;
                        db.Entry(std).State   = System.Data.Entity.EntityState.Modified;
                        db.SaveChanges();

                        Sequence seq = db.Sequences.Create();

                        seq.Emp_Id       = 1;
                        seq.Status_Id    = newStatus;
                        seq.Student_Id   = std.Student_Id;
                        seq.Note         = "Student Complate The Payment";
                        seq.DateCreation = DateTime.Now;

                        db.Sequences.Add(seq);
                        db.SaveChanges();

                        db.Configuration.LazyLoadingEnabled = false;
                        /* Add it to log file */
                        Student stdLogFilestd = db.Students.Find(std.Student_Id);
                        stdLogFilestd.Employee = db.Employees.Find(seq.Emp_Id);
                        stdLogFilestd.Status   = db.Status.Find(seq.Status_Id);

                        LogData = "data:" + JsonConvert.SerializeObject(stdLogFilestd, logFileModule.settings);
                        logFileModule.logfile(10, "تغير الحالة", "Update Status", LogData);

                        /* Add it to log file */
                        Payment_Process stdLogFile = db.Payment_Process.Find(PaymentProcess_update.Payment_Id);
                        stdLogFile.Student = db.Students.Find(PaymentProcess_update.Student_Id);

                        LogData = "data:" + JsonConvert.SerializeObject(stdLogFile, logFileModule.settings);
                        logFileModule.logfile(10, "اضافة دفعية جديدة", "Add new payment operation", LogData);
                    }
                }
                LastUpdate lastupdate_exist = db.LastUpdates.FirstOrDefault();
                if (lastupdate_exist != null)
                {
                    lastupdate_exist.CreationDate    = DateTime.Now;
                    lastupdate_exist.Counter         = lastupdate_exist.Counter + counter;
                    db.Entry(lastupdate_exist).State = System.Data.Entity.EntityState.Modified;
                    db.SaveChanges();
                }
                else
                {
                    LastUpdate lastupdate_new = db.LastUpdates.Create();
                    lastupdate_new.CreationDate = DateTime.Now;
                    lastupdate_new.Counter      = counter;
                    db.LastUpdates.Add(lastupdate_new);
                    db.SaveChanges();
                }
            }
            catch (Exception er)
            {
                /* Add it to log file */
                LogData = "data:" + JsonConvert.SerializeObject(er.StackTrace, logFileModule.settings);
                logFileModule.logfile(10, "حدث خطاء في النظام", "Exception in system", LogData);
                return;
            }
        }
        public bool CheckPaymentStatus(string Trackingkey_local, string entityId, string PaymentId_local)
        {
            bool result = false;

            try
            {
                Dictionary <string, dynamic> responseData = CheckStatusPaymentRequest(PaymentId_local, entityId);
                if (responseData["result"]["code"] == "000.100.110" || responseData["result"]["code"] == "000.100.112")
                {
                    Payment_Process PaymentProcess_update = db.Payment_Process.FirstOrDefault(x => x.Payment_Trackingkey == Trackingkey_local);
                    PaymentProcess_update.Payment_IsPaid      = true;
                    PaymentProcess_update.Payment_URL_IsValid = false;
                    PaymentProcess_update.Payment_Result_Json = JsonConvert.SerializeObject(responseData, logFileModule.settings);
                    PaymentProcess_update.Payment_Date        = DateTime.Now;
                    db.Entry(PaymentProcess_update).State     = System.Data.Entity.EntityState.Modified;
                    db.SaveChanges();



                    // Update student record to paid
                    Student std           = db.Students.Find(PaymentProcess_update.Student_Id);
                    int     new_Status_Id = (int)std.Student_Status_Id + 1;
                    std.Student_Status_Id = new_Status_Id;
                    db.Entry(std).State   = System.Data.Entity.EntityState.Modified;
                    db.SaveChanges();

                    // isnert new Sequences record to paid
                    Sequence seq = db.Sequences.Create();
                    seq.Emp_Id       = 1;
                    seq.Status_Id    = new_Status_Id;
                    seq.Student_Id   = std.Student_Id;
                    seq.Note         = "Auto payment";
                    seq.DateCreation = DateTime.Now;
                    db.Sequences.Add(seq);
                    db.SaveChanges();


                    db.Configuration.LazyLoadingEnabled = false;
                    /* Add it to log file */
                    Student stdLogFile = db.Students.Find(std.Student_Id);
                    stdLogFile.Employee = db.Employees.Find(seq.Emp_Id);
                    stdLogFile.Status   = db.Status.Find(seq.Status_Id);

                    LogData = "data:" + JsonConvert.SerializeObject(stdLogFile, logFileModule.settings);
                    logFileModule.logfile(10, "تغير الحالة تلقائي", "Update Status Automatic", LogData);

                    Payment_Process paymentLogFile = db.Payment_Process.Find(PaymentProcess_update.Payment_Id);
                    LogData = "data:" + JsonConvert.SerializeObject(paymentLogFile, logFileModule.settings);
                    logFileModule.logfile(10, "اضافة عملية دفع", "add payment process", LogData);

                    result = true;
                }
                else
                {
                    Payment_Process PaymentProcess_update = db.Payment_Process.FirstOrDefault(x => x.Payment_Trackingkey == Trackingkey_local);
                    PaymentProcess_update.Payment_Result_Json = JsonConvert.SerializeObject(responseData, logFileModule.settings);
                    db.Entry(PaymentProcess_update).State     = System.Data.Entity.EntityState.Modified;
                    db.SaveChanges();

                    /* Add it to log file */
                    db.Configuration.LazyLoadingEnabled = false;
                    Payment_Process paymentLogFile = db.Payment_Process.Find(PaymentProcess_update.Payment_Id);
                    LogData = "data:" + JsonConvert.SerializeObject(paymentLogFile, logFileModule.settings);
                    logFileModule.logfile(10, "اضافة عملية دفع", "add payment process", LogData);
                }
            }
            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 checkPayment Status", LogData);
            }
            return(result);
        }
Example #23
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);
                    string Encrypted_Password = StringCipher.Encrypt(New_Password, "Password"); // emp.Employee_Password.ToString();
                    Emp.Employee_Password = Encrypted_Password;

                    string    sever_name  = Request.Url.Authority.ToString();
                    SendEmail send        = new SendEmail();
                    bool      EmailResult = send.ResetEmail(Email, New_Password, sever_name, "New Account");
                    if (EmailResult)
                    {
                        Page.ClientScript.RegisterStartupScript(this.GetType(), "CallMyFunction", "show_model_sucess();", true);
                    }
                }
                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)
                {
                    ImagepathProfile = "Profile.JPG";
                }
                if (EmployeeID != 0)
                {
                    db.Entry(Emp).State = System.Data.Entity.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 bool IU_Student(int StudentID, string ArabicName, string EnglishName, FileUpload StProfile, string Email, string Phone, string StuAddress, DateTime RegistrationDate, string StudentSSN, float HighSchoolDeg, float CapabilitiesDeg, float MyAchievementDeg, int ResourceID, int SpecializationID, int NationalityID, string Notes, float StudentTotal)
        {
            try
            {
                int Student_Id = 0;
                db.Configuration.LazyLoadingEnabled = false;
                Student Stu = db.Students.Create();
                if (StudentID != 0)
                {
                    Stu = db.Students.First(x => x.Student_Id == StudentID);
                }
                Stu.Student_Name_Ar               = ArabicName;
                Stu.Student_Name_En               = EnglishName;
                Stu.Student_Email                 = Email;
                Stu.Student_Phone                 = Phone;
                Stu.Student_Address               = StuAddress;
                Stu.Student_CreationDate          = RegistrationDate;
                Stu.Student_SSN                   = StudentSSN;
                Stu.Student_High_School_Degree    = HighSchoolDeg.ToString();
                Stu.Student_Capabilities_Degree   = CapabilitiesDeg.ToString();
                Stu.Student_My_Achievement_Degree = MyAchievementDeg.ToString();
                Stu.Student_Resource_Id           = ResourceID;
                Stu.Student_Specialization_Id     = SpecializationID;
                Stu.Student_Nationality_Id        = NationalityID;
                Stu.Notes         = Notes;
                Stu.Student_Total = StudentTotal.ToString();
                Stu.Suspended     = 0;
                if (StudentID == 0)
                {
                    Stu.Student_Status_Id = 1;
                }
                string ImegProfile = UploadFile(StProfile, @"~\media\StudentProfile\");
                if (ImegProfile != "")
                {
                    Stu.Student_Image_Profile = ImegProfile;
                }
                else if (StudentID == 0)
                {
                    Stu.Student_Image_Profile = "Profile.JPG";
                }

                if (StudentID != 0)
                {
                    db.Entry(Stu).State = System.Data.Entity.EntityState.Modified;
                }
                else
                {
                    db.Students.Add(Stu);
                }
                db.SaveChanges();
                if (StudentID != 0)
                {
                    Student_Id = StudentID;
                }
                else
                {
                    Student_Id = Stu.Student_Id;
                }
                string SSSNFile = UploadFile(Student_Id, (int)FileType.Nationality, StudentSSNFile, @"~\media\StudentAttachments\");

                string HSFile = UploadFile(Student_Id, (int)FileType.High_School, HighSchoolDegreeFile, @"~\media\StudentAttachments\");

                string CAFile = UploadFile(Student_Id, (int)FileType.Capabilities, CapabilitiesDegreeFile, @"~\media\StudentAttachments\");

                string MAfile = UploadFile(Student_Id, (int)FileType.My_Achievement, MyAchievementDegreeFile, @"~\media\StudentAttachments\");

                /* Add it to log file */
                LogData = "data:" + JsonConvert.SerializeObject(Stu, logFileModule.settings);
                if (StudentID != 0)
                {
                    logFileModule.logfile(10, "تعديل بيانات الطالب", "Update Student", LogData);
                }
                else
                {
                    logFileModule.logfile(10, "إضافة طالب", "Add Student", LogData);
                }
            }
            catch { return(false); }
            return(true);
        }