public static void DeleteCustomer(string ScholarNo)
        {
            string Schoolid = HttpContext.Current.Session["SchoolId"].ToString();

            clsStudentDetail clsStdDetail = new clsStudentDetail();

            PR_StudentDetail oldStdData = new PR_StudentDetail();

            oldStdData.SchoolUID = Schoolid;

            oldStdData.ScholarNo = ScholarNo;
            string retCode = clsStdDetail.DeleteStudetDetail(oldStdData);
        }
        public static string InsertCustomer(string ScholarNo, string F1, string StudentName, string FatherName, string DateofBarth, string Class, string PhoneNumber, string Addres)
        {
            string           Schoolid = HttpContext.Current.Session["SchoolId"].ToString();
            clsStudentDetail stdCls   = new clsStudentDetail();

            if (!string.IsNullOrWhiteSpace(ScholarNo))
            {
                PR_StudentDetail oStdData = new PR_StudentDetail();
                oStdData.SchoolUID    = Schoolid;
                oStdData.ScholarNo    = ScholarNo;
                oStdData.StudentName  = StudentName;
                oStdData.FatherName   = FatherName;
                oStdData.MotherName   = "";
                oStdData.BloodGroup   = "";
                oStdData.DateofBarth  = DateofBarth;
                oStdData.EmailId      = "";
                oStdData.PhoneNumber  = PhoneNumber;
                oStdData.Addres       = Addres;
                oStdData.LastUpdated  = DateTime.Now;
                oStdData.Status       = 0;
                oStdData.IsActive     = 1;
                oStdData.Class        = Class;
                oStdData.F1           = F1;
                oStdData.StudentPhoto = "";

                string retCode = stdCls.InsertStudetDetail(oStdData);
                if (retCode != "1")
                {
                    retCode = retCode + "There are some error contact to admin !!";
                    return(retCode);
                }
                else
                {
                    retCode = "Data Inserted Sucess  ";
                    return(ScholarNo);
                }
            }
            else
            {
                return(ScholarNo);
            }
        }
Пример #3
0
        protected void InsertOrUpdateProfile()
        {
            string Schoolid = Session["SchoolId"].ToString();
            var    stdData  = stdCls.GetStudentDetail(Schoolid, txtScholarNo.Text);

            //    isAvelabal = stdData.Count();
            try
            {
                PR_StudentDetail oStdData = new PR_StudentDetail();
                oStdData.SchoolUID   = Schoolid;
                oStdData.ScholarNo   = txtScholarNo.Text;
                oStdData.StudentName = txtstdName.Text;
                oStdData.FatherName  = txtFName.Text;
                oStdData.MotherName  = txtMName.Text;
                oStdData.BloodGroup  = txtBloodGroup.Text;
                oStdData.DateofBarth = txtDOB.Text;
                oStdData.EmailId     = txtEmail.Text;
                oStdData.PhoneNumber = txtPhno.Text;
                oStdData.Addres      = txtAddress.Text;
                oStdData.LastUpdated = DateTime.Now;
                oStdData.Status      = 0;
                oStdData.IsActive    = 1;
                oStdData.Class       = ddlClass.SelectedItem.Text;
                oStdData.F1          = ddltital.SelectedValue.ToString();

                oStdData.F2 = txtOther1.Text;
                oStdData.F3 = txtOther2.Text;
                oStdData.F4 = txtOther3.Text;

                //create Folder
                string directoryPath = Server.MapPath(string.Format("~/StdPhoto/{0}/", Schoolid.Trim()));
                if (!Directory.Exists(directoryPath))
                {
                    Directory.CreateDirectory(directoryPath);
                }



                //Save File in DB
                if (uploadStudentPhoto.FileName != "")
                {
                    oStdData.StudentPhoto = "StdPhoto/" + Schoolid.Trim() + "/" + oStdData.ScholarNo.Trim() + ".jpg";
                }
                else
                {
                    oStdData.StudentPhoto = imgStudentPhoto.ImageUrl.ToString();
                }

                //Save file in Folder
                if (uploadStudentPhoto.FileName != "")
                {
                    string extension = Path.GetExtension(uploadStudentPhoto.PostedFile.FileName);
                    uploadStudentPhoto.SaveAs(Request.PhysicalApplicationPath + @"StdPhoto\" + Schoolid.Trim() + "\\" + oStdData.ScholarNo.Trim() + extension);

                    //  uploadStudentPhoto.PostedFile.SaveAs(Request.PhysicalApplicationPath + @"StdPhoto\" + Schoolid.Trim() + "\\" + uploadStudentPhoto.FileName);
                }



                if (stdData.Count() == 0)  //Insert
                {
                    string retCode = stdCls.InsertStudetDetail(oStdData);
                    if (retCode != "1")
                    {
                        divsucrss.Style.Add("display", "none");
                        divUnsucrss.Style.Remove("display");
                        ltrNotSucess.Text = retCode + "There are some error contact to admin !!";
                    }
                    else
                    {
                        divUnsucrss.Style.Add("display", "none");
                        divsucrss.Style.Remove("display");
                        ltrSucess.Text = "Data Inserted Sucess  ";
                    }
                }
                else //Update
                {
                    try { oStdData.ScholarNo_Old = Session["Scro_Num_old"].ToString(); }
                    catch { oStdData.ScholarNo_Old = txtScholarNo.Text; }

                    string retCode = stdCls.UpdateStudetDetail(oStdData);
                    if (retCode != "1")
                    {
                        divsucrss.Style.Add("display", "none");
                        divUnsucrss.Style.Remove("display");
                        ltrNotSucess.Text = retCode + "There are some error contact to admin !!";
                    }
                    else
                    {
                        Response.Redirect("StudentDetailByPhotoDelete.aspx");
                        //divUnsucrss.Style.Add("display", "none");
                        //divsucrss.Style.Remove("display");
                        //ltrSucess.Text = "Data Updated Sucess  ";
                    }
                }
                clearData();
            }
            catch (Exception e)
            {
                divsucrss.Style.Add("display", "none");
                divUnsucrss.Style.Remove("display");
                ltrNotSucess.Text = e.Message + "     There are some error contact to admin !!";
                return;
            }
        }