Exemplo n.º 1
0
        public int UpdateComeToMoney(int ViseCode, decimal ComeToMoney)
        {
            int num = 0;

            using (SqlConnection connection = new SqlConnection(FunctionRule.GetConnectionString()))
            {
                connection.Open();
                SqlTransaction transaction = connection.BeginTransaction();
                try
                {
                    try
                    {
                        LocaleViseBLL   ebll      = new LocaleViseBLL();
                        LocaleViseModel viseModel = ebll.GetModel(ViseCode, transaction);
                        viseModel.ViseComeToMoney = ComeToMoney;
                        num = ebll.Update(viseModel, transaction);
                        transaction.Commit();
                    }
                    catch (SqlException exception)
                    {
                        transaction.Rollback();
                        connection.Close();
                        throw exception;
                    }
                    return(num);
                }
                finally
                {
                    connection.Close();
                }
            }
            return(num);
        }
Exemplo n.º 2
0
        public static ViseBalanceStatusEnum GetBalanceStatus(int ViseCode)
        {
            LocaleViseBLL         ebll    = new LocaleViseBLL();
            ViseBalanceStatusEnum unknown = ViseBalanceStatusEnum.unknown;

            using (SqlConnection connection = new SqlConnection(FunctionRule.GetConnectionString()))
            {
                try
                {
                    switch (ebll.GetModel(ViseCode, connection).ViseBalanceStatus)
                    {
                    case 1:
                        unknown = ViseBalanceStatusEnum.nobalance;
                        break;

                    case 2:
                        unknown = ViseBalanceStatusEnum.isbalance;
                        break;

                    default:
                        unknown = ViseBalanceStatusEnum.unknown;
                        break;
                    }
                    connection.Close();
                }
                catch (SqlException exception)
                {
                    throw exception;
                }
            }
            return(unknown);
        }
Exemplo n.º 3
0
        public static int ViseAuditForCreateContractChange(int Code, string UserCode, List <LocaleViseCostModel> CostList)
        {
            int        num     = 0;
            DataTable  table   = new DataTable();
            DataColumn column  = new DataColumn("Code", Type.GetType("System.String"));
            DataColumn column2 = new DataColumn("Type", Type.GetType("System.String"));

            table.Columns.Add(column);
            table.Columns.Add(column2);
            DataRow row = table.NewRow();

            row["Code"] = Code;
            row["Type"] = "Vise";
            table.Rows.Add(row);
            using (SqlConnection connection = new SqlConnection(FunctionRule.GetConnectionString()))
            {
                connection.Open();
                SqlTransaction transaction = connection.BeginTransaction();
                try
                {
                    try
                    {
                        LocaleViseBLL ebll = new LocaleViseBLL();
                        foreach (LocaleViseCostModel model in CostList)
                        {
                            ebll.UpdateCost(model, transaction);
                        }
                        num = ebll.PassAudit(Code, transaction);
                        ebll.Balance(Code, transaction);
                        string viseContractCode = ebll.GetModel(Code, transaction).ViseContractCode;
                        if (viseContractCode != "")
                        {
                            ContractRule.BuildContractChangeByNexusCodeType(viseContractCode, table, transaction, UserCode);
                        }
                        transaction.Commit();
                    }
                    catch (SqlException exception)
                    {
                        transaction.Rollback();
                        connection.Close();
                        throw exception;
                    }
                    return(num);
                }
                finally
                {
                    connection.Close();
                }
            }
            return(num);
        }
Exemplo n.º 4
0
        public static string GetViseName(int Code)
        {
            string viseName = "";

            using (SqlConnection connection = new SqlConnection(FunctionRule.GetConnectionString()))
            {
                try
                {
                    LocaleViseBLL ebll = new LocaleViseBLL();
                    viseName = ebll.GetModel(Code, connection).ViseName;
                    connection.Close();
                }
                catch (SqlException exception)
                {
                    throw exception;
                }
            }
            return(viseName);
        }