protected void Page_Load(object sender, EventArgs e)
        {
            List <ReportDownloadReqDTO> lstDto = new List <ReportDownloadReqDTO>();
            DownloadRequestBusiness     PB     = new DownloadRequestBusiness();

            lstDto = PB.Get_DownloadedFiles_ByStcode(Session[sessionNames.userID_StudentOstad].ToString());
            grd_ListDownloadedFile.DataSource = lstDto;
            grd_ListDownloadedFile.DataBind();
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session[sessionNames.userID_StudentOstad] == null)
            {
                Response.Redirect("~/CommonUI/login.aspx");
            }

            if (Session[sessionNames.userID_StudentOstad] != null)
            {
                Label1.Text = Session[sessionNames.userID_StudentOstad].ToString();
                if (!IsPostBack)
                {
                    LoginBusiness lgnB = new LoginBusiness();
                    StuImg        st   = lgnB.User_Img(Label1.Text);
                    PersonalImg.DataValue = st.img;
                    LoginDTO stInfo = lgnB.Get_StInfo(Label1.Text);
                    stName.InnerText     = stInfo.Name;
                    stLastName.InnerText = stInfo.LastName;
                    stField.InnerText    = stInfo.StReshte;
                    Reports rpt = new Reports();
                    List <ReportDownloadReqDTO> counter = new List <ReportDownloadReqDTO>();
                    int sum = 0;
                    counter = rpt.Get_SelectedAsset_NotPay(Label1.Text);
                    ShoppingCounter.InnerText = counter.Count.ToString();
                    grdShopping.DataSource    = counter;
                    grdShopping.DataBind();
                    DownloadRequestBusiness dnlB     = new DownloadRequestBusiness();
                    List <AssetDTO>         assetlst = new List <AssetDTO>();
                    assetlst = dnlB.GetValidAssets(Label1.Text);
                    if (assetlst.Count > 0)
                    {
                        dnlNav.Visible = true;
                    }
                    if (grdShopping.MasterTableView.Items.Count > 0)
                    {
                        Paybtn.Visible = true;
                    }
                    foreach (GridDataItem item in grdShopping.MasterTableView.Items)
                    {
                        if (grdShopping.Columns[2].UniqueName == "SumPrice")
                        {
                            sum += int.Parse(item["SumPrice"].Text.Replace(",", ""));
                        }
                    }
                    Session["Fee"] = sum.ToString();
                }
                Session[sessionNames.userID_StudentOstad] = Label1.Text;
            }
            else
            {
                Response.Redirect("~/CommonUI/login.aspx", false);
            }
        }
 protected void Page_Load(object sender, EventArgs e)
 {
     try
     {
         if (!Page.IsPostBack)
         {
             lbl_User.Text = Session[sessionNames.userID_StudentOstad].ToString();
             DownloadRequestBusiness dnlB = new DownloadRequestBusiness();
             lstDownload.DataSource = dnlB.GetValidAssets(lbl_User.Text);
             lstDownload.DataBind();
             Session[sessionNames.userID_StudentOstad] = lbl_User.Text;
         }
     }
     catch
     {
     }
 }
Beispiel #4
0
        protected void btnSelect_Click(object sender, EventArgs e)
        {
            DownloadRequestBusiness dnlreq    = new DownloadRequestBusiness();
            DownloadRequestDTO      dnlreqDTO = new DownloadRequestDTO();

            dnlreqDTO.StCode     = lbl_User.Text;
            dnlreqDTO.Class_Code = txt_AssetTxt.Text;
            dnlreqDTO.Link_Click = false;
            dnlreq.Create_DownloadRequest(dnlreqDTO);
            MasterPage mp  = this.Master;
            Reports    rpt = new Reports();
            List <ReportDownloadReqDTO> req = new List <ReportDownloadReqDTO>();

            req = rpt.Get_SelectedAsset_NotPay(lbl_User.Text);
            //MastePage.MasterPage msp = new MastePage.MasterPage();
            RadGrid lst = (RadGrid)mp.FindControl("grdShopping");

            lst.DataSource = req;
            lst.Rebind();
            Response.Redirect("ClassList.aspx");
        }
Beispiel #5
0
        protected void grd_PaymentList_ItemCommand(object sender, GridCommandEventArgs e)
        {
            if (e.CommandName == "detail")
            {
                var              orderId     = Convert.ToInt32(e.CommandArgument.ToString()).ToString();
                var              index       = e.Item.RowIndex;
                GridDataItem     item        = (GridDataItem)e.Item;
                GridEditableItem item1       = (GridEditableItem)e.Item;
                var              studentCode = item["studentCode"].Text;

                List <PaymentDTO>       lstDto = new List <PaymentDTO>();
                PaymentBusiness         PB     = new PaymentBusiness();
                DownloadRequestBusiness dnlDAO = new DownloadRequestBusiness();
                // Common.UserAccessBusiness uab = new Common.UserAccessBusiness();
                var payStudent = dnlDAO.Get_Selected_DetailPayment(studentCode, orderId);


                grdDateTime.DataSource = payStudent;
                grdDateTime.DataBind();

                string scrp = "function f(){$find(\"" + RadWindow1.ClientID + "\").show(); Sys.Application.remove_load(f);}Sys.Application.add_load(f);";
                ScriptManager.RegisterStartupScript(this.Page, GetType(), ClientID, scrp, true);
                //**************
                //GridViewRow curruntRow = (GridViewRow)(((Button)e.CommandSource).NamingContainer);
                //imgStatus2.ImageUrl = ((Image)curruntRow.Cells[2].FindControl("imgStatus")).ImageUrl;
                //var requestDetails = rh.GetRequestDetails(reqId);
                //lblRequestId.Text = requestDetails.ID.ToString();
                //lblDarkhast.Text = requestDetails.CourseName;
                //lbldateOfRequest.Text = requestDetails.Issue_time;
                //RequestDateTimeHandler rqdateTimeH = new RequestDateTimeHandler();
                //_dateTimeList = rqdateTimeH.GetDateTimeListByRequestId(reqId);
                //var dateTime = _dateTimeList.OrderBy(c => c.Date).FirstOrDefault(c => c.Date != null);
                //if (dateTime != null)
                //    lblRequest.Text = dateTime.Date;
                //***************
            }
        }
Beispiel #6
0
        protected void Page_Load(object sender, EventArgs e)
        {
            lbl_User.Text = Session[sessionNames.userID_StudentOstad].ToString();
            var    classCode = (Request.QueryString["ClassCode"].ToString());
            string fileDate  = Request.QueryString["Date"].ToString();
            string assetId   = Request.QueryString["Ast"].ToString();
            string term      = Request.QueryString["t"].ToString();

            if (term != ConfigurationManager.AppSettings["Term"].ToString())
            {
                btn_Select.Visible = false;
            }
            ClassName.InnerText   = classCode.ToString();
            SessionName.InnerText = fileDate.ToString();
            txt_AssetTxt.Text     = assetId.ToString();
            RecordsBusiness   recBusiness = new RecordsBusiness();
            List <RecordsDTO> recDTO      = new List <RecordsDTO>();

            recDTO = recBusiness.LinkOfClassWithLessonCodeByCodeClassAndTime(classCode, fileDate, term);
            //  recDTO = recBusiness.MakeOffLineClassWithLessonCodeByCodeClassAndTime(classCode, fileDate);
            if (recDTO.Count == 0)
            {
                btn_Select.Visible = false;
            }
            lstView.DataSource = recDTO;
            lstView.DataBind();
            DownloadRequestBusiness dnlreq = new DownloadRequestBusiness();
            DataTable dt = new DataTable();

            dt = dnlreq.Check_PayedAsset(Session[sessionNames.userID_StudentOstad].ToString(), Convert.ToInt32(txt_AssetTxt.Text));
            if (dt.Rows.Count > 0)
            {
                btn_Select.Enabled = false;
            }
            string fd = fileDate.ToString().Replace('/', '-');

            // string pathmp3 = Server.MapPath("../content/" + term + "/" + classCode.ToString() + "/" + fd );
            string pathflv = Server.MapPath("../content/" + term + "/" + classCode.ToString() + "/" + fd);
            bool   viewmp3 = false, viewFlv = false, viewavi = false;

            if (Directory.Exists(pathflv) == false)
            {
                btn_Select.Visible = false;
            }
            else
            {
                DirectoryInfo di = new DirectoryInfo(Server.MapPath("../content/" + term + "/" + classCode.ToString() + "/" + fd + "/"));
                // Get a reference to each file in that directory.
                FileInfo[] fiArr = di.GetFiles("mp3.zip");
                foreach (FileInfo f in fiArr)
                {
                    if (f.Length > 5000000)
                    {
                        viewmp3 = true;
                    }
                }

                // Get a reference to each file in that directory.
                FileInfo[] fiArrflv = di.GetFiles("flv.zip");
                foreach (FileInfo f in fiArrflv)
                {
                    if (f.Length > 10000000)
                    {
                        viewFlv = true;
                    }
                }
                FileInfo[] fiArravi = di.GetFiles("avi.zip");
                foreach (FileInfo f in fiArravi)
                {
                    if (f.Length > 5000000)
                    {
                        viewavi = true;
                    }
                }
                if (viewFlv == false && viewmp3 == false && viewavi == false)
                {
                    btn_Select.Visible = false;
                }
            }
            Session[sessionNames.userID_StudentOstad] = lbl_User.Text;
        }
        protected void Payment_Click(object sender, EventArgs e)
        {
            var msg         = string.Empty;
            var transaction = new TransactionDTO
            {
                Amount            = Convert.ToInt64(Session["fee"].ToString()),
                stcode            = Session[sessionNames.userID_StudentOstad].ToString(),
                TransactionTypeId = Convert.ToDecimal(TransactionTypeEnum.FileDownloadPurchase),
            };

            if (_walletBusiness.PayByWallet(transaction, out msg))
            {
                bmp_PaymentBusiness     bmp = new bmp_PaymentBusiness();
                DownloadRequestBusiness drb = new DownloadRequestBusiness();
                var _orderId     = _walletBusiness.GenerateOrderIdForRequests();
                var _traceNumber = Convert.ToInt64(((int)DateTime.Now.TimeOfDay.TotalSeconds).ToString() + _orderId.ToString());
                bmp.CreateStudentPayment(new DTO.CommonClasses.PaymentDTO
                {
                    Amount      = Convert.ToInt64(transaction.Amount),
                    AppStatus   = "COMMIT",
                    Description = "پرداخت هزینه دانلود فایل",
                    MiladiDate  = DateTime.Now,
                    tterm       = ConfigurationManager.AppSettings["Term"],
                    stcode      = Session[sessionNames.userID_StudentOstad].ToString(),
                    Result      = 0,
                    OrderId     = _orderId,
                    bankId      = 700,
                    TraceNumber = _traceNumber,
                    ReqKey      = "WALLETPAYMENT",
                    //RequestId = int.Parse(reqId.Text),
                });
                foreach (RadListViewItem lvi in lst_SelectedClass.Items)
                {
                    Label reqId = (Label)lvi.FindControl("RequestID");
                    bmp.CreateStudentRequestPayment(new PaymentRequest {
                        OrderID = _orderId, RequestID = Convert.ToInt32(reqId.Text)
                    });

                    drb.UpdateRequestDownload(_orderId, _traceNumber.ToString());
                }
                rwm.RadAlert("پرداخت شما با موفقیت انجام گردید.", null, 100, "دانلود فایل", "walletPaymentCallback");
            }
            else
            {
                rwm.RadAlert(msg, null, 100, "دانلود فایل", "");
            }

            //پرداخت مستقیم - حذف به علت جایگزینی روش پرداخت از طریق کیف پول - 990401

            /*
             * try
             * {
             *  string result;
             *
             *  long orderid;//= new bmp_PaymentBusiness().GenerateOrderId();
             *
             *
             *  SetDefaultDateTime();
             *  PaymentDTO pay = new PaymentDTO();
             *  bmp_PaymentBusiness bmp = new bmp_PaymentBusiness();
             *  pay.Amount = Convert.ToInt64(Session["fee"].ToString());
             *  pay.stcode = Session[sessionNames.userID_StudentOstad].ToString();
             *  pay.bankId = 2;
             *  pay.tterm = ConfigurationManager.AppSettings["Term"];
             *
             *
             *  result = bmp.pay(pay.Amount, pay.stcode, out orderid, Convert.ToInt32(Session[sessionNames.appID_StudentOstad]), 0);
             *
             *  String[] resultArray = result.Split(',');
             *  pay.OrderId = orderid;
             *  pay.ReqKey = resultArray[1];
             *  pay.AppStatus = "none";
             *  pay.TraceNumber = 0;
             *  pay.Result = -1;
             *  bmp.CreateStudentPayment(pay);
             *  foreach (RadListViewItem lvi in lst_SelectedClass.Items)
             *  {
             *      Label reqId = (Label)lvi.FindControl("RequestID");
             *      PaymentRequest pr = new PaymentRequest();
             *      pr.OrderID = orderid;
             *      pr.RequestID = int.Parse(reqId.Text);
             *      bmp.CreateStudentRequestPayment(pr);
             *
             *  }
             *
             *  if (resultArray[0] == "0")
             *      ClientScript.RegisterStartupScript(typeof(Page), "ClientScript", "<script language='javascript' type='text/javascript'> postRefId('" + resultArray[1] + "');</script> ", false);
             * }
             * catch (Exception exp)
             * {
             *  Response.Write("Error: " + exp.Message);
             * }
             */
        }