コード例 #1
0
ファイル: LanguageMapper.cs プロジェクト: GramozKrasniqi/HRMS
        public void Insert(LanguageEntity t)
        {
            SqlConnection conn = null;
            SqlCommand cmd = null;

            try
            {
                conn = DALHelper.CreateSqlDbConnection();
                cmd = new SqlCommand("usp_InsertLanguage", conn);
                cmd.CommandType = System.Data.CommandType.StoredProcedure;

                cmd.Parameters.AddWithValue("@Title", t.Title);
                cmd.Parameters.AddWithValue("@Description", t.Description);
                cmd.Parameters.AddWithValue("@ApplicationId", t.ApplicationId);

                t.Id = Convert.ToInt32(cmd.ExecuteScalar());
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                conn.Close();
                cmd.Dispose();
                conn.Dispose();
            }
        }
コード例 #2
0
ファイル: LanguageMapper.cs プロジェクト: GramozKrasniqi/HRMS
        public void Delete(LanguageEntity t)
        {
            SqlConnection conn = null;
            SqlCommand cmd = null;

            try
            {
                conn = DALHelper.CreateSqlDbConnection();
                cmd = new SqlCommand("usp_DeleteLanguage", conn);
                cmd.CommandType = System.Data.CommandType.StoredProcedure;

                cmd.Parameters.AddWithValue("@Id", t.Id);

                cmd.ExecuteNonQuery();
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                conn.Close();
                cmd.Dispose();
                conn.Dispose();
            }
        }
コード例 #3
0
ファイル: Add.aspx.cs プロジェクト: GramozKrasniqi/HRMS
        protected void ProceedButton_Click(object sender, EventArgs e)
        {
            LanguageEntity entity = new LanguageEntity();
            entity.Title = TitleTextBox.Text;
            entity.Description = OtherInfoTextBox.Text;
            entity.ApplicationId = Convert.ToInt32(ConfigurationManager.AppSettings["ApplicationId"]);

            new LanguageMapper().Insert(entity);
            Response.Redirect("List.aspx");
        }
コード例 #4
0
ファイル: Edit.aspx.cs プロジェクト: GramozKrasniqi/HRMS
        protected void ProceedButton_Click(object sender, EventArgs e)
        {
            LanguageEntity entity = new LanguageEntity();
            entity.Id = Convert.ToInt32(Request.QueryString["LanguageId"]);
            entity.Title = TitleTextBox.Text;
            entity.Description = OtherInfoTextBox.Text;
            entity.Status = StatusEnum.Active;
            entity.ApplicationId = Convert.ToInt32(ConfigurationManager.AppSettings["ApplicationId"]);

            new LanguageMapper().Update(entity);

            Response.Redirect("List.aspx");
        }
コード例 #5
0
ファイル: LanguageMapper.cs プロジェクト: GramozKrasniqi/HRMS
        public LanguageEntity Get(int Id)
        {
            SqlConnection conn = null;
            SqlCommand cmd = null;

            try
            {
                conn = DALHelper.CreateSqlDbConnection();
                cmd = new SqlCommand("usp_GetLanguageById", conn);
                cmd.CommandType = System.Data.CommandType.StoredProcedure;

                cmd.Parameters.AddWithValue("@Id", Id);

                SqlDataReader rdr = cmd.ExecuteReader();
                LanguageEntity entity = new LanguageEntity();

                while (rdr.Read())
                {
                    entity.Id = Convert.ToInt32(rdr["Id"]);
                    entity.Status = (StatusEnum)Convert.ToInt32(rdr["Status"]);
                    entity.Title = Convert.ToString(rdr["Title"]);
                    entity.Description = Convert.ToString(rdr["Description"]);
                    entity.ApplicationId = Convert.ToInt32(rdr["ApplicationId"]);
                }

                return entity;
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                conn.Close();
                cmd.Dispose();
                conn.Dispose();
            }
        }
コード例 #6
0
ファイル: LanguageMapper.cs プロジェクト: GramozKrasniqi/HRMS
        public List<LanguageEntity> ListForContractTemplate(int ContractTemplateId)
        {
            SqlConnection conn = null;
            SqlCommand cmd = null;

            try
            {
                conn = DALHelper.CreateSqlDbConnection();
                cmd = new SqlCommand("usp_ListLanguagesForContractTemplate", conn);
                cmd.CommandType = System.Data.CommandType.StoredProcedure;

                cmd.Parameters.AddWithValue("@ContractTemplateId", ContractTemplateId);

                SqlDataReader rdr = cmd.ExecuteReader();
                List<LanguageEntity> list = new List<LanguageEntity>();

                while (rdr.Read())
                {
                    LanguageEntity entity = new LanguageEntity();
                    entity.Id = Convert.ToInt32(rdr["Id"]);
                    entity.Status = (StatusEnum)rdr["Status"];
                    entity.Title = Convert.ToString(rdr["Title"]);
                    entity.Description = Convert.ToString(rdr["Description"]);
                    entity.ApplicationId = Convert.ToInt32(rdr["ApplicationId"]);

                    list.Add(entity);
                }

                return list;
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                conn.Close();
                cmd.Dispose();
                conn.Dispose();
            }
        }