Ejemplo n.º 1
0
        public void overlapsubject(string strAction)
        {
            try
            {
                BL_TimeTableCreation  objBl1  = new BL_TimeTableCreation();
                EWA_TimeTableCreation objEWA1 = new EWA_TimeTableCreation();
                objEWA1.Action = strAction;

                objEWA1.ClassId    = Convert.ToInt32(ddlClass.SelectedValue.ToString());
                objEWA1.DayId      = Convert.ToInt32(ddlDay.SelectedValue.ToString());
                objEWA1.TimeSlotId = Convert.ToInt32(ddlTimeSlot.SelectedValue.ToString());
                objEWA1.SubEmpId   = Convert.ToInt32(ddlEmployee.SelectedValue.ToString());
                objEWA1.LecNo      = Convert.ToInt32(txtlectureno.Text);
                if (strAction == "Update" || strAction == "Delete")
                {
                    objEWA1.TimeTableId = Convert.ToInt32(ViewState["TimeTableId"].ToString());
                }
                else
                {
                    objEWA1.TimeTableId = 0;
                }

                DataSet ds1 = objBl1.CheckTimeTable1(objEWA1);

                if ((ds1.Tables[0].Rows.Count <= 0 && strAction == "Save") || (strAction == "Update" && ds1.Tables[0].Rows.Count <= 0) || (strAction == "Update" && ds1.Tables[0].Rows[0][0].ToString() == objEWA1.TimeTableId.ToString()) || strAction == "Delete")
                {
                    //To check Date According to Current Date
                    DateTime CurrentDate      = DateTime.Now.Date;
                    int      CurrentStartYear = CurrentDate.Year;
                    DateTime CurrentEndYear   = CurrentDate.AddYears(1);
                    int      CurrentMonth     = CurrentDate.Month;

                    BL_TimeTableCreation  objBl  = new BL_TimeTableCreation();
                    EWA_TimeTableCreation objEWA = new EWA_TimeTableCreation();
                    objEWA.Action = strAction;

                    objEWA.ClassId    = Convert.ToInt32(ddlClass.SelectedValue.ToString());
                    objEWA.DayId      = Convert.ToInt32(ddlDay.SelectedValue.ToString());
                    objEWA.TimeSlotId = Convert.ToInt32(ddlTimeSlot.SelectedValue.ToString());
                    objEWA.LecNo      = Convert.ToInt32(txtlectureno.Text);
                    if (strAction == "Update" || strAction == "Delete")
                    {
                        objEWA.TimeTableId = Convert.ToInt32(ViewState["TimeTableId"].ToString());
                    }
                    else
                    {
                        objEWA.TimeTableId = 0;
                    }

                    objEWA.CourseId  = Convert.ToInt32(ddlCourse.SelectedValue.ToString());
                    objEWA.BranchId  = Convert.ToInt32(ddlBranch.SelectedValue.ToString());
                    objEWA.SubjectId = Convert.ToInt32(ddlSubject.SelectedValue.ToString());
                    objEWA.SubEmpId  = Convert.ToInt32(ddlEmployee.SelectedValue.ToString());
                    objEWA.LecNo     = Convert.ToInt32(txtlectureno.Text);
                    objEWA.OrgId     = orgId;
                    objEWA.UserId    = Session["UserCode"].ToString();
                    objEWA.IsActive  = "True";

                    //int flag = objBL.(objEWA);
                    int flag = objBl.TimeTableCreationAction_BL(objEWA);
                    if (flag > 0)
                    {
                        ClearCntrl();
                        DisableCntrl();
                        BindTimeTable();
                        if (strAction == "Save")
                        {
                            msgBox.ShowMessage("Overlap Record Saved Successfully !!!", "Saved", UserControls.MessageBox.MessageStyle.Successfull);
                        }
                        else if (strAction == "Update")
                        {
                            msgBox.ShowMessage("Overlap Record Updated Successfully !!!", "Updated", UserControls.MessageBox.MessageStyle.Successfull);
                        }
                        else if (strAction == "Delete")
                        {
                            msgBox.ShowMessage("Overlap Record Deleted Successfully !!!", "Deleted", UserControls.MessageBox.MessageStyle.Successfull);
                        }
                    }
                    else
                    {
                        if (strAction == "Save")
                        {
                            msgBox.ShowMessage("Unable to  Save !!!", "Critical", UserControls.MessageBox.MessageStyle.Critical);
                        }
                        else if (strAction == "Update")
                        {
                            msgBox.ShowMessage("Unable to  Update !!!", "Critical", UserControls.MessageBox.MessageStyle.Critical);
                        }
                        else if (strAction == "Delete")
                        {
                            msgBox.ShowMessage("Unable to  Delete !!!", "Critical", UserControls.MessageBox.MessageStyle.Critical);
                        }
                    }
                }
                else
                {
                    MessagePopUp1.Show();

                    //msgBox.ShowMessage("Already Created !!!", "Critical", UserControls.MessageBox.MessageStyle.Critical);
                    //DialogResult res = MessageBox.Show("Employee Overlap! Are You OK with Employee Overlap?", "Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Information);
                    //if (res == DialogResult.Yes)
                    //{
                    //    overlapEmployee(strAction);
                    //}
                    //if (res == DialogResult.No)
                    //{

                    //}
                }
            }
            catch (Exception ex)
            {
            }
        }
Ejemplo n.º 2
0
        //General message
        #region [General Message]

        private void Action(string strAction)
        {
            try
            {
                BL_TimeTableCreation  objBl1  = new BL_TimeTableCreation();
                EWA_TimeTableCreation objEWA1 = new EWA_TimeTableCreation();
                objEWA1.Action       = strAction;
                Session["strAction"] = strAction;

                objEWA1.ClassId    = Convert.ToInt32(ddlClass.SelectedValue.ToString());
                objEWA1.DayId      = Convert.ToInt32(ddlDay.SelectedValue.ToString());
                objEWA1.TimeSlotId = Convert.ToInt32(ddlTimeSlot.SelectedValue.ToString());
                objEWA1.SubEmpId   = Convert.ToInt32(ddlEmployee.SelectedValue.ToString());
                objEWA1.LecNo      = Convert.ToInt32(txtlectureno.Text);

                if (strAction == "Update" || strAction == "Delete")
                {
                    objEWA1.TimeTableId = Convert.ToInt32(ViewState["TimeTableId"].ToString());
                }
                else
                {
                    objEWA1.TimeTableId = 0;
                }

                DataSet ds = objBl1.CheckTimeTable(objEWA1);

                if ((ds.Tables[0].Rows.Count <= 0 && strAction == "Save") || (strAction == "Update" && ds.Tables[0].Rows.Count <= 0) || (strAction == "Update" && ds.Tables[0].Rows[0][0].ToString() == objEWA1.TimeTableId.ToString()) || strAction == "Delete")
                {
                    BL_TimeTableCreation  objBl2   = new BL_TimeTableCreation();
                    EWA_TimeTableCreation objEWA2  = new EWA_TimeTableCreation();
                    BL_TimeTableCreation  objBl22  = new BL_TimeTableCreation();
                    EWA_TimeTableCreation objEWA22 = new EWA_TimeTableCreation();

                    objEWA22.ClassId    = Convert.ToInt32(ddlClass.SelectedValue.ToString());
                    objEWA22.DayId      = Convert.ToInt32(ddlDay.SelectedValue.ToString());
                    objEWA22.TimeSlotId = Convert.ToInt32(ddlTimeSlot.SelectedValue.ToString());
                    objEWA22.SubEmpId   = Convert.ToInt32(ddlEmployee.SelectedValue.ToString());
                    objEWA2.LecNo       = Convert.ToInt32(txtlectureno.Text);
                    DataSet dss = objBl22.Employeetest(objEWA22);
                    if (dss.Tables[0].Rows.Count > 0)
                    {
                        msgBox.ShowMessage("Already lecture assigned to teacher for that day", "Saved", UserControls.MessageBox.MessageStyle.Critical);
                    }

                    objEWA2.ClassId    = Convert.ToInt32(ddlClass.SelectedValue.ToString());
                    objEWA2.DayId      = Convert.ToInt32(ddlDay.SelectedValue.ToString());
                    objEWA2.TimeSlotId = Convert.ToInt32(ddlTimeSlot.SelectedValue.ToString());
                    objEWA2.SubEmpId   = Convert.ToInt32(ddlEmployee.SelectedValue.ToString());
                    objEWA2.LecNo      = Convert.ToInt32(txtlectureno.Text);

                    if (strAction == "Update" || strAction == "Delete")
                    {
                        objEWA2.TimeTableId = Convert.ToInt32(ViewState["TimeTableId"].ToString());
                    }
                    else
                    {
                        objEWA2.TimeTableId = 0;
                    }

                    DataSet ds1 = objBl2.CheckTimeTable1(objEWA2);

                    if ((ds1.Tables[0].Rows.Count <= 0 && strAction == "Save") || (strAction == "Update" && ds1.Tables[0].Rows.Count <= 0) || (strAction == "Update" && ds1.Tables[0].Rows[0][0].ToString() == objEWA1.TimeTableId.ToString()) || strAction == "Delete")
                    {
                        //To check Date According to Current Date
                        DateTime CurrentDate      = DateTime.Now.Date;
                        int      CurrentStartYear = CurrentDate.Year;
                        DateTime CurrentEndYear   = CurrentDate.AddYears(1);
                        int      CurrentMonth     = CurrentDate.Month;

                        BL_TimeTableCreation  objBl  = new BL_TimeTableCreation();
                        EWA_TimeTableCreation objEWA = new EWA_TimeTableCreation();
                        objEWA.Action = strAction;

                        objEWA.ClassId    = Convert.ToInt32(ddlClass.SelectedValue.ToString());
                        objEWA.DayId      = Convert.ToInt32(ddlDay.SelectedValue.ToString());
                        objEWA.TimeSlotId = Convert.ToInt32(ddlTimeSlot.SelectedValue.ToString());
                        objEWA.LecNo      = Convert.ToInt32(txtlectureno.Text);
                        if (strAction == "Update" || strAction == "Delete")
                        {
                            objEWA.TimeTableId = Convert.ToInt32(ViewState["TimeTableId"].ToString());
                        }
                        else
                        {
                            objEWA.TimeTableId = 0;
                        }

                        objEWA.CourseId  = Convert.ToInt32(ddlCourse.SelectedValue.ToString());
                        objEWA.BranchId  = Convert.ToInt32(ddlBranch.SelectedValue.ToString());
                        objEWA.SubjectId = Convert.ToInt32(ddlSubject.SelectedValue.ToString());
                        objEWA.SubEmpId  = Convert.ToInt32(ddlEmployee.SelectedValue.ToString());
                        objEWA.OrgId     = orgId;
                        objEWA.UserId    = Session["UserCode"].ToString();
                        objEWA.IsActive  = "True";
                        objEWA.LecNo     = Convert.ToInt32(txtlectureno.Text);
                        //int flag = objBL.(objEWA);
                        int flag = objBl.TimeTableCreationAction_BL(objEWA);
                        if (flag > 0 && flag != 2)
                        {
                            ClearCntrl();
                            DisableCntrl();
                            BindTimeTable();
                            if (strAction == "Save")
                            {
                                msgBox.ShowMessage("Record Saved Successfully !!!", "Saved", UserControls.MessageBox.MessageStyle.Successfull);
                            }
                            else if (strAction == "Update")
                            {
                                msgBox.ShowMessage("Record Updated Successfully !!!", "Updated", UserControls.MessageBox.MessageStyle.Successfull);
                            }
                            else if (strAction == "Delete")
                            {
                                msgBox.ShowMessage("Record Deleted Successfully !!!", "Deleted", UserControls.MessageBox.MessageStyle.Successfull);
                            }
                        }

                        else if (flag > 0 && flag == 2)
                        {
                            if (strAction == "Save")
                            {
                                msgBox.ShowMessage("Sorry For that day Lecture NO Already Used!!!", "Saved", UserControls.MessageBox.MessageStyle.Critical);
                            }
                            else if (strAction == "Update")
                            {
                                msgBox.ShowMessage("Sorry For that day Lecture NO Already Used !!!", "Updated", UserControls.MessageBox.MessageStyle.Critical);
                            }
                        }
                        else
                        {
                            if (strAction == "Save")
                            {
                                msgBox.ShowMessage("Unable to  Save !!!", "Critical", UserControls.MessageBox.MessageStyle.Critical);
                            }
                            else if (strAction == "Update")
                            {
                                msgBox.ShowMessage("Unable to  Update !!!", "Critical", UserControls.MessageBox.MessageStyle.Critical);
                            }
                            else if (strAction == "Delete")
                            {
                                msgBox.ShowMessage("Unable to  Delete !!!", "Critical", UserControls.MessageBox.MessageStyle.Critical);
                            }
                        }
                    }
                    else
                    {
                        MessagePopUp1.Show();

                        //msgBox.ShowMessage("Already Created !!!", "Critical", UserControls.MessageBox.MessageStyle.Critical);
                        //DialogResult res = MessageBox.Show("Employee Overlap! Are You OK with Employee Overlap?", "Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Information);
                        //if (res == DialogResult.Yes)
                        //{

                        //    overlapEmployee(strAction);
                        //}
                        //if (res == DialogResult.No)
                        //{


                        //}
                    }
                }
                else
                {
                    //string message = "Your request is being processed.";
                    //System.Text.StringBuilder sb = new System.Text.StringBuilder();
                    //sb.Append("alert('");
                    //sb.Append(message);
                    //sb.Append("');");
                    //ClientScript.RegisterOnSubmitStatement(this.GetType(), "alert", sb.ToString());

                    MessagePopUp.Show();

                    //DialogResult res = MessageBox.Show("Subject Overlap! Are You OK with Subject Overlap?", "Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Information);
                    //if (res == DialogResult.Yes)
                    //{
                    //    //MessageBox.Show("You have clicked Ok Button");
                    //    overlapsubject(strAction);
                    //}
                    //if (res == DialogResult.No)
                    //{
                    //    //MessageBox.Show("You have clicked Cancel Button");

                    //}
                }
            }
            catch (Exception exp)
            {
                GeneralErr(exp.Message.ToString());
            }
        }