示例#1
0
        public ActionMessage editEmloyee(int id, CapitalInfo _capital)
        {
            ActionMessage ret = new ActionMessage();

            if (_capital.CapitalName.Trim() == string.Empty)
            {
                ret.isSuccess     = false;
                ret.err.msgCode   = "Internal Error";
                ret.err.msgString = "Chưa nhập tên";
            }
            else
            {
                SqlConnectionFactory sqlConnection = new SqlConnectionFactory();
                using (SqlConnection connection = sqlConnection.GetConnection())
                {
                    {
                        try
                        {
                            CapitalDataLayer.GetInstance().UpdateCapital(connection, _capital);
                            ret.isSuccess = true;
                        }
                        catch (Exception ex)
                        {
                            ret.isSuccess     = false;
                            ret.err.msgCode   = "Internal Error";
                            ret.err.msgString = ex.ToString();
                        }
                    }
                }
            }
            return(ret);
        }
示例#2
0
        public ActionMessage createCapital(CapitalInfo _capital)
        {
            ActionMessage ret = new ActionMessage();

            if (_capital.CapitalName.Trim() == string.Empty)
            {
                ret.isSuccess     = false;
                ret.err.msgCode   = "Internal Error";
                ret.err.msgString = "Chưa nhập tên";
            }
            //else if (_department.SourceID == -1)
            //{
            //}
            else
            {
                SqlConnectionFactory sqlConnection = new SqlConnectionFactory();
                using (SqlConnection connection = sqlConnection.GetConnection())
                {
                    try
                    {
                        CapitalDataLayer.GetInstance().InsertCapital(connection, _capital);
                        ret.isSuccess = true;
                    }
                    catch (Exception ex)
                    {
                        ret.isSuccess     = false;
                        ret.err.msgCode   = "Internal Error";
                        ret.err.msgString = ex.ToString();
                    }
                }
            }
            return(ret);
        }
示例#3
0
        public CapitalInfo getCapitalbyId(int _ID)
        {
            SqlConnectionFactory sqlConnection = new SqlConnectionFactory();

            using (SqlConnection connection = sqlConnection.GetConnection())
            {
                List <CapitalInfo> ListDepartment = CapitalDataLayer.GetInstance().GetAllCapitalbyID(connection, _ID);
                CapitalInfo        findCapital    = ListDepartment.First();
                return(findCapital);
            }
        }
示例#4
0
        public List <CapitalInfo> GetByName(string name)
        {
            SqlConnectionFactory sqlConnection = new SqlConnectionFactory();

            using (SqlConnection connection = sqlConnection.GetConnection())
            {
                List <CapitalInfo> ListCapital = CapitalDataLayer.GetInstance().GetByName(connection, name);

                return(ListCapital);
            }
        }
示例#5
0
        public List <CapitalInfo> getAllCapital()
        {
            SqlConnectionFactory sqlConnection = new SqlConnectionFactory();

            using (SqlConnection connection = sqlConnection.GetConnection())
            {
                List <CapitalInfo> ListCapital = CapitalDataLayer.GetInstance().GetAllCapital(connection);

                return(ListCapital);
            }
        }
示例#6
0
        public ActionMessage deleteCapital(int id)
        {
            ActionMessage ret = new ActionMessage();

            SqlConnectionFactory sqlConnection = new SqlConnectionFactory();

            using (SqlConnection connection = sqlConnection.GetConnection())
            {
                try
                {
                    CapitalDataLayer.GetInstance().DeleteCapital(connection, id);
                    ret.isSuccess = true;
                }
                catch (Exception ex)
                {
                    ret.isSuccess     = false;
                    ret.err.msgCode   = "Internal Error";
                    ret.err.msgString = ex.ToString();
                }
            }
            return(ret);
        }