Example #1
0
        public void UpdateMaterial(Material mat, string strOldMaterialCode, OperLog operLog)//,BusiLog busiLog)
        {
            using (SqlConnection conn = ConnectionPool.BorrowConnection())
            {
                //conn.Open();

                SqlTransaction trans = conn.BeginTransaction();
                try
                {
                    string   strSysTime = SqlHelper.ExecuteScalar(trans, CommandType.Text, "select getdate()").ToString();
                    DateTime dtSysTime  = DateTime.Parse(strSysTime);

                    operLog.cndOperDate  = dtSysTime;
                    operLog.cnvcComments = "原料材料编码:" + mat.cnvcMaterialCode;
                    EntityMapping.Create(operLog, trans);

                    MaterialAccess.UpdateMaterial(trans, mat, strOldMaterialCode);
                    SqlHelper.ExecuteNonQuery(trans, CommandType.Text, "Update tbProvider set cnvcProductName='" + mat.cnvcMaterialName + "' where cnvcProductCode='" + mat.cnvcMaterialCode + "' and cnvcProductName<>'" + mat.cnvcMaterialName + "'");
                    trans.Commit();
                }
                catch (SqlException sex)
                {
                    trans.Rollback();
                    LogAdapter.WriteDatabaseException(sex);
                    throw sex;
                }
                catch (Exception ex)
                {
                    trans.Rollback();
                    LogAdapter.WriteFeaturesException(ex);
                    throw ex;
                }
                finally
                {
                    ConnectionPool.ReturnConnection(conn);
                }
            }
        }
Example #2
0
        // this function is shared between ShaderGraph and hand-written GUIs
        internal static void UpdateMaterialRenderQueueControl(Material material)
        {
            //
            // Render Queue Control handling
            //
            // Check for a raw render queue (the actual serialized setting - material.renderQueue has already been converted)
            // setting of -1, indicating that the material property should be inherited from the shader.
            // If we find this, add a new property "render queue control" set to 0 so we will
            // always know to follow the surface type of the material (this matches the hand-written behavior)
            // If we find another value, add the the property set to 1 so we will know that the
            // user has explicitly selected a render queue and we should not override it.
            //
            bool isShaderGraph  = material.IsShaderGraph(); // Non-shadergraph materials use automatic behavior
            int  rawRenderQueue = MaterialAccess.ReadMaterialRawRenderQueue(material);

            if (!isShaderGraph || rawRenderQueue == -1)
            {
                material.SetFloat(Property.QueueControl, (float)QueueControl.Auto); // Automatic behavior - surface type override
            }
            else
            {
                material.SetFloat(Property.QueueControl, (float)QueueControl.UserOverride); // User has selected explicit render queue
            }
        }