Beispiel #1
0
    protected void FileImageAlbum_FileUploaded(object sender, FileUploadedEventArgs e)
    {
        var FileImageAlbum = (RadAsyncUpload)sender;
        //var Parent = FileImageAlbum.NamingContainer;
        //var ProductID = ((HiddenField)Parent.FindControl("hdnProductID")).Value;
        var ProductOptionCategoryID = string.IsNullOrEmpty(Request.QueryString["poi"]) ? "" : Request.QueryString["poi"];
        //var RadListView1 = (RadListView)Parent.FindControl("RadListView1");
        //var RadListView2 = (RadListView)Parent.FindControl("RadListView2");


        string newName      = Guid.NewGuid().GetHashCode().ToString("X") + e.File.GetExtension();
        string targetFolder = "~/res/productoption/" + newName;

        e.File.SaveAs(Server.MapPath(targetFolder));

        string bgColor = "#ffffff";

        ResizeCropImage.CreateThumbNailWithBackGroundColor("~/res/productoption/", "~/res/productoption/thumbs/", newName, 70, 82, bgColor);
        ResizeCropImage.ResizeWithBackGroundColor(targetFolder, 1000, 1182, bgColor);

        //ResizeCropImage.ResizeByCondition(targetFolder + newName, 800, 800);
        //ResizeCropImage.CreateThumbNailByCondition("~/res/productoption/", "~/res/productoption/thumbs/", newName, 120, 120);

        if (string.IsNullOrEmpty(ProductOptionCategoryID))
        {
            TempImage.Rows.Add(new object[] { newName });

            RadListView2.DataSource = TempImage;
            RadListView2.DataBind();
        }
        else
        {
            var oProductOption = new ProductOption();

            oProductOption.ProductOptionInsert(newName,
                                               "",
                                               "",
                                               "",
                                               "",
                                               "",
                                               "",
                                               "",
                                               "",
                                               "",
                                               "",
                                               "",
                                               "",
                                               "",
                                               ProductOptionCategoryID,
                                               "1",
                                               "0",
                                               "0",
                                               "1",
                                               ""
                                               );
            RadListView1.Rebind();
        }
    }
 protected void rcbTerm_SelectedIndexChanged(object sender, Telerik.Web.UI.RadComboBoxSelectedIndexChangedEventArgs e)
 {
     RadListView2.DataSource = clsB.Show_Class_List(Session[sessionNames.userID_StudentOstad].ToString(), rcbTerm.SelectedValue);
     RadListView2.DataBind();
     foreach (RadListViewItem lvi in RadListView2.Items)
     {
         RadListView lstAsset  = (RadListView)lvi.FindControl("RadListView3");
         Label       ClassCode = (Label)lvi.FindControl("ClassCode");
         lstAsset.DataSource = assetB.Show_Asset_List_ByClassCode(ClassCode.Text, rcbTerm.SelectedValue);
         lstAsset.DataBind();
         if (RadListView2.Items.Count > 0)
         {
             btn_Select.Visible = true;
         }
     }
 }
Beispiel #3
0
    //private void PopulateData()
    //{
    //    if (!IsPostBack)
    //    {
    //        BindData();

    //    }
    //    else
    //    {
    //        BindData();
    //    }

    //    if (UserController.GetCurrentUserInfo().IsInRole("Administrators") ||
    //                  UserController.GetCurrentUserInfo().IsInRole("NexsoSupport"))
    //    {
    //        BindData();
    //    }
    //}

    /// <summary>
    /// Obtener lista de elementos (respuesta) para los pasos 2 a 5 del asistente
    /// </summary>
    private void BindData()
    {
        var list = ListComponent.GetListPerCategory("Theme", Thread.CurrentThread.CurrentCulture.Name).ToList();

        RadListView1.DataSource = list.Where(x => !x.Key.Contains("ctm_")).ToList();
        RadListView1.DataBind();

        list = ListComponent.GetListPerCategory("Beneficiaries", Thread.CurrentThread.CurrentCulture.Name).ToList();
        RadListView2.DataSource = list;
        RadListView2.DataBind();

        list = ListComponent.GetListPerCategory("Sector", Thread.CurrentThread.CurrentCulture.Name).ToList();
        RadListView3.DataSource = list;
        RadListView3.DataBind();

        list = ListComponent.GetListPerCategory("WhoAreYou", Thread.CurrentThread.CurrentCulture.Name).ToList();
        RadListView4.DataSource = list;
        RadListView4.DataBind();

        //If users is login load the list with its answer
        if (userId >= 0)
        {
            if (!IsPostBack)
            {
                SetChkControl("Theme", RadListView1);
                SetChkControl("Beneficiaries", RadListView2);
                SetChkControl("Sector", RadListView3);
                SetChkControl("WhoAreYou", RadListView4);
                txtEmail.Text     = currentUser.Email;
                txtFirstName.Text = WebUtility.HtmlDecode(currentUser.FirstName);
                txtLastName.Text  = WebUtility.HtmlDecode(currentUser.LastName);
                CountryStateCityEditMode.SelectedCity    = userPropertyComponent.UserProperty.City;
                CountryStateCityEditMode.SelectedCountry = userPropertyComponent.UserProperty.Country;
                CountryStateCityEditMode.SelectedState   = userPropertyComponent.UserProperty.Region;
                CountryStateCityEditMode.SelectedAddress = userPropertyComponent.UserProperty.Address;
                CountryStateCityEditMode.UpdateMap();
            }
        }
        SetupWizard(Wizard1.ActiveStepIndex);
    }
 protected void workersGrid_ItemCommand(object sender, GridCommandEventArgs e)
 {
     if (e.CommandName == "View")
     {
         using (SqlConnection connection = new SqlConnection(connectionString))
         {
             using (SqlDataAdapter adapter = new SqlDataAdapter())
             {
                 DataTable dTable = new DataTable();
                 //GridDataItem item = e.Item as GridDataItem;
                 var    item        = workersGrid.Items[e.CommandArgument.ToString()];
                 string workerid    = item.GetDataKeyValue("WorkerID").ToString();
                 string selectquery = "select WorkerID, WorkerType, SName + ' ' + OName + ' ' + Pname as fullname, RegDate, PhoneNo, Date_Birth, SSFNo, NHIS, NAT, GangName,";
                 selectquery          += " TradegroupNAME, TradetypeNAME, Kin, Addr1, flags, ezwichid, Sex, Age from vwWorkerDetails where workerid = '" + workerid + "'";
                 adapter.SelectCommand = new SqlCommand(selectquery, connection);
                 try
                 {
                     connection.Open();
                     adapter.Fill(dTable);
                     RadListView2.DataSource = dTable;
                     RadListView2.DataBind();
                     ScriptManager.RegisterStartupScript(this, this.GetType(), "Pop", "showWorkerModal();", true);
                 }
                 catch (Exception ex)
                 {
                     ScriptManager.RegisterStartupScript(this, this.GetType(), "", "toastr.error('" + ex.Message + "', 'Error');", true);
                 }
             }
         }
     }
     else if (e.CommandName == "Edit")
     {
         GridDataItem item = e.Item as GridDataItem;
         Response.Redirect("/Workers/EditWorker.aspx?uId=" + item["WorkerID"].Text);
     }
     else if (e.CommandName == "Delete")
     {
         if (!User.IsInRole("Data Entry"))
         {
             ScriptManager.RegisterStartupScript(this, this.GetType(), "", "toastr.error('Sorry, you do not have the privilege to delete a worker. Please contact the System Administrator', 'Error');", true);
             return;
         }
         using (SqlConnection connection = new SqlConnection(connectionString))
         {
             using (SqlCommand command = new SqlCommand("spDeleteWorker", connection))
             {
                 command.CommandType = CommandType.StoredProcedure;
                 command.Parameters.Add("@DeletedBy", SqlDbType.VarChar).Value    = User.Identity.Name;
                 command.Parameters.Add("@return_value", SqlDbType.Int).Direction = ParameterDirection.ReturnValue;
                 try
                 {
                     connection.Open();
                     command.ExecuteNonQuery();
                     int retVal = Convert.ToInt16(command.Parameters["@return_value"].Value);
                     if (retVal == 0)
                     {
                         ScriptManager.RegisterStartupScript(this, this.GetType(), "", "toastr.success('Deleted Successfully', 'Success');", true);
                     }
                 }
                 catch (SqlException ex)
                 {
                     ScriptManager.RegisterStartupScript(this, this.GetType(), "", "toastr.error('" + ex.Message.Replace("'", "").Replace("\r\n", "") + "', 'Error');", true);
                 }
             }
         }
     }
 }
Beispiel #5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                DataTable dtbedehi = new DataTable();
                //double bedehi;
                //dtbedehi = GovahiBusiness.GetBedehkar(Session[sessionNames.userID_StudentOstad].ToString());
                //bedehi = Convert.ToDouble((dtbedehi.Rows[0]["bedehi"].ToString()));
                //DataTable dtReg = new DataTable();
                //dtReg = GovahiBusiness.GetStRegisterd(Session[sessionNames.userID_StudentOstad].ToString());
                //DataTable dtnaghs = new DataTable();
                ////dtnaghs = logBusiness.StHasNaghs(Session["user"].ToString());
                DataTable dt = new DataTable();
                dt = logBusiness.GetStIdVaz(Session[sessionNames.userID_StudentOstad].ToString());

                //if (bedehi > 0)
                //{

                //    rwm_Validations.RadAlert("به علت بدهی شما دسترسی ندارید", null, 100, "خطا", "CallBackConfirm2");

                //}
                // if (dtnaghs.Rows.Count > 0)
                //{

                //    rwm_Validations.RadAlert("به دلیل نقص پرونده شما دسترسی ندارید", null, 100, "خطا", "CallBackConfirm2");

                //}

                //if (dtReg.Rows.Count == 0)
                //{

                //    rwm_Validations.RadAlert("به دلیل عدم ثبت نام در ترم جاری شما دسترسی ندارید", null, 100, "خطا", "CallBackConfirm2");

                //}



                if (dt.Rows[0]["idvazkol"].ToString() == "7")
                {
                    rwm_Validations.RadAlert("فارغ التحصیلان به این بخش دسترسی ندارند", null, 100, "خطا", "CallBackConfirm2");
                }


                else
                {
                    lblstcode.Text          = Session[sessionNames.userID_StudentOstad].ToString();
                    RadListView2.DataSource = clsB.Show_Class_List(lblstcode.Text, ConfigurationManager.AppSettings["Term"].ToString());
                    RadListView2.DataBind();

                    foreach (RadListViewItem lvi in RadListView2.Items)
                    {
                        RadListView lstAsset  = (RadListView)lvi.FindControl("RadListView3");
                        Label       ClassCode = (Label)lvi.FindControl("ClassCode");
                        lstAsset.DataSource = assetB.Show_Asset_List_ByClassCode((ClassCode.Text), ConfigurationManager.AppSettings["Term"].ToString());
                        lstAsset.DataBind();
                        //var Merge = lvi.FindControl("Merge_code");
                        //if (Merge != null)
                        //    btn_Select.Visible = false;
                        if (RadListView2.Items.Count > 0)
                        {
                            btn_Select.Visible = true;
                        }
                    }

                    Session[sessionNames.userID_StudentOstad] = lblstcode.Text;
                }
            }
        }