コード例 #1
0
ファイル: GenericDAO.cs プロジェクト: prasannadharm/Catalogue
        public List <InwardTypeMasterEntity> GetActiveInwardTypeList()
        {
            string         CS = ConfigurationManager.ConnectionStrings["DBCS"].ConnectionString;
            SqlDataAdapter adapter;
            DataSet        ds = new DataSet();
            List <InwardTypeMasterEntity> retlst = new List <InwardTypeMasterEntity>();

            try
            {
                using (SqlConnection con = new SqlConnection(CS))
                {
                    SqlCommand cmd = new SqlCommand("USP_GetActiveInwardTypeList", 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++)
                    {
                        InwardTypeMasterEntity obj = new InwardTypeMasterEntity();
                        obj.ID   = Convert.ToInt32(ds.Tables[0].Rows[i]["ID"].ToString());
                        obj.NAME = ds.Tables[0].Rows[i]["NAME"].ToString();
                        retlst.Add(obj);
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(retlst);
        }
コード例 #2
0
        public DbStatusEntity UpdateInwardType(InwardTypeMasterEntity obj, int id)
        {
            DbStatusEntity objreturn = new DbStatusEntity();
            string         CS        = ConfigurationManager.ConnectionStrings["DBCS"].ConnectionString;

            try
            {
                using (SqlConnection con = new SqlConnection(CS))
                {
                    SqlCommand cmd = new SqlCommand("USP_UpdateInwardTypeMaster", con);
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.Parameters.AddWithValue("@ID", id);
                    cmd.Parameters.AddWithValue("@NAME", obj.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);
        }
コード例 #3
0
        public static DbStatusEntity[] InsertData(InwardTypeMasterEntity obj)
        {
            var details = new List <DbStatusEntity>();

            try
            {
                details.Add(new InwardTypeMasterDAO().InsertInwardTypeMaster(obj));
            }
            catch (Exception ex)
            {
                details.Clear();
                details.Add(new DbStatusEntity(ex.Message));
            }
            return(details.ToArray());
        }
コード例 #4
0
        public static DbStatusEntity[] UpdateData(InwardTypeMasterEntity obj, int id) //Update data in database
        {
            var details = new List <DbStatusEntity>();

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