public static Entity.HR.LoyaltyPointReasonMaster GetById(int loyaltyPointReasonId)
        {
            Entity.HR.LoyaltyPointReasonMaster loyaltyPointReasonMaster = new Entity.HR.LoyaltyPointReasonMaster();
            using (SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["constr"].ToString()))
            {
                using (SqlCommand cmd = new SqlCommand())
                {
                    cmd.Parameters.AddWithValue("@LoyaltyPointReasonId", loyaltyPointReasonId);

                    cmd.Connection  = con;
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.CommandText = "usp_HR_LoyaltyPointReason_GetById";
                    if (con.State == ConnectionState.Closed)
                    {
                        con.Open();
                    }
                    SqlDataReader dr = cmd.ExecuteReader();
                    if (dr.Read())
                    {
                        if (dr.HasRows)
                        {
                            loyaltyPointReasonMaster.LoyaltyPointReasonId = loyaltyPointReasonId;
                            loyaltyPointReasonMaster.Reason        = dr["Reason"].ToString();
                            loyaltyPointReasonMaster.Description   = dr["Description"].ToString();
                            loyaltyPointReasonMaster.DesignationId = int.Parse(dr["DesignationMasterId"].ToString());
                        }
                    }
                    con.Close();
                }
            }
            return(loyaltyPointReasonMaster);
        }
 public static DataTable GetAll(Entity.HR.LoyaltyPointReasonMaster loyaltyPointReasonMaster)
 {
     using (DataTable dt = new DataTable())
     {
         using (SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["constr"].ToString()))
         {
             using (SqlCommand cmd = new SqlCommand())
             {
                 cmd.Connection  = con;
                 cmd.CommandType = CommandType.StoredProcedure;
                 cmd.CommandText = "usp_HR_LoyaltyPointReason_GetAll";
                 if (con.State == ConnectionState.Closed)
                 {
                     con.Open();
                 }
                 using (SqlDataAdapter da = new SqlDataAdapter(cmd))
                 {
                     da.Fill(dt);
                 }
                 con.Close();
             }
         }
         return(dt);
     }
 }
        public static int Save(Entity.HR.LoyaltyPointReasonMaster loyaltyPointReasonMaster)
        {
            int rowsAffacted = 0;

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

                    cmd.Parameters.AddWithValue("@LoyaltyPointReasonId", loyaltyPointReasonMaster.LoyaltyPointReasonId);
                    cmd.Parameters.AddWithValue("@DesignationId", loyaltyPointReasonMaster.DesignationId);
                    cmd.Parameters.AddWithValue("@Reason", loyaltyPointReasonMaster.Reason);
                    cmd.Parameters.AddWithValue("@Description", loyaltyPointReasonMaster.Description);

                    if (con.State == ConnectionState.Closed)
                    {
                        con.Open();
                    }
                    rowsAffacted = cmd.ExecuteNonQuery();
                    con.Close();
                }
            }
            return(rowsAffacted);
        }
Example #4
0
        protected void gvLoyaltyReason_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            try
            {
                Business.HR.LoyaltyPointReasonMaster objLoyaltyPointReasonMaster = new Business.HR.LoyaltyPointReasonMaster();
                Entity.HR.LoyaltyPointReasonMaster   loyaltyPointReasonMaster    = new Entity.HR.LoyaltyPointReasonMaster();

                if (e.CommandName == "Ed")
                {
                    int reasonId = int.Parse(e.CommandArgument.ToString());
                    loyaltyPointReasonMaster     = objLoyaltyPointReasonMaster.GetById(reasonId);
                    LoyaltyPointReasonId         = loyaltyPointReasonMaster.LoyaltyPointReasonId;
                    txtDescription.Text          = loyaltyPointReasonMaster.Description;
                    txtReason.Text               = loyaltyPointReasonMaster.Reason;
                    ddlDesignation.SelectedValue = Convert.ToString(loyaltyPointReasonMaster.DesignationId);
                }
                else if (e.CommandName == "Del")
                {
                    int cityId = int.Parse(e.CommandArgument.ToString());
                    int i      = objLoyaltyPointReasonMaster.Delete(cityId);

                    if (i > 0)
                    {
                        GlobalCache.RemoveAll();
                        ClearControls();
                        LoadLoyaltyPointReasonMaster();
                        Message.IsSuccess = true;
                        Message.Text      = "Reason deleted successfully...";
                    }
                    else
                    {
                        Message.IsSuccess = false;
                        Message.Text      = "Sorry!! data not delete.";
                    }
                    Message.Show = true;
                }
            }
            catch (Exception ex)
            {
                ex.WriteException();

                Message.IsSuccess = false;
                Message.Text      = ex.Message;
                Message.Show      = true;
            }
        }
Example #5
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                Business.HR.LoyaltyPointReasonMaster objLoyaltyPointReasonMaster = new Business.HR.LoyaltyPointReasonMaster();
                Entity.HR.LoyaltyPointReasonMaster   loyaltyPointReasonMaster    = new Entity.HR.LoyaltyPointReasonMaster();

                loyaltyPointReasonMaster.LoyaltyPointReasonId = LoyaltyPointReasonId;
                loyaltyPointReasonMaster.Reason        = txtReason.Text.Trim();
                loyaltyPointReasonMaster.Description   = txtDescription.Text.Trim();
                loyaltyPointReasonMaster.DesignationId = int.Parse(ddlDesignation.SelectedValue);

                int response = objLoyaltyPointReasonMaster.Save(loyaltyPointReasonMaster);

                if (response > 0)
                {
                    GlobalCache.RemoveAll();
                    ClearControls();
                    LoadLoyaltyPointReasonMaster();
                    Message.IsSuccess = true;
                    Message.Text      = "Reason saved successfully...";
                }
                else
                {
                    Message.IsSuccess = false;
                    Message.Text      = "Sorry!! data not saved.";
                }
                Message.Show = true;
            }
            catch (Exception ex)
            {
                ex.WriteException();

                Message.IsSuccess = false;
                Message.Text      = ex.Message;
                Message.Show      = true;
            }
        }
 public static DataTable GetAll(Entity.HR.LoyaltyPointReasonMaster city)
 {
     return(DataAccess.HR.LoyaltyPointReasonMaster.GetAll(city));
 }
 public int Save(Entity.HR.LoyaltyPointReasonMaster city)
 {
     return(DataAccess.HR.LoyaltyPointReasonMaster.Save(city));
 }