Exemple #1
0
        protected void gvProblemObserved_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            Business.Service.ProblemMasters objProblemObserved = new Business.Service.ProblemMasters();
            Entity.Service.ProblemMasters   problemObserved    = new Entity.Service.ProblemMasters();

            if (e.CommandName == "Ed")
            {
                Id = int.Parse(e.CommandArgument.ToString());
                problemObserved = objProblemObserved.GetById(Id);

                txtName.Text = problemObserved.Name;
            }
            else if (e.CommandName == "Del")
            {
                int i = objProblemObserved.Delete(int.Parse(e.CommandArgument.ToString()));
                if (i > 0)
                {
                    ClearControls();
                    LoadProblemObserved();
                    Message.IsSuccess = true;
                    Message.Text      = "Problem observed deleted successfully...";
                }
                else
                {
                    Message.IsSuccess = false;
                    Message.Text      = "Sorry, can not delete!";
                }
                Message.Show = true;
            }
        }
Exemple #2
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            Business.Service.ProblemMasters objProblemObserved = new Business.Service.ProblemMasters();
            Entity.Service.ProblemMasters   problemObserved    = new Entity.Service.ProblemMasters();

            problemObserved.Id   = Id;
            problemObserved.Name = txtName.Text;
            problemObserved.Type = 1; //1 for Problem Observed master data

            int i = objProblemObserved.Save(problemObserved);

            if (i > 0)
            {
                ClearControls();
                LoadProblemObserved();
                Message.IsSuccess = true;
                Message.Text      = "Problem observed saved successfully...";
            }
            else
            {
                Message.IsSuccess = false;
                Message.Text      = "Can not save!!!";
            }
            Message.Show = true;
        }
Exemple #3
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            Business.Service.ProblemMasters objProblemMasters = new Business.Service.ProblemMasters();
            Entity.Service.ProblemMasters   problemMasters    = new Entity.Service.ProblemMasters();

            problemMasters.Id   = Id;
            problemMasters.Name = txtName.Text;
            problemMasters.Type = 2; //1 for Diagnosis master data

            int i = objProblemMasters.Save(problemMasters);

            if (i > 0)
            {
                ClearControls();
                LoadDiagonosis();
                Message.IsSuccess = true;
                Message.Text      = "Diagnosis saved successfully...";
            }
            else
            {
                Message.IsSuccess = false;
                Message.Text      = "Can not save!!!";
            }
            Message.Show = true;
        }
        public static Entity.Service.ProblemMasters GetById(int Id)
        {
            Entity.Service.ProblemMasters problemMasters = new Entity.Service.ProblemMasters();
            using (SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["constr"].ToString()))
            {
                using (SqlCommand cmd = new SqlCommand())
                {
                    cmd.Parameters.AddWithValue("@Id", Id);



                    cmd.Connection  = con;
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.CommandText = "usp_Service_ProblemMasters_GetById";
                    if (con.State == ConnectionState.Closed)
                    {
                        con.Open();
                    }
                    SqlDataReader dr = cmd.ExecuteReader();
                    if (dr.Read())
                    {
                        if (dr.HasRows)
                        {
                            problemMasters.Id   = Id;
                            problemMasters.Name = dr["Name"].ToString();
                        }
                    }
                    con.Close();
                }
            }
            return(problemMasters);
        }
        public static int Save(Entity.Service.ProblemMasters problemMasters)
        {
            int rowsAffacted = 0;

            using (SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["constr"].ToString()))
            {
                using (SqlCommand cmd = new SqlCommand())
                {
                    cmd.Connection  = con;
                    cmd.CommandText = "usp_Service_ProblemMasters_Save";
                    cmd.CommandType = CommandType.StoredProcedure;

                    cmd.Parameters.AddWithValue("@Id", problemMasters.Id);
                    cmd.Parameters.AddWithValue("@Name", problemMasters.Name);
                    cmd.Parameters.AddWithValue("@Type", problemMasters.Type);

                    if (con.State == ConnectionState.Closed)
                    {
                        con.Open();
                    }
                    rowsAffacted = cmd.ExecuteNonQuery();
                    con.Close();
                }
            }
            return(rowsAffacted);
        }
 public int Save(Entity.Service.ProblemMasters problemObserved)
 {
     return(DataAccess.Service.ProblemMasters.Save(problemObserved));
 }