Example #1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (IsPostBack != true)
     {
         GradingFactorGroupBLL        obj  = new GradingFactorGroupBLL();
         List <GradingFactorGroupBLL> list = obj.GetActive();
         foreach (GradingFactorGroupBLL o in list)
         {
             this.cboGradingFactorName.Items.Add(new ListItem(o.GradingFactorGroupName, o.Id.ToString()));
         }
     }
 }
Example #2
0
        public static bool Save(GradingFactorGroupBLL obj, SqlTransaction tran)
        {
            int Affectedrow = -1;

            string strsql = "spInsertGradingFactorGroup";

            SqlParameter[] arPar = new SqlParameter[5];
            try
            {
                arPar[0]       = new SqlParameter("@Id", SqlDbType.UniqueIdentifier);
                arPar[0].Value = obj.Id;

                arPar[1]       = new SqlParameter("@GradingFactorGroupName", SqlDbType.NVarChar, 250);
                arPar[1].Value = obj.GradingFactorGroupName;

                arPar[2]       = new SqlParameter("@Description", SqlDbType.NVarChar);
                arPar[2].Value = obj.Description;


                arPar[3]       = new SqlParameter("@Status", SqlDbType.Int);
                arPar[3].Value = (int)obj.Status;



                arPar[4]       = new SqlParameter("@CreatedBy", SqlDbType.UniqueIdentifier);
                arPar[4].Value = UserBLL.GetCurrentUser();


                Affectedrow = SqlHelper.ExecuteNonQuery(tran, CommandType.StoredProcedure, strsql, arPar);

                if (Affectedrow == 1)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Example #3
0
        public static List <GradingFactorGroupBLL> GetActive()
        {
            string        strSql = "spGetActiveGradingFactorGroup";
            SqlConnection conn   = new SqlConnection();
            List <GradingFactorGroupBLL> list;

            try
            {
                SqlDataReader reader;
                conn   = Connection.getConnection();
                reader = SqlHelper.ExecuteReader(conn, CommandType.StoredProcedure, strSql);
                if (reader != null)
                {
                    if (reader.HasRows)
                    {
                        list = new List <GradingFactorGroupBLL>();
                        while (reader.Read())
                        {
                            GradingFactorGroupBLL obj = new GradingFactorGroupBLL();
                            if (reader["Id"] != DBNull.Value)
                            {
                                obj.Id = new Guid(reader["Id"].ToString());
                            }
                            if (reader["GradingFactorGroupName"] != DBNull.Value)
                            {
                                obj.GradingFactorGroupName = reader["GradingFactorGroupName"].ToString();
                            }
                            if (reader["Description"] != DBNull.Value)
                            {
                                obj.Description = reader["Description"].ToString();
                            }
                            if (reader["Status"] != DBNull.Value)
                            {
                                obj.Status = (GradingFactorGroupStatus)int.Parse(reader["Status"].ToString());
                            }
                            if (reader["CreatedBy"] != DBNull.Value)
                            {
                                obj.CreatedBy = new Guid(reader["CreatedBy"].ToString());
                            }
                            if (reader["CreatedTimestamp"] != DBNull.Value)
                            {
                                obj.CreatedTimestamp = DateTime.Parse(reader["CreatedTimestamp"].ToString());
                            }
                            if (reader["LastModifiedBy"] != DBNull.Value)
                            {
                                obj.LastModifiedBy = new Guid(reader["LastModifiedBy"].ToString());
                            }
                            if (reader["LastModifiedTimestamp"] != DBNull.Value)
                            {
                                obj.LastModifiedTimestamp = DateTime.Parse(reader["LastModifiedTimestamp"].ToString());
                            }



                            list.Add(obj);
                        }
                        return(list);
                    }
                }
                else
                {
                    return(null);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                if (conn.State == ConnectionState.Open)
                {
                    conn.Close();
                }
            }
            return(null);
        }
Example #4
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            GradingFactorGroupBLL objGFG = new GradingFactorGroupBLL();

            objGFG.Id = Guid.NewGuid();
            if (this.txtGradingFactorName.Text == "")
            {
                this.lblMessage.Text = "Please enter Grading factor Group Name.";
                return;
            }
            else
            {
                objGFG.GradingFactorGroupName = txtGradingFactorName.Text;
            }
            if (cboStatus.SelectedValue == "")
            {
                this.lblMessage.Text = "Please Select Status.";
                return;
            }
            else
            {
                objGFG.Status = (GradingFactorGroupStatus)(int.Parse(cboStatus.SelectedValue.ToString()));
            }



            List <GradingFactorGroupDetailBLL> list = null;

            list = new List <GradingFactorGroupDetailBLL>();
            foreach (GridViewRow rw in this.gvGF.Rows)
            {
                //get the contorls
                CheckBox chkSelected = (CheckBox)rw.FindControl("chkSelected");
                if (chkSelected.Checked == true)
                {
                    Label        lblGradingFactorId = (Label)rw.FindControl("lblId");
                    Label        lblGradingTypeId   = (Label)rw.FindControl("lblGradingTypeId");
                    TextBox      txtMaxValue        = (TextBox)rw.FindControl("txtMaxValue");
                    TextBox      txtMinValue        = (TextBox)rw.FindControl("txtMinValue");
                    TextBox      txtFailPoint       = (TextBox)rw.FindControl("txtFailPoint");
                    DropDownList cboIsMax           = (DropDownList)rw.FindControl("cboIsMax");
                    CheckBox     chkInTotalValue    = (CheckBox)rw.FindControl("chkInTotalValue");

                    GradingFactorGroupDetailBLL o = new GradingFactorGroupDetailBLL();
                    o.Id = Guid.NewGuid();
                    o.GradingFactorId = new Guid(lblGradingFactorId.Text);
                    o.GradingTypeId   = new Guid(lblGradingTypeId.Text);
                    try
                    {
                        o.MaximumValue = float.Parse(txtMaxValue.Text);
                    }
                    catch
                    {
                        o.MaximumValue = null;
                    }
                    try
                    {
                        o.MinimumValue = float.Parse(txtMinValue.Text);
                    }
                    catch
                    {
                        o.MinimumValue = null;
                    }
                    o.FailPoint      = txtFailPoint.Text;
                    o.isMax          = int.Parse(cboIsMax.SelectedValue.ToString());
                    o.isInTotalValue = chkInTotalValue.Checked;
                    o.CreatedBy      = UserBLL.GetCurrentUser();
                    list.Add(o);
                }
            }
            bool issaved = false;

            issaved = objGFG.Save(list);
            if (issaved == true)
            {
                this.lblMessage.Text = "Data Updated Successfully.";
            }
            else
            {
                this.lblMessage.Text = "unable to  Updated Successfully.";
            }
        }