Exemplo n.º 1
0
        public DbStatusEntity UpdateClientCategory(ClientCategoryMasterEntity obj, int id)
        {
            DbStatusEntity objreturn = new DbStatusEntity();
            string         CS        = ConfigurationManager.ConnectionStrings["DBCS"].ConnectionString;

            try
            {
                using (SqlConnection con = new SqlConnection(CS))
                {
                    SqlCommand cmd = new SqlCommand(ClientMasterQueries.UpdateClientCategoryMaster, con);
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.Parameters.AddWithValue("@CLI_CAT_ID", id);
                    cmd.Parameters.AddWithValue("@CLI_CAT_NAME", obj.CLI_CAT_NAME);
                    cmd.Parameters.AddWithValue("@ACTIVE_STATUS", obj.ACTIVE_STATUS);

                    cmd.Parameters.Add("@RESULT", SqlDbType.Int);
                    cmd.Parameters["@RESULT"].Direction = ParameterDirection.Output;
                    cmd.Parameters.Add("@CNT", SqlDbType.Int);
                    cmd.Parameters["@CNT"].Direction = ParameterDirection.Output;
                    cmd.Parameters.Add("@MSG", SqlDbType.NVarChar, 500);
                    cmd.Parameters["@MSG"].Direction = ParameterDirection.Output;
                    con.Open();
                    cmd.ExecuteNonQuery();
                    objreturn.RESULT = Convert.ToInt32(cmd.Parameters["@RESULT"].Value);
                    objreturn.CNT    = Convert.ToInt32(cmd.Parameters["@CNT"].Value);
                    objreturn.MSG    = Convert.ToString(cmd.Parameters["@MSG"].Value);
                    con.Close();
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(objreturn);
        }
Exemplo n.º 2
0
        public List <ClientCategoryMasterEntity> GetActiveClientCategories()
        {
            string         CS = ConfigurationManager.ConnectionStrings["DBCS"].ConnectionString;
            SqlDataAdapter adapter;
            DataSet        ds = new DataSet();
            List <ClientCategoryMasterEntity> retlst = new List <ClientCategoryMasterEntity>();

            try
            {
                using (SqlConnection con = new SqlConnection(CS))
                {
                    SqlCommand cmd = new SqlCommand("USP_GetActiveClientCateGoryList", con);
                    cmd.CommandType = CommandType.StoredProcedure;
                    con.Open();
                    adapter = new SqlDataAdapter(cmd);
                    adapter.Fill(ds);

                    for (int i = 0; i <= ds.Tables[0].Rows.Count - 1; i++)
                    {
                        ClientCategoryMasterEntity obj = new ClientCategoryMasterEntity();
                        obj.CLI_CAT_ID    = Convert.ToInt32(ds.Tables[0].Rows[i]["CLI_CAT_ID"].ToString());
                        obj.CLI_CAT_NAME  = ds.Tables[0].Rows[i]["CLI_CAT_NAME"].ToString();
                        obj.ACTIVE_STATUS = true;
                        retlst.Add(obj);
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(retlst);
        }
Exemplo n.º 3
0
        public List <ClientCategoryMasterEntity> EditClientCategory(int id)
        {
            string         CS = ConfigurationManager.ConnectionStrings["DBCS"].ConnectionString;
            SqlDataAdapter adapter;
            DataSet        ds = new DataSet();
            List <ClientCategoryMasterEntity> retlst = new List <ClientCategoryMasterEntity>();

            try
            {
                using (SqlConnection con = new SqlConnection(CS))
                {
                    SqlCommand cmd = new SqlCommand(ClientMasterQueries.GetClientCategoryDetailsbyID, con);
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.Parameters.AddWithValue("@ID", id);
                    con.Open();
                    adapter = new SqlDataAdapter(cmd);
                    adapter.Fill(ds);

                    for (int i = 0; i <= ds.Tables[0].Rows.Count - 1; i++)
                    {
                        ClientCategoryMasterEntity obj = new ClientCategoryMasterEntity();
                        obj.CLI_CAT_ID    = Convert.ToInt32(ds.Tables[0].Rows[i]["CLI_CAT_ID"].ToString());
                        obj.CLI_CAT_NAME  = ds.Tables[0].Rows[i]["CLI_CAT_NAME"].ToString();
                        obj.ACTIVE_STATUS = Convert.ToBoolean(ds.Tables[0].Rows[i]["ACTIVE_STATUS"]);
                        retlst.Add(obj);
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(retlst);
        }
Exemplo n.º 4
0
        public static DbStatusEntity[] InsertData(ClientCategoryMasterEntity obj)
        {
            var details = new List <DbStatusEntity>();

            try
            {
                details.Add(new ClientCategoryMasterDAO().InsertClientCategory(obj));
            }
            catch (Exception ex)
            {
                details.Clear();
                details.Add(new DbStatusEntity(ex.Message));
            }
            return(details.ToArray());
        }
Exemplo n.º 5
0
        public static DbStatusEntity[] UpdateData(ClientCategoryMasterEntity obj, int id) //Update data in database
        {
            var details = new List <DbStatusEntity>();

            try
            {
                details.Add(new ClientCategoryMasterDAO().UpdateClientCategory(obj, id));
            }
            catch (Exception ex)
            {
                details.Clear();
                details.Add(new DbStatusEntity(ex.Message));
            }
            return(details.ToArray());
        }