예제 #1
0
        //Student Bind
        #region [Student Bind]

        public DataSet StudentBind_DL(EWA_UploadDocument ObjEWA)
        {
            try
            {
                prmList    = new string[12];
                prmList[0] = "@Action";
                prmList[1] = ObjEWA.Action;
                prmList[2] = "@OrgId";
                prmList[3] = ObjEWA.OrgId;
                prmList[4] = "@CourseId";
                prmList[5] = ObjEWA.CourseId;
                prmList[6] = "@BranchId";
                prmList[7] = ObjEWA.BranchId;
                prmList[8] = "@ClassId";
                prmList[9] = ObjEWA.ClassId;
                prmList[8] = "@DivisionId";
                prmList[9] = ObjEWA.DivisionId;

                ds = ObjHelper.FillControl(prmList, "SP_UploadDocument");
                if (ds.Tables[0].Rows.Count > 0)
                {
                    return(ds);
                }
                return(ds);
            }
            catch (Exception)
            {
                throw;
            }
        }
예제 #2
0
        public DataSet BindUploadDocument_DL(EWA_UploadDocument ObjEWA)
        {
            try
            {
                prmList = new string[4];
                // prmList[0] = "@Action";
                // prmList[1] = ObjEWA.Action;
                prmList[0] = "@StudentId";
                prmList[1] = ObjEWA.StudentId;
                prmList[2] = "@UploadPurpose";
                prmList[3] = ObjEWA.UploadPurpose.ToString();


                ds = ObjHelper.FillControl(prmList, "SP_UploadDocument11");
                if (ds.Tables[0].Rows.Count > 0)
                {
                    return(ds);
                }
                return(ds);
            }
            catch (Exception)
            {
                throw;
            }
        }
 public void DeleteUploadDocument_BL(EWA_UploadDocument ObjEWA)
 {
     try
     {
         DL_UploadDocument ObjDL = new DL_UploadDocument();
         ObjDL.DeleteUploadDocument_DL(ObjEWA);
     }
     catch (Exception ex)
     {
     }
 }
예제 #4
0
        //Upload Documnet
        #region [Upload Document]

        public int UploadDocument_DL(EWA_UploadDocument ObjEWA)
        {
            DataSet dss  = new DataSet();
            int     flag = 0;

            try
            {
                cmd             = new SqlCommand("SP_UploadDocument", con);
                cmd.CommandType = CommandType.StoredProcedure;

                cmd.Parameters.AddWithValue("@Action", ObjEWA.Action);
                cmd.Parameters.AddWithValue("@OrgId", ObjEWA.OrgId);
                cmd.Parameters.AddWithValue("@UserCode", ObjEWA.FacultyId);
                cmd.Parameters.AddWithValue("@CourseId", ObjEWA.CourseId);
                cmd.Parameters.AddWithValue("@BranchId", ObjEWA.BranchId);
                cmd.Parameters.AddWithValue("@ClassId", ObjEWA.ClassId);
                cmd.Parameters.AddWithValue("@Subject", ObjEWA.Subject);
                cmd.Parameters.AddWithValue("@MessageContent", ObjEWA.MessageContent);
                cmd.Parameters.AddWithValue("@ContentType", ObjEWA.ContentType);
                cmd.Parameters.AddWithValue("@FileName", ObjEWA.FileName);
                cmd.Parameters.AddWithValue("@Data", ObjEWA.Data);
                cmd.Parameters.AddWithValue("@UploadPurpose", ObjEWA.UploadPurpose);
                //cmd.Parameters.AddWithValue("@DivisionId", ObjEWA.DivisionId);
                cmd.Parameters.AddWithValue("@StudentDataTable", ObjEWA.StudentDataTable);

                con.Open();
                SqlDataAdapter ad = new SqlDataAdapter(cmd);
                ad.Fill(dss);
                con.Close();


                if (dss.Tables[0].Rows.Count > 0)
                {
                    int i = 0;
                    while (dss.Tables[0].Rows.Count > i)
                    {
                        if (dss.Tables[0].Rows[i]["TokenId"].ToString() != "" && dss.Tables[0].Rows[i]["TokenId"].ToString() != "null" && dss.Tables[1].Rows[0]["SenderId"].ToString() != "")
                        {
                            SendPushNotification(dss.Tables[0].Rows[i]["TokenId"].ToString(), dss.Tables[0].Rows[i]["Subject"].ToString(), dss.Tables[0].Rows[i]["OrgName"].ToString(), dss.Tables[1].Rows[0]["SenderId"].ToString(), dss.Tables[1].Rows[0]["AppKey"].ToString());
                        }
                        i++;
                    }
                }

                return(1);
            }
            catch (Exception)
            {
                throw;
            }
        }
        //Upload Document
        #region [Upload Document]

        public int UploadDocument_BL(EWA_UploadDocument ObjEWA)
        {
            try
            {
                int flag;
                DL_UploadDocument ObjDL = new DL_UploadDocument();
                flag = ObjDL.UploadDocument_DL(ObjEWA);
                return(flag);
            }
            catch (Exception)
            {
                throw;
            }
        }
        //Student Bind Data
        #region [Student Bind Data]

        public DataSet StudentBind_BL(EWA_UploadDocument ObjEWA)
        {
            try
            {
                DataSet           ds    = null;
                DL_UploadDocument ObjDL = new DL_UploadDocument();
                ds = ObjDL.StudentBind_DL(ObjEWA);
                return(ds);
            }
            catch (Exception)
            {
                throw;
            }
        }
        public DataSet BindUploadDocument_BL(EWA_UploadDocument ObjEWA)
        {
            DataSet ds = null;

            try
            {
                DL_UploadDocument ObjDL = new DL_UploadDocument();
                ds = ObjDL.BindUploadDocument_DL(ObjEWA);
                return(ds);
            }
            catch (Exception)
            {
                throw;
            }
            // return ds;
        }
        protected void GrdUploadDocument_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            try
            {
                string[] confirmValue = Request.Form["confirm_value"].Split(',');
                if (confirmValue[confirmValue.Length - 1] == "Yes")
                {
                    EWA_UploadDocument ObjEWA = new EWA_UploadDocument();
                    BL_UploadDocument  ObjBL  = new BL_UploadDocument();

                    ObjEWA.Action             = "DeleteUploadDocument";
                    ObjEWA.UploadDocReceiptId = GrdUploadDocument.DataKeys[e.RowIndex].Values["UploadDocReceiptId"].ToString();
                    ObjBL.DeleteUploadDocument_BL(ObjEWA);
                    BindGridView();
                }
            }
            catch (Exception ex)
            {
            }
        }
예제 #9
0
        public void DeleteUploadDocument_DL(EWA_UploadDocument ObjEWA)
        {
            int flag;

            try
            {
                cmd             = new SqlCommand("SP_UploadDocument", con);
                cmd.CommandType = CommandType.StoredProcedure;

                cmd.Parameters.AddWithValue("@Action", ObjEWA.Action);
                cmd.Parameters.AddWithValue("@UploadDocReceiptId", ObjEWA.UploadDocReceiptId);
                con.Open();
                flag = cmd.ExecuteNonQuery();
                con.Close();
            }
            catch (Exception ex)
            {
                throw;
            }
        }
        //Send
        protected void btnSend_Click(object sender, EventArgs e)
        {
            try
            {
                EWA_UploadDocument ObjEWA = new EWA_UploadDocument();
                BL_UploadDocument  ObjBL  = new BL_UploadDocument();

                ObjEWA.Action   = "FetchStudent";
                ObjEWA.OrgId    = Session["OrgId"].ToString();
                ObjEWA.CourseId = ddlCourse.SelectedValue.ToString();
                ObjEWA.BranchId = ddlBranch.SelectedValue.ToString();
                ObjEWA.ClassId  = ddlClass.SelectedValue.ToString();
                //ObjEWA.DivisionId = ddlDivision.SelectedValue.ToString();
                SqlCommand cmd1 = new SqlCommand("	SELECT s.UserCode as 'StudentId' FROM tblStudent s where s.CourseId='"+ ddlCourse.SelectedValue.ToString() + "' and s.ClassId='" + ddlClass.SelectedValue.ToString() +
                                                 "' and s.BranchId='" + ddlBranch.SelectedValue.ToString() + "' and OrgId='" + Session["OrgId"].ToString() + "'", cn);
                SqlDataAdapter adp1 = new SqlDataAdapter();
                DataSet        ds1  = new DataSet();
                adp1.SelectCommand = cmd1;
                adp1.Fill(ds1);
                //       DataSet ds = ObjBL.StudentBind_BL(ObjEWA);
                if (ds1 == null)
                {
                    return;
                }
                ObjEWA.StudentDataTable = ds1.Tables[0];
                ObjEWA.Action           = "SaveUploadDocument";
                ObjEWA.FacultyId        = Session["UserCode"].ToString();
                ObjEWA.MessageContent   = txtMessage.Text;
                ObjEWA.UploadPurpose    = Convert.ToInt32(rbtnPurpose.SelectedValue);

                if (rbtnPurpose.SelectedItem.Text.Equals("Home Work/Assignment"))
                {
                    ObjEWA.Subject = DDSubject.SelectedValue.ToString();
                }
                else
                {
                    ObjEWA.Subject = txtSubject.Text;
                }
                int fileLengthInKB = 0;
                if (flpUploadFile.HasFile)
                {
                    int length = flpUploadFile.PostedFile.ContentLength;
                    ObjEWA.Data        = new byte[length];
                    ObjEWA.FileName    = flpUploadFile.PostedFile.FileName.ToString();
                    ObjEWA.ContentType = flpUploadFile.PostedFile.ContentType;
                    fileLengthInKB     = flpUploadFile.PostedFile.ContentLength / 1024;
                    HttpPostedFile file = flpUploadFile.PostedFile;
                    file.InputStream.Read(ObjEWA.Data, 0, length);
                }
                else
                {
                    ObjEWA.Data        = null;
                    ObjEWA.FileName    = "";
                    ObjEWA.ContentType = "";
                }
                if (fileLengthInKB > 1024)
                {
                    msgBox.ShowMessage("Document should be less than or equal to 1MB !!!", "Information", UserControls.MessageBox.MessageStyle.Successfull);
                }
                else
                {
                    int flag = ObjBL.UploadDocument_BL(ObjEWA);
                    msgBox.ShowMessage("Document Upload Successfully !!!", "Saved", UserControls.MessageBox.MessageStyle.Successfull);
                    clear();
                }
            }
            catch (Exception ex)
            {
                msgBox.ShowMessage("Unable to Save !!!", "Saved", UserControls.MessageBox.MessageStyle.Successfull);
            }
        }