Пример #1
0
        protected void btnUpload1_Click(object sender, EventArgs e)
        {
            Session.Add("FullChapati", txtChapati.Text);
            Session.Add("FullSabji", txtSabji.Text);
            Session.Add("FullRice", rblRice.SelectedValue);
            Session.Add("FullDal", rblDal.SelectedValue);
            Session.Add("FullSalad", rblSalad.SelectedValue);
            Session.Add("FullMonthlyprice", txtMonthlyPrice1.Text);
            Session.Add("HalfChapati", txtChapati1.Text);
            Session.Add("Halfsabji", txtSabji1.Text);
            Session.Add("HalfRice", rblRice1.SelectedValue);
            Session.Add("HalfDal", rblDal1.SelectedValue);
            Session.Add("HalfSalad", rblSalad1.SelectedValue);
            Session.Add("HalfMonthlyprice", txtMonthlyPrice2.Text);
            int n = SqlUploadMess1.Insert();

            if (n == 1)
            {
                DataView dv = (DataView)SqlUploadMess.Select(new DataSourceSelectArguments());
                if (dv.Count == 1)
                {
                    m = (int)dv[0][0];
                    hfMessId.Value           = Convert.ToString(m);
                    PanelUploadMess3.Visible = true;
                    PanelUploadMess2.Visible = false;
                }
            }
        }
Пример #2
0
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            Session.Add("MessLocation", txtMessLocation.Text);
            Session.Add("NearestLocation", ddlNearestLocation.SelectedValue);
            Session.Add("State", ddlState.SelectedValue);
            Session.Add("City", ddlCity.SelectedValue);
            Session.Add("MonthlyPrice", txtMonthlyPrice.Text);
            Session.Add("MessType", rblMessType.SelectedValue);
            Session.Add("TiffinFacility", rblTiffinFacility.SelectedValue);
            Session.Add("ContactNo1", txtContactNo1.Text);
            Session.Add("ContactNo2", txtContactNo2.Text);
            String Name  = (String)Session["UserId"];
            String path  = Server.MapPath("~/images/Mess");
            String upath = path + "\\" + Name;
            String img1path;
            String img2path;

            if (fuUploadPhoto1.HasFile == true)
            {
                if (Directory.Exists(upath))
                {
                    img1path = upath + "\\" + fuUploadPhoto1.FileName;
                }
                else
                {
                    Directory.CreateDirectory(upath);
                    img1path = upath + "\\" + fuUploadPhoto1.FileName;
                }
                Stream strm1      = fuUploadPhoto1.PostedFile.InputStream;
                var    targetFile = img1path;
                //Based on scalefactor image size will vary
                GenerateThumbnails(0.5, strm1, targetFile);
                hfUploadPhoto1.Value = "~/images/Mess/" + Name + "\\" + fuUploadPhoto1.FileName;
            }
            else
            {
                hfUploadPhoto1.Value = null;
            }
            if (fuUploadPhoto2.HasFile == true)
            {
                if (Directory.Exists(upath))
                {
                    img2path = upath + "\\" + fuUploadPhoto2.FileName;
                }
                else
                {
                    Directory.CreateDirectory(upath);
                    img2path = upath + "\\" + fuUploadPhoto2.FileName;
                }
                Stream strm2      = fuUploadPhoto2.PostedFile.InputStream;
                var    targetFile = img2path;
                //Based on scalefactor image size will vary
                GenerateThumbnails(0.5, strm2, targetFile);
                hfUploadPhoto2.Value = "~/images/Mess/" + Name + "\\" + fuUploadPhoto2.FileName;
            }
            else
            {
                hfUploadPhoto2.Value = null;
            }
            Session.Add("UploadPhoto1", hfUploadPhoto1.Value);
            Session.Add("UploadPhoto2", hfUploadPhoto2.Value);
            Session.Add("Counter", hfCounter.Value);
            Session.Add("Disable", hfDisable.Value);
            Session.Add("Scheme", rblScheme.SelectedValue);
            if (rblTiffinFacility.SelectedValue.Equals("Yes"))
            {
                PanelUploadMess2.Visible = true;
                PanelUploadMess1.Visible = false;
            }
            else
            {
                int n = SqlUploadMess.Insert();
                if (n == 1)
                {
                    DataView dv = (DataView)SqlUploadMess.Select(new DataSourceSelectArguments());
                    if (dv.Count == 1)
                    {
                        m = (int)dv[0][0];
                        hfMessId.Value           = Convert.ToString(m);
                        PanelUploadMess3.Visible = true;
                        PanelUploadMess1.Visible = false;
                    }
                }
            }
        }